diff --git a/tests/AnchorTest.php b/tests/AnchorTest.php index 8311cda5..e396aee9 100644 --- a/tests/AnchorTest.php +++ b/tests/AnchorTest.php @@ -15,8 +15,6 @@ class AnchorTest extends TestCase protected function setUp(): void { - parent::setUp(); - $invoker = (new InvokerFactory())(); $author = new Author(); $author->onGet(1); diff --git a/tests/AppIteratorTest.php b/tests/AppIteratorTest.php index 939e0a80..081509b9 100644 --- a/tests/AppIteratorTest.php +++ b/tests/AppIteratorTest.php @@ -23,7 +23,7 @@ protected function setUp(): void public function testForEach(): void { - foreach ($this->appIterator as $key => $meta) { + foreach ($this->appIterator as $meta) { $isValidUri = filter_var($meta->uri, FILTER_VALIDATE_URL); $this->assertTrue((bool) $isValidUri); $this->assertInstanceOf(Meta::class, $meta); diff --git a/tests/AttrNamedParameterTest.php b/tests/AttrNamedParameterTest.php index a182d939..7444663a 100644 --- a/tests/AttrNamedParameterTest.php +++ b/tests/AttrNamedParameterTest.php @@ -15,8 +15,6 @@ class AttrNamedParameterTest extends TestCase protected function setUp(): void { - parent::setUp(); - $this->params = new NamedParameter(new NamedParamMetas(), new Injector()); } diff --git a/tests/AttributeTest.php b/tests/AttributeTest.php index e04ad447..7bd36b3a 100644 --- a/tests/AttributeTest.php +++ b/tests/AttributeTest.php @@ -18,8 +18,6 @@ class AttributeTest extends TestCase protected function setUp(): void { - parent::setUp(); - $injector = new Injector(new ResourceModule('FakeVendor\News'), __DIR__ . '/tmp'); $this->resource = $injector->getInstance(ResourceInterface::class); } diff --git a/tests/FactoryTest.php b/tests/FactoryTest.php index 5c14719c..5dbb7161 100644 --- a/tests/FactoryTest.php +++ b/tests/FactoryTest.php @@ -21,8 +21,6 @@ class FactoryTest extends TestCase protected function setUp(): void { - parent::setUp(); - $injector = new Injector(); $scheme = (new SchemeCollection()) ->scheme('app')->host('self')->toAdapter(new AppAdapter($injector, 'FakeVendor\Sandbox')) diff --git a/tests/Fake/FakeFreeze.php b/tests/Fake/FakeFreeze.php index a5c9fa92..a1558d69 100644 --- a/tests/Fake/FakeFreeze.php +++ b/tests/Fake/FakeFreeze.php @@ -16,7 +16,7 @@ class FakeFreeze extends ResourceObject public function __construct() { - $this->closure = function () { + $this->closure = function (): void { }; $module = new FakeSchemeModule(new ResourceModule('FakeVendor\Sandbox')); /* @var $resource ResourceInterface */ diff --git a/tests/Fake/FakeLazyModule.php b/tests/Fake/FakeLazyModule.php index 8533a579..5ec4c171 100644 --- a/tests/Fake/FakeLazyModule.php +++ b/tests/Fake/FakeLazyModule.php @@ -9,7 +9,7 @@ final class FakeLazyModule implements LazyModuleInterface { - public function __construct(private AbstractModule $module) + public function __construct(private readonly AbstractModule $module) { } diff --git a/tests/Fake/FakeSchemeCollectionProvider.php b/tests/Fake/FakeSchemeCollectionProvider.php index 4e842008..8ec18645 100644 --- a/tests/Fake/FakeSchemeCollectionProvider.php +++ b/tests/Fake/FakeSchemeCollectionProvider.php @@ -9,7 +9,7 @@ class FakeSchemeCollectionProvider implements ProviderInterface { - public function __construct(private InjectorInterface $injector) + public function __construct(private readonly InjectorInterface $injector) { } diff --git a/tests/Fake/FakeVendor/Blog/src/Resource/App/News.php b/tests/Fake/FakeVendor/Blog/src/Resource/App/News.php index 0b201a6d..d5086586 100644 --- a/tests/Fake/FakeVendor/Blog/src/Resource/App/News.php +++ b/tests/Fake/FakeVendor/Blog/src/Resource/App/News.php @@ -10,7 +10,7 @@ class News extends ResourceObject { - public function __construct(private ResourceInterface $resource) + public function __construct(private readonly ResourceInterface $resource) { } diff --git a/tests/Fake/FakeVendor/Sandbox/Resource/App/Href/Hasembed.php b/tests/Fake/FakeVendor/Sandbox/Resource/App/Href/Hasembed.php index 79155365..4e9115a1 100644 --- a/tests/Fake/FakeVendor/Sandbox/Resource/App/Href/Hasembed.php +++ b/tests/Fake/FakeVendor/Sandbox/Resource/App/Href/Hasembed.php @@ -11,7 +11,7 @@ class Hasembed extends ResourceObject { - public function __construct(private ResourceInterface $resource) + public function __construct(private readonly ResourceInterface $resource) { } diff --git a/tests/Fake/FakeVendor/Sandbox/Resource/App/Href/Origin.php b/tests/Fake/FakeVendor/Sandbox/Resource/App/Href/Origin.php index 41fab997..94cf8e49 100644 --- a/tests/Fake/FakeVendor/Sandbox/Resource/App/Href/Origin.php +++ b/tests/Fake/FakeVendor/Sandbox/Resource/App/Href/Origin.php @@ -10,7 +10,7 @@ class Origin extends ResourceObject { - public function __construct(private ResourceInterface $resource) + public function __construct(private readonly ResourceInterface $resource) { } diff --git a/tests/Fake/FakeVendor/Sandbox/Resource/App/News.php b/tests/Fake/FakeVendor/Sandbox/Resource/App/News.php index c785afa8..71abc359 100644 --- a/tests/Fake/FakeVendor/Sandbox/Resource/App/News.php +++ b/tests/Fake/FakeVendor/Sandbox/Resource/App/News.php @@ -10,7 +10,7 @@ class News extends ResourceObject { - public function __construct(private ResourceInterface $resource) + public function __construct(private readonly ResourceInterface $resource) { } diff --git a/tests/Fake/FakeVendor/Sandbox/Resource/App/User/Entry.php b/tests/Fake/FakeVendor/Sandbox/Resource/App/User/Entry.php index 49e794cb..4ff76585 100644 --- a/tests/Fake/FakeVendor/Sandbox/Resource/App/User/Entry.php +++ b/tests/Fake/FakeVendor/Sandbox/Resource/App/User/Entry.php @@ -15,7 +15,7 @@ class Entry extends ResourceObject 102 => ['id' => 102, 'title' => 'Entry3'], ]; - public function __construct(private ?\BEAR\Resource\ResourceInterface $resource = null) + public function __construct(private readonly ?\BEAR\Resource\ResourceInterface $resource = null) { } diff --git a/tests/Fake/FakeVendor/Sandbox/Resource/Page/FakeLoop.php b/tests/Fake/FakeVendor/Sandbox/Resource/Page/FakeLoop.php index cd95d3fd..0c82ec8a 100644 --- a/tests/Fake/FakeVendor/Sandbox/Resource/Page/FakeLoop.php +++ b/tests/Fake/FakeVendor/Sandbox/Resource/Page/FakeLoop.php @@ -7,7 +7,7 @@ class FakeLoop extends ResourceObject { - public function __construct(private ResourceInterface $resource) + public function __construct(private readonly ResourceInterface $resource) { } diff --git a/tests/Fake/Mock/PersonConstructor.php b/tests/Fake/Mock/PersonConstructor.php index 4e252828..3217c6d9 100644 --- a/tests/Fake/Mock/PersonConstructor.php +++ b/tests/Fake/Mock/PersonConstructor.php @@ -16,7 +16,7 @@ public function getAge(): int return $this->age; } - public function __construct(private int $age, private string $name) + public function __construct(private readonly int $age, private readonly string $name) { } } diff --git a/tests/Fake/Renderer/FakeErrorRenderer.php b/tests/Fake/Renderer/FakeErrorRenderer.php index 9b42cfb3..da9e1e2e 100644 --- a/tests/Fake/Renderer/FakeErrorRenderer.php +++ b/tests/Fake/Renderer/FakeErrorRenderer.php @@ -9,7 +9,7 @@ class FakeErrorRenderer implements RenderInterface { - public function render(ResourceObject $ro) + public function render(ResourceObject $ro): never { throw new \ErrorException(); } diff --git a/tests/LinkerTest.php b/tests/LinkerTest.php index 65f6e1c0..1c7d9b53 100644 --- a/tests/LinkerTest.php +++ b/tests/LinkerTest.php @@ -20,8 +20,6 @@ class LinkerTest extends TestCase protected function setUp(): void { - parent::setUp(); - $this->invoker = (new InvokerFactory())(); $schemeCollection = (new SchemeCollection()) ->scheme('app') diff --git a/tests/MetaTest.php b/tests/MetaTest.php index 9530737d..955f6e36 100644 --- a/tests/MetaTest.php +++ b/tests/MetaTest.php @@ -15,8 +15,6 @@ class MetaTest extends TestCase protected function setUp(): void { - parent::setUp(); - $this->meta = new Meta(Doc::class); } diff --git a/tests/Module/HalModuleTest.php b/tests/Module/HalModuleTest.php index bc1998d7..fd3fbaff 100644 --- a/tests/Module/HalModuleTest.php +++ b/tests/Module/HalModuleTest.php @@ -16,7 +16,6 @@ class HalModuleTest extends TestCase { protected function setUp(): void { - parent::setUp(); } public function testConfigure(): void diff --git a/tests/Module/ImportModuleTest.php b/tests/Module/ImportModuleTest.php index a08af323..a85dd2ca 100644 --- a/tests/Module/ImportModuleTest.php +++ b/tests/Module/ImportModuleTest.php @@ -32,8 +32,6 @@ protected function setUp(): void $tmpDir = dirname(__DIR__, 2) . '/tests/Fake/FakeVendor/Blog/var/tmp'; $rm($tmpDir); file_put_contents($tmpDir . '/tmp.text', '1'); - - parent::setUp(); } public function testConfigure(): void diff --git a/tests/Module/ResourceModuleTest.php b/tests/Module/ResourceModuleTest.php index 3fb97bbf..86da9c9c 100644 --- a/tests/Module/ResourceModuleTest.php +++ b/tests/Module/ResourceModuleTest.php @@ -13,7 +13,6 @@ class ResourceModuleTest extends TestCase { protected function setUp(): void { - parent::setUp(); } public function testConfigure(): void diff --git a/tests/Module/ResrouceObjectModuleTest.php b/tests/Module/ResrouceObjectModuleTest.php index b988dfd6..9a119985 100644 --- a/tests/Module/ResrouceObjectModuleTest.php +++ b/tests/Module/ResrouceObjectModuleTest.php @@ -23,8 +23,6 @@ final class ResrouceObjectModuleTest extends TestCase { protected function setUp(): void { - parent::setUp(); - @unlink(__DIR__ . '/tmp/compiled'); array_map('unlink', (array) glob(__DIR__ . '/tmp/{*.php}', GLOB_BRACE)); // @phpstan-ignore-line } diff --git a/tests/NamedParameterTest.php b/tests/NamedParameterTest.php index 158df760..c79abfb1 100644 --- a/tests/NamedParameterTest.php +++ b/tests/NamedParameterTest.php @@ -22,8 +22,6 @@ class NamedParameterTest extends TestCase protected function setUp(): void { - parent::setUp(); - $this->params = new NamedParameter(new NamedParamMetas(), new Injector()); } diff --git a/tests/ObjectTest.php b/tests/ObjectTest.php index 75212e43..0c20d9c6 100644 --- a/tests/ObjectTest.php +++ b/tests/ObjectTest.php @@ -16,8 +16,6 @@ class ObjectTest extends TestCase protected function setUp(): void { - parent::setUp(); - $this->ro = new Mock\Entry(); $this->ro[0] = 'entry1'; $this->ro[1] = 'entry2'; diff --git a/tests/RequestTest.php b/tests/RequestTest.php index f97177c6..ca2e8f63 100644 --- a/tests/RequestTest.php +++ b/tests/RequestTest.php @@ -27,8 +27,6 @@ class RequestTest extends TestCase protected function setUp(): void { - parent::setUp(); - $this->invoker = (new InvokerFactory())(); $entry = new Entry(); $entry->uri = new Uri('test://self/path/to/resource'); diff --git a/tests/ResourceParamHandlerTest.php b/tests/ResourceParamHandlerTest.php index 21548caa..0626421d 100644 --- a/tests/ResourceParamHandlerTest.php +++ b/tests/ResourceParamHandlerTest.php @@ -15,8 +15,6 @@ class ResourceParamHandlerTest extends TestCase protected function setUp(): void { - parent::setUp(); - $module = new FakeSchemeModule(new ResourceModule('FakeVendor\Sandbox')); $this->resource = (new Injector($module, __DIR__ . '/tmp'))->getInstance(ResourceInterface::class); } diff --git a/tests/ResourceTest.php b/tests/ResourceTest.php index 19a45b9a..24d4c240 100644 --- a/tests/ResourceTest.php +++ b/tests/ResourceTest.php @@ -27,8 +27,6 @@ class ResourceTest extends TestCase protected function setUp(): void { - parent::setUp(); - $injector = new Injector(new FakeSchemeModule(new ResourceModule('FakeVendor\Sandbox')), __DIR__ . '/tmp'); $this->resource = $injector->getInstance(ResourceInterface::class); } diff --git a/tests/SchemeCollectionTest.php b/tests/SchemeCollectionTest.php index fd4ef79c..bce11d4a 100644 --- a/tests/SchemeCollectionTest.php +++ b/tests/SchemeCollectionTest.php @@ -13,8 +13,6 @@ class SchemeCollectionTest extends TestCase protected function setUp(): void { - parent::setUp(); - $this->scheme = new SchemeCollection(); } diff --git a/tests/Server/index.php b/tests/Server/index.php index 319e6529..f4cd2ddd 100644 --- a/tests/Server/index.php +++ b/tests/Server/index.php @@ -17,7 +17,7 @@ header('Content-Type: application/json; charset=utf-8'); $requestHeaders = []; foreach ($_SERVER as $key => $value) { - if (strncmp($key, 'HTTP_', 5) !== 0) { + if (! str_starts_with($key, 'HTTP_')) { continue; }