phpstan-doctrine
phpstan-doctrine copied to clipboard
Doctrine extensions for PHPStan

- Closes #657 - Since we still have `testUnknownDriver` test, we are not losing anything by this - This was there more-less prepared for easier implementation of sqlsrv support (currently...
- https://github.com/doctrine/dbal/pull/6536 (since dbal 4.2) - https://github.com/doctrine/dbal/pull/6471 (since dbal 4.1) - Resolves #619
@see https://symfony.com/blog/new-in-symfony-7-3-dx-improvements-part-1\#datepoint-doctrine-type
## Description This PR addresses PHPStan errors related to template type variance in Doctrine's metadata classes. The errors were occurring because the template type `T` was declared as covariant but...
It's possible to configure a `objectManagerLoader` that returns an instance to your configured Doctrine manager. This works great, and it gives PHPStan super capabilities. In most cases, you would fetch...
see: [this discussion](https://github.com/phpstan/phpstan/discussions/12626) and @ondrejmirtes's [response](https://github.com/phpstan/phpstan/discussions/12626#discussioncomment-12272904). ## CODE ``` /** * @template TypeEntity of AbstractThisEntity * @extends EntityRepository */ abstract class AbstractThisRepository extends EntityRepository { /** @return TypeEntity[] */ public...
Since DBAL v.4 binary mapping [converts](https://github.com/doctrine/dbal/blob/4.2.x/UPGRADE.md#bc-break-changes-to-handling-binary-fields) DB value to PHP string instead of resource. But PHPStan check produces an error in this case: ``` Property Entity\Foo::$bar type mapping mismatch: database...
It would be very nice to raise an error when one call ```php \count($entity->getSomethingThatIsACollection()) ``` It's an error because doctrine will 1. fetch all data from the DB 2. hydrate...