From b83757485f00113a6b806ab80f9a4890ac90db69 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Tue, 10 Jan 2023 14:30:54 +0900 Subject: [PATCH 1/5] Require psalm --- composer.json | 6 ++++-- psalm.xml | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 psalm.xml diff --git a/composer.json b/composer.json index 8afb2b5..f5f2cf8 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,8 @@ "phpmd/phpmd": "^2.6", "rector/rector": "^0.15.3", "ray/rector-ray": "^1.0", - "doctrine/coding-standard": "^11.1" + "doctrine/coding-standard": "^11.1", + "vimeo/psalm": "^5.4" }, "autoload":{ "psr-4":{ @@ -50,7 +51,8 @@ "tests": ["@cs", "phpstan analyse -l max src tests -c phpstan.neon --no-progress", "@test"], "coverage": ["php -dzend_extension=xdebug.so -dxdebug.mode=coverage ./vendor/bin/phpunit --coverage-text --coverage-html=build/coverage"], "cs": ["php-cs-fixer fix -v --dry-run", "phpcs --standard=phpcs.xml src;"], - "cs-fix": ["phpcbf src tests"] + "cs-fix": ["phpcbf src tests"], + "sa": "psalm" }, "config": { "allow-plugins": { diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 0000000..b8a42df --- /dev/null +++ b/psalm.xml @@ -0,0 +1,14 @@ + + + + + + + + + From d1b8d5cd4a581a5399095756ab82844e28af9758 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Tue, 10 Jan 2023 14:31:04 +0900 Subject: [PATCH 2/5] Soothe psalm --- src/AppPathProvider.php | 1 + src/OptionProvider.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/AppPathProvider.php b/src/AppPathProvider.php index 1266a06..a667b5c 100644 --- a/src/AppPathProvider.php +++ b/src/AppPathProvider.php @@ -11,6 +11,7 @@ use BEAR\AppMeta\AbstractAppMeta; use Ray\Di\ProviderInterface; +/** @implements ProviderInterface */ class AppPathProvider implements ProviderInterface { public function __construct( diff --git a/src/OptionProvider.php b/src/OptionProvider.php index 2c3192d..5628172 100644 --- a/src/OptionProvider.php +++ b/src/OptionProvider.php @@ -16,6 +16,7 @@ use function file_exists; use function mkdir; +/** @implements ProviderInterface */ class OptionProvider implements ProviderInterface { /** @SuppressWarnings(PHPMD.BooleanArgumentFlag) */ From de81bbfbb187614ff7bdcf33dee624e989b0d822 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Tue, 10 Jan 2023 14:31:19 +0900 Subject: [PATCH 3/5] fixup! Remove AnnotationRegistry::registerLoader --- tests/bootstrap.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 200a0e2..510af61 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -7,7 +7,6 @@ */ use Composer\Autoload\ClassLoader; -use Doctrine\Common\Annotations\AnnotationRegistry; use Koriym\Attributes\AttributeReader; use Ray\ServiceLocator\ServiceLocator; From c40b417fcfbb0215b668d799035d9592063ddd61 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Tue, 10 Jan 2023 14:33:24 +0900 Subject: [PATCH 4/5] fixup! Soothe psalm --- src/AppPathProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AppPathProvider.php b/src/AppPathProvider.php index a667b5c..7bf2b47 100644 --- a/src/AppPathProvider.php +++ b/src/AppPathProvider.php @@ -11,7 +11,7 @@ use BEAR\AppMeta\AbstractAppMeta; use Ray\Di\ProviderInterface; -/** @implements ProviderInterface */ +/** @implements ProviderInterface> */ class AppPathProvider implements ProviderInterface { public function __construct( From d9368207e95df7f399d9a91f8f7dd85da3ac976e Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Tue, 10 Jan 2023 14:35:48 +0900 Subject: [PATCH 5/5] Remove file header --- src/Annotation/TwigDebug.php | 4 ---- src/Annotation/TwigErrorPath.php | 4 ---- src/Annotation/TwigLoader.php | 4 ---- src/Annotation/TwigOptions.php | 4 ---- src/Annotation/TwigPaths.php | 4 ---- src/Annotation/TwigRedirectPath.php | 4 ---- src/AppPathProvider.php | 4 ---- src/ErrorPagerRenderer.php | 4 ---- src/Exception/RuntimeException.php | 4 ---- src/Exception/TemplateNotFound.php | 4 ---- src/MobileTemplateFinder.php | 4 ---- src/MobileTwigModule.php | 4 ---- src/OptionProvider.php | 4 ---- src/TemplateFinder.php | 4 ---- src/TemplateFinderInterface.php | 4 ---- src/TwigErrorHandler.php | 4 ---- src/TwigErrorPage.php | 4 ---- src/TwigErrorPageHandler.php | 4 ---- src/TwigErrorPageModule.php | 4 ---- src/TwigModule.php | 4 ---- src/TwigRenderer.php | 4 ---- tests/AppMetaTest.php | 4 ---- tests/AppPathProviderTest.php | 4 ---- tests/AppPathProviderTestModule.php | 4 ---- tests/ArrayLoaderTest.php | 4 ---- tests/ExtensionTest.php | 4 ---- tests/FileLoaderTest.php | 4 ---- tests/MobileTemplateFinderTest.php | 4 ---- tests/OptionProviderTest.php | 4 ---- tests/TwigErrorPageHandlerTest.php | 4 ---- tests/WeavedResourceTest.php | 4 ---- tests/bootstrap.php | 4 ---- 32 files changed, 128 deletions(-) diff --git a/src/Annotation/TwigDebug.php b/src/Annotation/TwigDebug.php index 933609b..652572e 100644 --- a/src/Annotation/TwigDebug.php +++ b/src/Annotation/TwigDebug.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule\Annotation; use Attribute; diff --git a/src/Annotation/TwigErrorPath.php b/src/Annotation/TwigErrorPath.php index b06654f..c235588 100644 --- a/src/Annotation/TwigErrorPath.php +++ b/src/Annotation/TwigErrorPath.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule\Annotation; use Attribute; diff --git a/src/Annotation/TwigLoader.php b/src/Annotation/TwigLoader.php index a2870bc..017640e 100644 --- a/src/Annotation/TwigLoader.php +++ b/src/Annotation/TwigLoader.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule\Annotation; use Attribute; diff --git a/src/Annotation/TwigOptions.php b/src/Annotation/TwigOptions.php index 08712e6..96e2157 100644 --- a/src/Annotation/TwigOptions.php +++ b/src/Annotation/TwigOptions.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule\Annotation; use Attribute; diff --git a/src/Annotation/TwigPaths.php b/src/Annotation/TwigPaths.php index 302145e..e894257 100644 --- a/src/Annotation/TwigPaths.php +++ b/src/Annotation/TwigPaths.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule\Annotation; use Attribute; diff --git a/src/Annotation/TwigRedirectPath.php b/src/Annotation/TwigRedirectPath.php index 7cfea4c..0d746c5 100644 --- a/src/Annotation/TwigRedirectPath.php +++ b/src/Annotation/TwigRedirectPath.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule\Annotation; use Attribute; diff --git a/src/AppPathProvider.php b/src/AppPathProvider.php index 7bf2b47..91e2bd1 100644 --- a/src/AppPathProvider.php +++ b/src/AppPathProvider.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use BEAR\AppMeta\AbstractAppMeta; diff --git a/src/ErrorPagerRenderer.php b/src/ErrorPagerRenderer.php index 0873a8c..facb77d 100644 --- a/src/ErrorPagerRenderer.php +++ b/src/ErrorPagerRenderer.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use BEAR\Resource\RenderInterface; diff --git a/src/Exception/RuntimeException.php b/src/Exception/RuntimeException.php index 7c7a04d..4e04d5e 100644 --- a/src/Exception/RuntimeException.php +++ b/src/Exception/RuntimeException.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule\Exception; class RuntimeException extends \RuntimeException diff --git a/src/Exception/TemplateNotFound.php b/src/Exception/TemplateNotFound.php index fee72ee..1858252 100644 --- a/src/Exception/TemplateNotFound.php +++ b/src/Exception/TemplateNotFound.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule\Exception; class TemplateNotFound extends RuntimeException diff --git a/src/MobileTemplateFinder.php b/src/MobileTemplateFinder.php index 4a37cb7..14acc92 100644 --- a/src/MobileTemplateFinder.php +++ b/src/MobileTemplateFinder.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use Madapaja\TwigModule\Annotation\TwigPaths; diff --git a/src/MobileTwigModule.php b/src/MobileTwigModule.php index 0764fe0..95491f1 100644 --- a/src/MobileTwigModule.php +++ b/src/MobileTwigModule.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use Ray\Di\AbstractModule; diff --git a/src/OptionProvider.php b/src/OptionProvider.php index 5628172..e55da26 100644 --- a/src/OptionProvider.php +++ b/src/OptionProvider.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use BEAR\AppMeta\AbstractAppMeta; diff --git a/src/TemplateFinder.php b/src/TemplateFinder.php index 02dab86..3763899 100644 --- a/src/TemplateFinder.php +++ b/src/TemplateFinder.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use function str_replace; diff --git a/src/TemplateFinderInterface.php b/src/TemplateFinderInterface.php index 457d449..a1ef712 100644 --- a/src/TemplateFinderInterface.php +++ b/src/TemplateFinderInterface.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; interface TemplateFinderInterface diff --git a/src/TwigErrorHandler.php b/src/TwigErrorHandler.php index fd618f6..4d09c3f 100644 --- a/src/TwigErrorHandler.php +++ b/src/TwigErrorHandler.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use BEAR\Resource\Code; diff --git a/src/TwigErrorPage.php b/src/TwigErrorPage.php index b6216ea..4637762 100644 --- a/src/TwigErrorPage.php +++ b/src/TwigErrorPage.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use BEAR\Resource\RenderInterface; diff --git a/src/TwigErrorPageHandler.php b/src/TwigErrorPageHandler.php index 8c847a5..f3cf3f6 100644 --- a/src/TwigErrorPageHandler.php +++ b/src/TwigErrorPageHandler.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use BEAR\Resource\Code; diff --git a/src/TwigErrorPageModule.php b/src/TwigErrorPageModule.php index 456217e..36919a7 100644 --- a/src/TwigErrorPageModule.php +++ b/src/TwigErrorPageModule.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use BEAR\Resource\RenderInterface; diff --git a/src/TwigModule.php b/src/TwigModule.php index 4587250..c4e5721 100644 --- a/src/TwigModule.php +++ b/src/TwigModule.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use BEAR\Resource\RenderInterface; diff --git a/src/TwigRenderer.php b/src/TwigRenderer.php index b3ac1cd..2317180 100644 --- a/src/TwigRenderer.php +++ b/src/TwigRenderer.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use BEAR\Resource\Code; diff --git a/tests/AppMetaTest.php b/tests/AppMetaTest.php index b686f66..a57fa5d 100644 --- a/tests/AppMetaTest.php +++ b/tests/AppMetaTest.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use BEAR\Resource\RenderInterface; diff --git a/tests/AppPathProviderTest.php b/tests/AppPathProviderTest.php index 6f49bb7..a52f79d 100644 --- a/tests/AppPathProviderTest.php +++ b/tests/AppPathProviderTest.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use PHPUnit\Framework\TestCase; diff --git a/tests/AppPathProviderTestModule.php b/tests/AppPathProviderTestModule.php index 79e8cf6..873312d 100644 --- a/tests/AppPathProviderTestModule.php +++ b/tests/AppPathProviderTestModule.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use BEAR\AppMeta\AbstractAppMeta; diff --git a/tests/ArrayLoaderTest.php b/tests/ArrayLoaderTest.php index f9a85d6..5a59a90 100644 --- a/tests/ArrayLoaderTest.php +++ b/tests/ArrayLoaderTest.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use Madapaja\TwigModule\Exception\TemplateNotFound; diff --git a/tests/ExtensionTest.php b/tests/ExtensionTest.php index c7188c0..5aa2a40 100644 --- a/tests/ExtensionTest.php +++ b/tests/ExtensionTest.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use Madapaja\TwigModule\Resource\Page\TwigFilter; diff --git a/tests/FileLoaderTest.php b/tests/FileLoaderTest.php index 981d7e5..1cbc1ec 100644 --- a/tests/FileLoaderTest.php +++ b/tests/FileLoaderTest.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use BEAR\Resource\Code; diff --git a/tests/MobileTemplateFinderTest.php b/tests/MobileTemplateFinderTest.php index ff4a641..cb464a0 100644 --- a/tests/MobileTemplateFinderTest.php +++ b/tests/MobileTemplateFinderTest.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use PHPUnit\Framework\TestCase; diff --git a/tests/OptionProviderTest.php b/tests/OptionProviderTest.php index b15f21f..9abc26e 100644 --- a/tests/OptionProviderTest.php +++ b/tests/OptionProviderTest.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use PHPUnit\Framework\TestCase; diff --git a/tests/TwigErrorPageHandlerTest.php b/tests/TwigErrorPageHandlerTest.php index 1f431b7..ff669b2 100644 --- a/tests/TwigErrorPageHandlerTest.php +++ b/tests/TwigErrorPageHandlerTest.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use BEAR\Resource\Exception\ResourceNotFoundException as NotFound; diff --git a/tests/WeavedResourceTest.php b/tests/WeavedResourceTest.php index 9ec1194..bf7298e 100644 --- a/tests/WeavedResourceTest.php +++ b/tests/WeavedResourceTest.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - namespace Madapaja\TwigModule; use Madapaja\TwigModule\Resource\Page\Index; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 510af61..3002bb2 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -2,10 +2,6 @@ declare(strict_types=1); -/** - * This file is part of the Madapaja.TwigModule package. - */ - use Composer\Autoload\ClassLoader; use Koriym\Attributes\AttributeReader; use Ray\ServiceLocator\ServiceLocator;