diff --git a/Makefile b/Makefile index 3b0cbf6..ee92da0 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ cov-report: var/coverage/index.html ## Open the PHPUnit code coverage report (va ## —— Coding standards/lints ✨ ———————————————————————————————————————————————— stan: var/cache/dev/App_KernelDevDebugContainer.xml ## Run PHPStan - @vendor/bin/phpstan analyse -c phpstan.neon --memory-limit 1G -vvv + @vendor/bin/phpstan analyse -c phpstan.neon --memory-limit 1G -vv # PHPStan needs the dev/debug cache var/cache/dev/App_KernelDevDebugContainer.xml: diff --git a/README.md b/README.md index 7922c97..f7d01ef 100644 --- a/README.md +++ b/README.md @@ -166,8 +166,9 @@ These branches will be rebased after each release so they are always up to date. ## References 📚 * [A better ADR pattern for your Symfony controllers](https://www.strangebuzz.com/en/blog/a-better-adr-pattern-for-your-symfony-controllers) (strangebuzz.com) (coming soon) +* [You should be using PHPStans bleeding edge](https://backendtea.com/post/use-phpstan-bleeding-edge/) (backendtea.com) * [A Good Naming Convention for Routes, Controllers and Templates?](https://jolicode.com/blog/a-good-naming-convention-for-routes-controllers-and-templates) (jolicode.com) -* [Front-end application development, Symfony-style(s)](https://dunglas.dev/2024/04/front-end-application-development-symfony-styles/) (dunglas.dev) +* [Front-end application development, Symfony-style(s)](https://dunglas.dev/2024/04/front-end-application-development-symfony-styles/) (dunglas.dev) * [Automated Test Coverage Checks with Travis, PHPUnit for Github Pull Requests](https://ocramius.github.io/blog/automated-code-coverage-check-for-github-pull-requests-with-travis/) (ocramius.github.io) * [Installing and using php-cs-fixer](https://www.strangebuzz.com/en/blog/installing-and-using-php-cs-fixer) (strangebuzz.com) * [Castor, a journey across the sea of task runners](https://jolicode.com/blog/castor-a-journey-across-the-sea-of-task-runners) (jolicode.com) diff --git a/bin/coverage-checker.php b/bin/coverage-checker.php index 1dff93f..8e8635d 100644 --- a/bin/coverage-checker.php +++ b/bin/coverage-checker.php @@ -5,16 +5,16 @@ declare(strict_types=1); $inputFile = $argv[1]; + +if (!is_numeric($argv[2])) { + throw new InvalidArgumentException('An integer checked percentage must be given as second parameter'); +} $percentage = min(100, max(0, (int) $argv[2])); if (!file_exists($inputFile)) { throw new InvalidArgumentException('Invalid input file provided'); } -if (!is_int($percentage)) { - throw new InvalidArgumentException('An integer checked percentage must be given as second parameter'); -} - try { @$xml = new SimpleXMLElement((string) file_get_contents($inputFile)); } catch (Exception) { diff --git a/castor.php b/castor.php index afd16dc..35250a1 100644 --- a/castor.php +++ b/castor.php @@ -139,7 +139,7 @@ function stan(): int ); } - return exit_code('vendor/bin/phpstan analyse -c phpstan.neon --memory-limit 1G -vvv', quiet: false); + return exit_code('vendor/bin/phpstan analyse -c phpstan.neon --memory-limit 1G -vv', quiet: false); } #[AsTask(namespace: 'cs', description: 'Fix PHP files with php-cs-fixer (ignore PHP 8.2 warning)', aliases: ['fix-php'])] diff --git a/phpstan.neon b/phpstan.neon index d7b9d0d..cec322e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,3 +1,9 @@ +# https://phpstan.org/config-reference#bleeding-edge +# https://phpstan.org/blog/what-is-bleeding-edge +# comment the two following lines if you don't want to use the bleedingEdge mode. +includes: + - phar://phpstan.phar/conf/bleedingEdge.neon + # https://phpstan.org/config-reference parameters: # https://phpstan.org/config-reference#rule-level @@ -14,4 +20,4 @@ parameters: container_xml_path: var/cache/dev/App_KernelDevDebugContainer.xml # https://phpstan.org/user-guide/ignoring-errors ignoreErrors: - #- '#my_ignore_error_regexp_pattern#' \ No newline at end of file + #- '#my_ignore_error_regexp_pattern#' diff --git a/src/Form/Type/RegisterForm.php b/src/Form/Type/RegisterForm.php index d7e719b..a19bb2c 100644 --- a/src/Form/Type/RegisterForm.php +++ b/src/Form/Type/RegisterForm.php @@ -4,6 +4,7 @@ namespace App\Form\Type; +use App\Dto\RegisterFormDto; use App\Enum\Fruit; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CountryType; @@ -18,6 +19,8 @@ /** * @see RegisterFormDto + * + * @extends AbstractType */ final class RegisterForm extends AbstractType {