I have a project built on Symfony 3.4 with Flex and I've added phpstan to it for static analysis.
It is complaining about not finding my migration classes:
Class DoctrineMigrations\Version20180831185050 was not found while trying to analyse it - autoloading is probably not configured properly.
Indeed, the files generated by Doctrine Migrations don't fit with the autoloader pattern, but works just fine otherwise.
Is there anything I can do to stop complaining about this?
Although the Symfony Framework doesn't integrate any component to work with databases, it provides tight integration with a third-party library called Doctrine . Doctrine's sole goal is to give you powerful tools to make database interactions easy and flexible.
Doctrine's sole goal is to give you powerful tools to make database interactions easy and flexible. In this chapter, you'll learn how to start leveraging Doctrine in your Symfony projects to give you rich database interactions.
Analysis of discrepancies between entity column types and property field types. To use this extension, require it in Composer: If you also install phpstan/extension-installer then you're all set! If your repositories have a common base class, you can configure it in your phpstan.neon and PHPStan will see additional methods you define in it:
Warning: You are browsing the documentation for Symfony 3.4 , which is no longer maintained. Read the updated version of this page for Symfony 6.1 (the current stable version).
You can exclude files from analysis
Create phpstan.neon
configuration file in the project directory and insert:
parameters:
excludes_analyse:
- %currentWorkingDirectory%/src/DoctrineMigrations/*
Every file inside src/DoctrineMigrations
directory will be excluded from analysis.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With