Have the DocBlockTypeResolver activated (infer_types_from_doc_block: true)
Have a Doctrine entity with an member attribute that is:
typed with PHPDoc (@var integer) as an integer (not int)
computed, not persistent (no ORM mapping)
serializable (@Serializer annotations, for e.g. Groups or SerializedName; but no type, for which we rely on PHPDoc)
Try to generate metadata cache
Expected Result
attribute is detected as int
Actual Result
"Can't use incorrect type integer for collection" exception
Cause
isPrimitiveType() does not know the alternative, long names that are part of PHPDoc: integer, boolean, double.
As such it avoids all kind of typing in DoctrineTypeDriver::setType() and ends considering those members as a collection (= behaviour for anything not being detected as a primitive, scalar, type).
Steps required to reproduce the problem
infer_types_from_doc_block: true
)@var integer
) as an integer (not int)@Serializer
annotations, for e.g. Groups or SerializedName; but no type, for which we rely on PHPDoc)Expected Result
Actual Result
Cause
isPrimitiveType()
does not know the alternative, long names that are part of PHPDoc:integer
,boolean
,double
. As such it avoids all kind of typing inDoctrineTypeDriver::setType()
and ends considering those members as a collection (= behaviour for anything not being detected as a primitive, scalar, type).