diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 53fc7fa..4d40d74 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -88,7 +88,7 @@ jobs: - name: Run ECS - run: vendor/bin/ecs check src + run: vendor/bin/ecs check if: always() && steps.end-of-setup.outcome == 'success' - diff --git a/composer.json b/composer.json index 5c60d55..f4716b3 100644 --- a/composer.json +++ b/composer.json @@ -27,10 +27,11 @@ "friends-of-behat/variadic-extension": "^1.3", "nyholm/psr7": "^1.4", "phpspec/phpspec": "^7.0", - "phpstan/extension-installer": "^1.2", - "phpstan/phpstan-doctrine": "^1", - "phpstan/phpstan-strict-rules": "^1", - "phpstan/phpstan-webmozart-assert": "^1", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^1.12", + "phpstan/phpstan-doctrine": "^1.5", + "phpstan/phpstan-symfony": "^1.4", + "phpstan/phpstan-webmozart-assert": "^1.2", "phpunit/phpunit": "^10", "polishsymfonycommunity/symfony-mocker-container": "^1.0", "robertfausk/behat-panther-extension": "^1.1", diff --git a/src/Resources/config/services.yaml b/config/services.yaml similarity index 100% rename from src/Resources/config/services.yaml rename to config/services.yaml diff --git a/ecs.php b/ecs.php index 30e27f2..2c5fd98 100644 --- a/ecs.php +++ b/ecs.php @@ -2,13 +2,14 @@ declare(strict_types=1); -use PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer; use Symplify\EasyCodingStandard\Config\ECSConfig; -return static function (ECSConfig $config): void { - $config->import('vendor/sylius-labs/coding-standard/ecs.php'); - $config->paths([ +return ECSConfig::configure() + ->withSets([ + 'vendor/sylius-labs/coding-standard/ecs.php', + ]) + ->withPaths([ 'src', 'tests', - ]); -}; + ]) +; diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..98373df --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,6 @@ +includes: + - 'phpstan.neon.dist' + +parameters: + editorUrl: '%%file%%:%%line%%' + diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 98d1ccd..15d01e0 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,22 +1,7 @@ parameters: - reportUnmatchedIgnoredErrors: false - checkMissingIterableValueType: false level: max paths: - src - - tests - - excludePaths: - # Makes PHPStan crash - - 'src/DependencyInjection/Configuration.php' - - - tests/Application/Kernel.php - - tests/Application/public/index.php - - tests/Application/config/**.php - - tests/Application/var/**.php - - tests/Application/node_modules/**.php - - ignoreErrors: - - '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./' + - tests/Behat diff --git a/src/DependencyInjection/CompilerPass/SymfonyHttpClientCompilerPass.php b/src/DependencyInjection/CompilerPass/SymfonyHttpClientCompilerPass.php index 9b85e44..d85aafe 100644 --- a/src/DependencyInjection/CompilerPass/SymfonyHttpClientCompilerPass.php +++ b/src/DependencyInjection/CompilerPass/SymfonyHttpClientCompilerPass.php @@ -20,21 +20,21 @@ public function process(ContainerBuilder $container): void if (false === $container->has(ClientInterface::class)) { $container->setDefinition( ClientInterface::class, - new Definition(Psr18Client::class) + new Definition(Psr18Client::class), ); } if (false === $container->has(RequestFactoryInterface::class)) { $container->setDefinition( RequestFactoryInterface::class, - new Definition(Psr17Factory::class) + new Definition(Psr17Factory::class), ); } if (false === $container->has(StreamFactoryInterface::class)) { $container->setDefinition( StreamFactoryInterface::class, - new Definition(Psr17Factory::class) + new Definition(Psr17Factory::class), ); } } diff --git a/src/DependencyInjection/FluxSESyliusHCaptchaExtension.php b/src/DependencyInjection/FluxSESyliusHCaptchaExtension.php index 37b8ffa..d5cb9f2 100644 --- a/src/DependencyInjection/FluxSESyliusHCaptchaExtension.php +++ b/src/DependencyInjection/FluxSESyliusHCaptchaExtension.php @@ -7,10 +7,9 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; -use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -final class FluxSESyliusHCaptchaExtension extends Extension implements PrependExtensionInterface +final class FluxSESyliusHCaptchaExtension extends Extension { public function load(array $configs, ContainerBuilder $container): void { @@ -27,7 +26,7 @@ public function prepend(ContainerBuilder $container): void 'form_themes' => [ '@FluxSESyliusHCaptchaPlugin/hcaptcha.html.twig', ], - ] + ], ); } @@ -53,7 +52,7 @@ public function prepend(ContainerBuilder $container): void ], ], ], - ] + ], ); } } diff --git a/src/FluxSESyliusHCaptchaPlugin.php b/src/FluxSESyliusHCaptchaPlugin.php index e55a3ef..ac851c1 100644 --- a/src/FluxSESyliusHCaptchaPlugin.php +++ b/src/FluxSESyliusHCaptchaPlugin.php @@ -21,4 +21,9 @@ public function build(ContainerBuilder $container): void ->addCompilerPass(new SymfonyHttpClientCompilerPass()) ; } + + public function getPath(): string + { + return dirname(__DIR__); + } } diff --git a/src/Resources/views/form.html.twig b/templates/form.html.twig similarity index 100% rename from src/Resources/views/form.html.twig rename to templates/form.html.twig diff --git a/src/Resources/views/hcaptcha.html.twig b/templates/hcaptcha.html.twig similarity index 100% rename from src/Resources/views/hcaptcha.html.twig rename to templates/hcaptcha.html.twig diff --git a/tests/Application/config/bootstrap.php b/tests/Application/config/bootstrap.php index 677571e..b203ae2 100644 --- a/tests/Application/config/bootstrap.php +++ b/tests/Application/config/bootstrap.php @@ -24,4 +24,4 @@ $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; $_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; -$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; +$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], \FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; diff --git a/tests/Application/config/sylius/1.12/bundles.php b/tests/Application/config/sylius/1.12/bundles.php index 4a8358c..76ba99c 100644 --- a/tests/Application/config/sylius/1.12/bundles.php +++ b/tests/Application/config/sylius/1.12/bundles.php @@ -1,5 +1,7 @@ ['all' => true], SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], diff --git a/tests/Behat/Context/Ui/Shop/CaptchaContext.php b/tests/Behat/Context/Ui/Shop/CaptchaContext.php index ac70c50..e979cc6 100644 --- a/tests/Behat/Context/Ui/Shop/CaptchaContext.php +++ b/tests/Behat/Context/Ui/Shop/CaptchaContext.php @@ -13,9 +13,6 @@ final class CaptchaContext implements Context /** @var PageInterface */ private $page; - /** - * @param PageInterface $page - */ public function __construct(PageInterface $page) { $this->page = $page; diff --git a/src/Resources/translations/messages.en.yaml b/translations/messages.en.yaml similarity index 100% rename from src/Resources/translations/messages.en.yaml rename to translations/messages.en.yaml diff --git a/src/Resources/translations/messages.fr.yaml b/translations/messages.fr.yaml similarity index 100% rename from src/Resources/translations/messages.fr.yaml rename to translations/messages.fr.yaml diff --git a/src/Resources/translations/validators.en.yaml b/translations/validators.en.yaml similarity index 100% rename from src/Resources/translations/validators.en.yaml rename to translations/validators.en.yaml diff --git a/src/Resources/translations/validators.fr.yaml b/translations/validators.fr.yaml similarity index 100% rename from src/Resources/translations/validators.fr.yaml rename to translations/validators.fr.yaml