phpstan-doctrine
phpstan-doctrine copied to clipboard
Doctrine extensions for PHPStan
Since Doctrine Bundle 2.3 we can pass a service id to the CustomIdGenerator annotation. However this causes `Internal error: Internal error: Can't instantiate custom generator : app.doctrine.user_id_generator in file /app/src/Entity/User.php`....
Given this Doctrine setup (see below for details): - `Supplier` has a **nullable** many-to-one to `Country` - `Country` has a non-nullable many-to-one to `Continent` And this query: $rows = $this->em->createQueryBuilder()...
See following example, not sure this is possible to support or not. ```php $query = $em->createQueryBuilder() ->addSelect('COUNT(m.id) AS count, m.intColumn') ->from(Many::class, 'm') ->join('m.one', 'o') ->groupBy('intColumn'); // m.intColumn works assertType( 'array',...
- See result of functions [here](https://github.com/phpstan/phpstan-doctrine/pull/270/files#diff-28394df5dba3e85fe86f9c8d9b05d6087fe897d0efa1d0c0ad3533a1f0252b99R347) and [here](https://github.com/phpstan/phpstan-doctrine/pull/270/files#diff-28394df5dba3e85fe86f9c8d9b05d6087fe897d0efa1d0c0ad3533a1f0252b99R376). I hope I'm not mistaken, but those functions (COUNT, SUM, AVG, MIN, MAX, LENGTH) should always return int, do they not? Those...
We recently encountered a bug in SonataMediaBundle because setter/getter of entities were final. https://github.com/sonata-project/SonataMediaBundle/pull/2264 The doctrine doc say https://www.doctrine-project.org/projects/doctrine-orm/en/2.9/reference/architecture.html#entities > An entity class must not be final or contain final...
Hello I have this error that I can't figure out if it is a bug or expected (and I don't know why) ``` Property PspAbstractBankAccount::$bankAccount type mapping mismatch: database can...
When using `simple_array` with `nullable=true`, PHPStan thinks the property should be nullable. But that is not the case, as the `simple_array` type always returns an empty array, even if the...
phpstan-doctrine 1.0.1 The [PHPStan's documentation](https://phpstan.org/blog/detecting-unused-private-properties-methods-constants#what-if-my-code-is-%E2%80%9Cspecial%E2%80%9D%3F) says > For Doctrine the logic is following: > Property is always read (it doesn’t need a getter) if it’s a persisted field or association....
I cannot find a way to satisfy the case > Property App\User::$stats type mapping mismatch: database can contain App\UserStats|null but property expects App\UserStats. I have the following mapping : ```php
In https://github.com/phpstan/phpstan-doctrine/pull/172 https://github.com/phpstan/phpstan-doctrine/pull/173 `TypeSpecifyingExtension` were introduced to narrow the return type of the `Collection::first` and `Collection::last` methods. With the following tests ``` $entityOrFalse = $collection->first(); $entityOrFalse; if ($collection->isEmpty()) { $false...