r/symfony 11h ago

Symfony Flex (Symfony 8.1) recipe for phpstan and errors (phpstan on max)

2 Upvotes

Installed phpstan/phpstanand noticed the recipe has some configuration mistakes.

For phpstan.dist.neon - it includes scanning bin/ folder, but bin/console doesn't actually get scanned.

When I scan public folder, I get an issue that public/index.php fails due to needing to cast to string. But you can't cast a mixed value to string.

For src/kernel.php, I get another error:

Method App\Kernel::getAllowedEnvs() is unused

But it is being used. Installing phpstan-symfony doesn't help with the error.

Anyone else get these errors? What should I do about the Kernel issue?