-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add phpdoc for ClassMetadataInfo::discriminatorColumn property #9983
Conversation
@@ -574,7 +574,7 @@ class ClassMetadataInfo implements ClassMetadata | |||
* READ-ONLY: The definition of the discriminator column used in JOINED and SINGLE_TABLE | |||
* inheritance mappings. | |||
* | |||
* @psalm-var array<string, mixed>|null | |||
* @psalm-var array{name: string, fieldName: string, type: string, length?: int, columnDefinition?: string|null}|null |
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.
I looked at the setDiscriminatorColumn
and all the usage of this property in the orm code to find the possible values.
'type' => $discrColumnAttribute->type ?: 'string', | ||
'length' => $discrColumnAttribute->length ?: 255, | ||
'columnDefinition' => $discrColumnAttribute->columnDefinition, | ||
'name' => isset($discrColumnAttribute->name) ? (string) $discrColumnAttribute->name : null, |
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.
I have to cast this in order to avoid an ArgumentTypeCoercion error from psalm.
@@ -199,7 +199,7 @@ public function loadMetadataForClass($className, PersistenceClassMetadata $metad | |||
[ | |||
'name' => isset($discrColumn['name']) ? (string) $discrColumn['name'] : null, | |||
'type' => isset($discrColumn['type']) ? (string) $discrColumn['type'] : 'string', | |||
'length' => isset($discrColumn['length']) ? (string) $discrColumn['length'] : 255, | |||
'length' => isset($discrColumn['length']) ? (int) $discrColumn['length'] : 255, |
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.
The cast was wrong
. '", type="' . $discrColumn['type'] | ||
. '", length=' . $discrColumn['length']; | ||
$columnDefinition = sprintf('name="%s", type="%s"', $discrColumn['name'], $discrColumn['type']); | ||
if (isset($discrColumn['length'])) { |
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.
length might not be defined.
I assume this was always used with string so no error was reporter.
If you have time to take a look @greg0ire :) |
Maybe do you have time to review this @derrabus ? |
Not right now, no. |
Thanks @VincentLanglet ! |
No description provided.