Skip to content

0.11.1

Compare
Choose a tag to compare
@ondrejmirtes ondrejmirtes released this 13 Feb 13:22

PHPStan's Doctrine extension just got a lot better! To take advantage of the latest features, check out the README.

TL; DR: Include rules.neon in your phpstan.neon and provide a file that loads EntityManager instance from your application. Put the file path to doctrine.objectManagerLoader config key.

Thanks to @lcobucci and @mcfedr for their awesome work!

What's new

  • Static DQL validation! PHPStan can now validate syntax and even referenced fields and associations of your DQL queries. (❗️❗️❗️)
  • EntityManager::getRepository() return type now respects repositoryClass in entity class metadata.
  • Recognizes magic findBy*, findOneBy* and countBy* methods on EntityRepository.
  • Validates entity fields in repository findBy, findBy*, findOneBy, findOneBy*, count and countBy* method call arguments.
  • Interprets generic-like syntax EntityRepository<MyEntity> in phpDocs for further type inference of methods called on the repository.
  • Support for Doctrine ODM.