-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[PropertyInfo] Fix failure over array<string,mixed> PhpDoc type #38385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
476f0fa
to
369dd62
Compare
Can you have a look at deps=low failures, please? |
Sure, I'm ont it. |
369dd62
to
6a3df1d
Compare
src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php
Outdated
Show resolved
Hide resolved
So, to sum up, the issue is coming from old PhpDocExtractor versions not supporting
|
6a3df1d
to
590177f
Compare
@@ -122,7 +122,7 @@ private function createType(DocType $type, bool $nullable, string $docType = nul | |||
$collectionKeyType = $this->getTypes($type->getKeyType())[0]; | |||
|
|||
$collectionValueTypes = $this->getTypes($type->getValueType()); | |||
if (\count($collectionValueTypes) > 1) { | |||
if (0 === \count($collectionValueTypes) || \count($collectionValueTypes) > 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!== 1
?
Thank you @romaricdrigon. |
Background
Since a few days ago (this commit), PropertyInfo 5.2 component supports array PhpDoc types, such as
array<string,string>
.While testing SF 5.2 over my project, it was failing over:
Upon investigation, it appears
array<string,mixed>
is causing the issue:mixed
type is not handled.Expected behavior
PropertyInfo component should not guess anything for
mixed
type (returnNULL
), but it should not throw any exception.Comment about my fix
I added a test case (
arrayOfMixed
) you can use to reproduce the issue.Since array PhpDoc types were not tested at all, I also added a test case over
array<string,string>
.