-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Make table and column comments non-nullable strings #3949
Conversation
} | ||
|
||
/** | ||
* @return mixed[][] |
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.
Phpstan is ok with mixed[][]
, but Psalm isn't.
* @return mixed[][] | |
* @return iterable<mixed[]> |
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.
As far as I understand, []
is a list/collection. It doesn't imply a specific implementation. It looks like Psalm thinks differently (cannot find a reference).
I'm fine to adjust but I'd rather do it for the entire codebase and have the rule enforced on CI. E.g. by adding a dependency on Psalm and setting the lowest possible level. Otherwise, it will become a matter of personal preference rather than a standard.
$ git grep 'mixed[][]' tests | wc -l
96
$ git grep 'iterable<mixed\[\]>' tests | wc -l
0
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.
Ok let's not make this a blocker
} | ||
|
||
/** | ||
* @return mixed[][] |
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.
* @return mixed[][] | |
* @return iterable<mixed[]> |
$comment
arguments were marked as nullable during the scalar types enforcement in the codebase (Enforced parameter and return value types in Platform classes #3562, Added type hints to the Column class #3511) because, despite the fact they were annotated asstring
in phpDoc, the values might contain NULL at runtime.(string) $comment
orif ($comment === null || $comment === '')
which illustrates that there's no practical difference between them at the abstraction level.ColumnCommentTest
that is cross-platform and more focused on the API rather than on implementation details.