-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
Bug report
After phpstan/phpstan-src#477 was merged I decided to checkout phpstan dev-master (coming from 0.12.81) to see if it solved my problem.
It introduced 681 new errors in my codebase 😳 It could be that this is totally correct, and that I should fix some things, but since you haven't tagged a release yet, I wanted to check-in to see if all is good.
I'm getting these errors:
------ -------------------------------------------------------------------------------------------------------------------------------
Line src/Company.php
------ -------------------------------------------------------------------------------------------------------------------------------
38 PHPDoc tag @var for property App\Company::$administrations with type
array<App\Administration>|Doctrine\Common\Collections\Collection<int,
App\Administration> is not subtype of native type Doctrine\Common\Collections\Collection.
38 Property App\Company::$administrations type mapping mismatch: property can contain
Doctrine\Common\Collections\Collection but database expects
Doctrine\Common\Collections\Collection&iterable<App\Administration>.
38 Property App\Company::$administrations with generic interface
Doctrine\Common\Collections\Collection does not specify its types: TKey, T
💡 You can turn this off by setting checkGenericClassInNonGenericObjectType: false in your
phpstan.neon.
60 Method App\Company::getAdministrations() return type with generic interface
Doctrine\Common\Collections\Collection does not specify its types: TKey, T
💡 You can turn this off by setting checkGenericClassInNonGenericObjectType: false in your
phpstan.neon.
60 PHPDoc tag @return with type
array<App\Administration>|Doctrine\Common\Collections\Collection<int,
App\Administration> is not subtype of native type Doctrine\Common\Collections\Collection.
------ -----------------------------------------------------------------------------------------------------------------
Code snippet that reproduces the problem
/**
* @var Collection<int, Administration>|Administration[]
*/
protected Collection $administrations;https://phpstan.org/r/dd4860d5-62df-4b99-bfe0-5470a6764355
The reason why I add |Administration[] is to let PHPStorm understand the type properly. Before, PHPStan would just allow this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels