diff --git a/composer.json b/composer.json index bb937f1..f5a82b3 100644 --- a/composer.json +++ b/composer.json @@ -56,20 +56,20 @@ "require-dev": { "chubbyphp/chubbyphp-laminas-config": "^1.3", "composer/composer": "^1.5 || ^2.6.6", - "elie29/zend-phpdi-config": "^6.0 || ^8.1.1 || ^9.0", + "elie29/zend-phpdi-config": "^6.0 || ^8.1.1 || ^9.0.1", "filp/whoops": "^2.15.4", "jsoumelidis/zend-sf-di-config": "^0.5.1", "laminas/laminas-coding-standard": "~2.5.0", - "laminas/laminas-development-mode": "^3.10.0", - "laminas/laminas-servicemanager": "^3.20.0", - "mezzio/mezzio-fastroute": "^3.8.0", - "mezzio/mezzio-laminasrouter": "^3.7.0", - "mezzio/mezzio-laminasviewrenderer": "^2.12.0", + "laminas/laminas-development-mode": "^3.12.0", + "laminas/laminas-servicemanager": "^3.22.1", + "mezzio/mezzio-fastroute": "^3.11.0", + "mezzio/mezzio-laminasrouter": "^3.9.0", + "mezzio/mezzio-laminasviewrenderer": "^2.15.0", "mezzio/mezzio-platesrenderer": "^2.10.0", - "mezzio/mezzio-tooling": "^2.8", - "mezzio/mezzio-twigrenderer": "^2.13.0", + "mezzio/mezzio-tooling": "^2.9", + "mezzio/mezzio-twigrenderer": "^2.15.0", "mikey179/vfsstream": "^1.6.11", - "phpunit/phpunit": "^10.5", + "phpunit/phpunit": "^10.5.5", "psalm/plugin-phpunit": "^0.18.4", "roave/security-advisories": "dev-master", "vimeo/psalm": "^5.18" diff --git a/composer.lock b/composer.lock index 8f3b9ec..8c556a8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "18438e162fb4b2837fed6ecc1143b308", + "content-hash": "3f1579ab8630706d86fb80566367d848", "packages": [ { "name": "brick/varexporter", diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 6e41d34..48f2aca 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -108,9 +108,6 @@ $stabilityFlags - - $stabilityFlags[$packageName] - $stabilityFlags @@ -185,11 +182,11 @@ * }>]]> - expectedContainerAttributes[$containerClass]]]> - expectedContainerAttributes[$containerClass]]]> - expectedRouterAttributes[$routerClass]]]> - rendererConfigProviders[$rendererClass]]]> - routerConfigProviders[$routerClass]]]> + self::$expectedContainerAttributes[$containerClass] + self::$expectedContainerAttributes[$containerClass] + self::$expectedRouterAttributes[$routerClass] + self::$rendererConfigProviders[$rendererClass] + self::$routerConfigProviders[$routerClass] diff --git a/test/MezzioInstallerTest/AddPackageTest.php b/test/MezzioInstallerTest/AddPackageTest.php index 74d8ddd..1dc2e90 100644 --- a/test/MezzioInstallerTest/AddPackageTest.php +++ b/test/MezzioInstallerTest/AddPackageTest.php @@ -50,7 +50,7 @@ public function testAddPackage(string $packageName, string $packageVersion, ?int } } - public function packageProvider(): array + public static function packageProvider(): array { // $packageName, $packageVersion, $expectedStability return [ diff --git a/test/MezzioInstallerTest/ContainersTest.php b/test/MezzioInstallerTest/ContainersTest.php index 09397b0..fb65d80 100644 --- a/test/MezzioInstallerTest/ContainersTest.php +++ b/test/MezzioInstallerTest/ContainersTest.php @@ -112,7 +112,7 @@ public function testContainer( * 5: class-string * }> */ - public function containerProvider(): array + public static function containerProvider(): array { // phpcs:disable Generic.Files.LineLength.TooLong // $installType, $containerOption, $routerOption, $copyFilesKey, $expectedResponseStatusCode, $expectedContainer diff --git a/test/MezzioInstallerTest/ErrorHandlerTest.php b/test/MezzioInstallerTest/ErrorHandlerTest.php index e515f03..69726a9 100644 --- a/test/MezzioInstallerTest/ErrorHandlerTest.php +++ b/test/MezzioInstallerTest/ErrorHandlerTest.php @@ -99,7 +99,7 @@ public function testErrorHandler( ); } - public function errorHandlerProvider(): array + public static function errorHandlerProvider(): array { // $installType, $containerOption, $errorHandlerOption, $expectedErrorHandler return [ diff --git a/test/MezzioInstallerTest/HomePageResponseTest.php b/test/MezzioInstallerTest/HomePageResponseTest.php index 51fef6e..19924cd 100644 --- a/test/MezzioInstallerTest/HomePageResponseTest.php +++ b/test/MezzioInstallerTest/HomePageResponseTest.php @@ -41,13 +41,13 @@ class HomePageResponseTest extends OptionalPackagesTestCase private OptionalPackages $installer; /** @var array, class-string> */ - private array $routerConfigProviders = [ + private static array $routerConfigProviders = [ FastRouteRouter::class => FastRouteRouterConfigProvider::class, LaminasRouter::class => LaminasRouterConfigProvider::class, ]; /** @var array, class-string> */ - private array $rendererConfigProviders = [ + private static array $rendererConfigProviders = [ PlatesRenderer::class => PlatesRendererConfigProvider::class, TwigRenderer::class => TwigRendererConfigProvider::class, LaminasViewRenderer::class => LaminasViewRendererConfigProvider::class, @@ -55,14 +55,14 @@ class HomePageResponseTest extends OptionalPackagesTestCase // $installType, $installType /** @var array */ - private array $installTypes = [ + private static array $installTypes = [ OptionalPackages::INSTALL_FLAT => OptionalPackages::INSTALL_FLAT, OptionalPackages::INSTALL_MODULAR => OptionalPackages::INSTALL_MODULAR, ]; // $rendererOption, $rendererClass /** @var array>> */ - private array $rendererTypes = [ + private static array $rendererTypes = [ 'plates' => [1, PlatesRenderer::class], 'twig' => [2, TwigRenderer::class], 'laminas-view' => [3, LaminasViewRenderer::class], @@ -70,13 +70,13 @@ class HomePageResponseTest extends OptionalPackagesTestCase // $routerOption, $routerClass /** @var array>> */ - private array $routerTypes = [ + private static array $routerTypes = [ 'fastroute' => [1, FastRouteRouter::class], 'laminas-router' => [2, LaminasRouter::class], ]; /** @var array, array> */ - private array $expectedRouterAttributes = [ + private static array $expectedRouterAttributes = [ FastRouteRouter::class => [ 'routerName' => 'FastRoute', 'routerDocs' => 'https://github.com/nikic/FastRoute', @@ -89,7 +89,7 @@ class HomePageResponseTest extends OptionalPackagesTestCase // $containerOption, $containerClass /** @var array>> */ - private array $containerTypes = [ + private static array $containerTypes = [ 'laminas-servicemanager' => [1, LaminasServiceManagerContainer::class], 'sf-di' => [2, SfContainerBuilder::class], 'php-di' => [3, PhpDIContainer::class], @@ -97,7 +97,7 @@ class HomePageResponseTest extends OptionalPackagesTestCase ]; /** @var array, array> */ - private array $expectedContainerAttributes = [ + private static array $expectedContainerAttributes = [ LaminasServiceManagerContainer::class => [ 'containerName' => 'Laminas Servicemanager', 'containerDocs' => 'https://docs.laminas.dev/laminas-servicemanager/', @@ -190,17 +190,17 @@ public function testHomePageHtmlResponseContainsExpectedInfo( * 5: string * }> */ - public function installCasesProvider(): Generator + public static function installCasesProvider(): Generator { // Execute a test case for each container, renderer and non minimal install type - foreach ($this->containerTypes as $containerId => $containerType) { + foreach (self::$containerTypes as $containerId => $containerType) { $containerOption = $containerType[0]; $containerClass = $containerType[1]; - $containerName = $this->expectedContainerAttributes[$containerClass]['containerName']; - $containerDocs = $this->expectedContainerAttributes[$containerClass]['containerDocs']; + $containerName = self::$expectedContainerAttributes[$containerClass]['containerName']; + $containerDocs = self::$expectedContainerAttributes[$containerClass]['containerDocs']; - foreach ($this->rendererTypes as $rendererId => $rendererType) { + foreach (self::$rendererTypes as $rendererId => $rendererType) { $rendererOption = $rendererType[0]; $rendererClass = $rendererType[1]; @@ -209,7 +209,7 @@ public function installCasesProvider(): Generator continue; } - foreach ($this->installTypes as $installType) { + foreach (self::$installTypes as $installType) { $name = implode('--', [$containerId, $rendererId, $installType]); $args = [ $installType, @@ -289,23 +289,23 @@ public function testHomePageJsonResponseContainsExpectedInfo( * 7: string * }> */ - public function rendererlessInstallCasesProvider(): Generator + public static function rendererlessInstallCasesProvider(): Generator { // Execute a test case for each install type and container, without any renderer - foreach ($this->containerTypes as $containerId => $containerType) { + foreach (self::$containerTypes as $containerId => $containerType) { $containerOption = $containerType[0]; $containerClass = $containerType[1]; - $containerName = $this->expectedContainerAttributes[$containerClass]['containerName']; - $containerDocs = $this->expectedContainerAttributes[$containerClass]['containerDocs']; + $containerName = self::$expectedContainerAttributes[$containerClass]['containerName']; + $containerDocs = self::$expectedContainerAttributes[$containerClass]['containerDocs']; - foreach ($this->routerTypes as $routerId => $routerType) { + foreach (self::$routerTypes as $routerId => $routerType) { $routerOption = $routerType[0]; $routerClass = $routerType[1]; - $routerName = $this->expectedRouterAttributes[$routerClass]['routerName']; - $routerDocs = $this->expectedRouterAttributes[$routerClass]['routerDocs']; + $routerName = self::$expectedRouterAttributes[$routerClass]['routerName']; + $routerDocs = self::$expectedRouterAttributes[$routerClass]['routerDocs']; - foreach ($this->installTypes as $installType) { + foreach (self::$installTypes as $installType) { $name = implode('--', [$containerId, $routerId, $installType]); $args = [ $installType, @@ -330,7 +330,7 @@ public function injectRouterConfigProvider(string $routerClass): void $contents = file_get_contents($configFile); $contents = preg_replace( '#(new ConfigAggregator\(\[)#s', - '$1' . "\n " . $this->routerConfigProviders[$routerClass] . "::class,\n", + '$1' . "\n " . self::$routerConfigProviders[$routerClass] . "::class,\n", $contents ); file_put_contents($configFile, $contents); @@ -342,7 +342,7 @@ public function injectRendererConfigProvider(string $rendererClass): void $contents = file_get_contents($configFile); $contents = preg_replace( '#(new ConfigAggregator\(\[)#s', - '$1' . "\n " . $this->rendererConfigProviders[$rendererClass] . "::class,\n", + '$1' . "\n " . self::$rendererConfigProviders[$rendererClass] . "::class,\n", $contents ); file_put_contents($configFile, $contents); diff --git a/test/MezzioInstallerTest/OptionalPackagesTestCase.php b/test/MezzioInstallerTest/OptionalPackagesTestCase.php index 4fb6fbe..f6c3fe8 100644 --- a/test/MezzioInstallerTest/OptionalPackagesTestCase.php +++ b/test/MezzioInstallerTest/OptionalPackagesTestCase.php @@ -176,23 +176,17 @@ protected function createOptionalPackages(?string $projectRoot = null): Optional ); } - /** - * @return Composer&MockObject - */ - protected function createComposer() + protected function createComposer(): Composer&MockObject { $this->composer = $this->createMock(Composer::class); - $this->composer->method('getPackage')->will( - $this->returnCallback(fn (): MockObject => $this->createRootPackage()) + $this->composer->method('getPackage')->willReturn( + $this->createRootPackage(), ); return $this->composer; } - /** - * @return RootPackage&MockObject - */ - protected function createRootPackage() + protected function createRootPackage(): RootPackage&MockObject { $composerJson = json_decode( file_get_contents($this->packageRoot . '/composer.json'), diff --git a/test/MezzioInstallerTest/PromptForOptionalPackagesTest.php b/test/MezzioInstallerTest/PromptForOptionalPackagesTest.php index 3501884..5785e90 100644 --- a/test/MezzioInstallerTest/PromptForOptionalPackagesTest.php +++ b/test/MezzioInstallerTest/PromptForOptionalPackagesTest.php @@ -53,7 +53,7 @@ protected function tearDown(): void * 3: OptionalPackageSpec * }> */ - public function promptCombinations(): Generator + public static function promptCombinations(): Generator { $config = require __DIR__ . '/../../src/MezzioInstaller/config.php'; /** @psalm-var array $questions */ diff --git a/test/MezzioInstallerTest/RequestInstallTypeTest.php b/test/MezzioInstallerTest/RequestInstallTypeTest.php index 8ec1639..6a63202 100644 --- a/test/MezzioInstallerTest/RequestInstallTypeTest.php +++ b/test/MezzioInstallerTest/RequestInstallTypeTest.php @@ -20,7 +20,7 @@ protected function setUp(): void $this->installer = $this->createOptionalPackages(); } - public function installSelections(): array + public static function installSelections(): array { return [ OptionalPackages::INSTALL_MINIMAL => ['1', OptionalPackages::INSTALL_MINIMAL], @@ -35,9 +35,9 @@ public function installSelections(): array public function testRequestInstallTypeReturnsExpectedConstantValue(string $selection, string $expected): void { $this->io - ->expects($this->once()) + ->expects(self::once()) ->method('ask') - ->with($this->callback(fn ($value): bool => $this->assertQueryPrompt($value)), '2') + ->with(self::callback(fn ($value): bool => self::assertQueryPrompt($value)), '2') ->willReturn($selection); self::assertSame($expected, $this->installer->requestInstallType()); diff --git a/test/MezzioInstallerTest/RoutersTest.php b/test/MezzioInstallerTest/RoutersTest.php index 54adc5f..7a66b2e 100644 --- a/test/MezzioInstallerTest/RoutersTest.php +++ b/test/MezzioInstallerTest/RoutersTest.php @@ -27,7 +27,7 @@ class RoutersTest extends OptionalPackagesTestCase use ProjectSandboxTrait; /** @var array>> */ - private array $expectedRoutes = [ + private static array $expectedRoutes = [ [ 'name' => 'home', 'path' => '/', @@ -131,17 +131,17 @@ public function testRouter( } } - public function routerProvider(): array + public static function routerProvider(): array { // @codingStandardsIgnoreStart // $installType, $containerOption, $routerOption, $copyFilesKey, $dependencyKey, $expectedResponseStatusCode, $expectedRoutes, $expectedRouter return [ 'fastroute-minimal' => [OptionalPackages::INSTALL_MINIMAL, 2, 1, 'minimal-files', 'aliases', 404, [], FastRouteRouter::class], - 'fastroute-flat' => [OptionalPackages::INSTALL_FLAT, 2, 1, 'copy-files', 'aliases', 200, $this->expectedRoutes, FastRouteRouter::class], - 'fastroute-modular' => [OptionalPackages::INSTALL_MODULAR, 2, 1, 'copy-files', 'aliases', 200, $this->expectedRoutes, FastRouteRouter::class], + 'fastroute-flat' => [OptionalPackages::INSTALL_FLAT, 2, 1, 'copy-files', 'aliases', 200, self::$expectedRoutes, FastRouteRouter::class], + 'fastroute-modular' => [OptionalPackages::INSTALL_MODULAR, 2, 1, 'copy-files', 'aliases', 200, self::$expectedRoutes, FastRouteRouter::class], 'laminas-router-minimal' => [OptionalPackages::INSTALL_MINIMAL, 2, 2, 'minimal-files', 'aliases', 404, [], LaminasRouter::class], - 'laminas-router-flat' => [OptionalPackages::INSTALL_FLAT, 2, 2, 'copy-files', 'aliases', 200, $this->expectedRoutes, LaminasRouter::class], - 'laminas-router-modular' => [OptionalPackages::INSTALL_MODULAR, 2, 2, 'copy-files', 'aliases', 200, $this->expectedRoutes, LaminasRouter::class], + 'laminas-router-flat' => [OptionalPackages::INSTALL_FLAT, 2, 2, 'copy-files', 'aliases', 200, self::$expectedRoutes, LaminasRouter::class], + 'laminas-router-modular' => [OptionalPackages::INSTALL_MODULAR, 2, 2, 'copy-files', 'aliases', 200, self::$expectedRoutes, LaminasRouter::class], ]; // @codingStandardsIgnoreEnd }