phpstan-doctrine icon indicating copy to clipboard operation
phpstan-doctrine copied to clipboard

Invalid mapping type to property type check for binary mapping since DBAL v.4

Open v-noskov opened this issue 7 months ago • 1 comments

Since DBAL v.4 binary mapping converts 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 can contain resource|null but property expects     
         string|null.

v-noskov avatar Apr 25 '25 14:04 v-noskov

What code reports this error?

ondrejmirtes avatar Apr 25 '25 20:04 ondrejmirtes

@ondrejmirtes I've added PR that demonstrates the issue. If you agree, I can try to fix it by changing \PHPStan\Type\Doctrine\Descriptors\BinaryType::getWritableToPropertyType.

v-noskov avatar Jul 02 '25 20:07 v-noskov

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Nov 07 '25 00:11 github-actions[bot]