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
Narrow Model API #6261
Narrow Model API #6261
Conversation
45e010a
to
6118480
Compare
5559815
to
67b982f
Compare
8d2bba4
to
22c3f23
Compare
22c3f23
to
f69aa7c
Compare
f69aa7c
to
3e478e2
Compare
I had to change a little more things: I reduced the number of method on the test Datagrid.php (it had old methods that are already removed) So I changed that too. |
3e478e2
to
3ebd242
Compare
3ebd242
to
e667ad8
Compare
7336f04
to
d86a02e
Compare
ping @sonata-project/contributors |
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.
class-string and array-key are not handled by Phpstorm.
I don't know if it's not better to write
@param string
@phpstan-param class-string
How are you dealing with this on dbal @greg0ire , vscode does not recognise it but does not complain either, and it becomes harder to spot those mistakes |
Also when adding psalm do I have to write param, psalm-param and phpstan-param? |
We are using prefixes ( |
The idea is to use it for array-key and for class-string? Also for using generics like: array<string, string> we should do like:
I guess phpstorm does not work for
Not sure if I should revert to basic phpdoc, or figure this out on this PR, to move on with the same idea on next PRs |
Phpstorm understand
But for array-key and class-string, I prefer to use
In order to work with phpstorm.
Indeed
seems better to me. |
569af00
d86a02e
to
569af00
Compare
569af00
to
7107d5e
Compare
*/ | ||
public function getModelCollectionInstance($class); | ||
public function getModelCollectionInstance(string $class): Collection; |
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.
This method on 3.x was deprecated, (will be removed once we merge 3.x with master, and we removed deprecated code again) but I wanted to show how this would have been (the relevant lines are the phpdoc, not this one). cc/ @VincentLanglet @phansys
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 like this way.
We should be ready to go now. Please review @sonata-project/contributors |
Lets have this one for now, Thank you for your reviews :) |
Subject
I am targeting this branch, because this is a BC break.
Changelog
I have applied PHPStan level 8 when doing it and all of the errors related to the typehints are done.