Skip to content

Commit

Permalink
chore: PHPStan 2 update (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
COil authored Nov 11, 2024
1 parent 52b3efa commit c5c0f12
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 62 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ to fix some issues as the project is not maintained anymore.
* Two task runners
* [Make](https://www.gnu.org/software/make/) ([source](https://github.com/strangebuzz/MicroSymfony/blob/main/Makefile)) ([demo](https://www.strangebuzz.com/en/blog/introducing-the-microsymfony-application-template#h3_4_1))
* [Castor](https://github.com/jolicode/castor) ([source](https://github.com/strangebuzz/MicroSymfony/blob/main/castor.php)) ([demo](https://www.strangebuzz.com/en/blog/introducing-the-microsymfony-application-template#h3_4_2))
* Static analysis with [PHPStan](https://github.com/phpstan/phpstan)
* Static analysis with [PHPStan 2](https://github.com/phpstan/phpstan)
* [Configuration](https://github.com/strangebuzz/MicroSymfony/blob/main/phpstan.neon)
* Coding standards with [php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer)
* [Configuration](https://github.com/strangebuzz/MicroSymfony/blob/main/.php-cs-fixer.dist.php)
Expand All @@ -167,8 +167,8 @@ to fix some issues as the project is not maintained anymore.
## Feature branches 🚅

[Feature branches](https://github.com/strangebuzz/MicroSymfony/pulls?q=is%3Apr+is%3Aopen+label%3A%22feature+branch%22)
are not merged in the main branch but are used to integrate a new vendor library
or make a [POC](https://en.wikipedia.org/wiki/Proof_of_concept).
are not merged in the main branch but are used to test the integration of a new
vendor library or make a [POC](https://en.wikipedia.org/wiki/Proof_of_concept).
For example, have you ever dreamed of testing [Eloquent](https://laravel.com/docs/11.x/eloquent#introduction),
the Laravel ORM, on a Symfony project?
Then clone the `eloquent` branch and run `composer install && make load-fixtures`.
Expand Down Expand Up @@ -214,6 +214,7 @@ In both cases, your controller code has to be [modified accordingly](https://sym

## References 📚

* [PHPStan 2.0 Released With Level 10 and Elephpants!](https://phpstan.org/blog/phpstan-2-0-released-level-10-elephpants) (phpstan.org)
* [A better ADR pattern for your Symfony controllers](https://www.strangebuzz.com/en/blog/a-better-adr-pattern-for-your-symfony-controllers) (strangebuzz.com)
* [My Taskfile configuration for Symfony](https://jmsche.fr/en/blog/my-taskfile-configuration-for-symfony) (jmsche.fr)
* [You should be using PHPStans bleeding edge](https://backendtea.com/post/use-phpstan-bleeding-edge/) (backendtea.com)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan-symfony": "^1.3",
"phpstan/phpstan-symfony": "^2.0",
"phpunit/phpunit": "^11.0",
"roave/security-advisories": "dev-latest",
"symfony/browser-kit": "~7.1.0",
Expand Down
107 changes: 53 additions & 54 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# https://phpstan.org/blog/phpstan-2-0-released-level-10-elephpants
# 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.
Expand All @@ -18,7 +19,7 @@ parameters:
- tests
# https://github.com/phpstan/phpstan-symfony#configuration
symfony:
container_xml_path: var/cache/dev/App_KernelDevDebugContainer.xml
containerXmlPath: var/cache/dev/App_KernelDevDebugContainer.xml
# https://phpstan.org/user-guide/ignoring-errors
ignoreErrors:
#- '#my_ignore_error_regexp_pattern#'
5 changes: 4 additions & 1 deletion public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return static fn (array $context) => new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
return static function (array $context) {
/** @var array{APP_ENV: string, APP_DEBUG: string, APP_SECRET: string} $context */
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};
Loading

0 comments on commit c5c0f12

Please sign in to comment.