-
-
Notifications
You must be signed in to change notification settings - Fork 505
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
Finish adding return type declarations to phpdoc #2368
Conversation
@@ -44,6 +44,9 @@ public function toArray(): array | |||
return iterator_to_array($this); | |||
} | |||
|
|||
/** | |||
* {@inheritDoc} |
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.
why do we need these?
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.
For the inheritDoc
cases, I was getting these errors:
FILE: lib/Doctrine/ODM/MongoDB/Iterator/PrimingIterator.php
-----------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------------------------
47 | ERROR | Method \Doctrine\ODM\MongoDB\Iterator\PrimingIterator::current() does not have return type hint nor @return annotation for its return value.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
I remember reading about phpcs that performs analysis by file, so it doesn't get that information from the parent, I'll see if there is a way to avoid this.
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.
slevomat/coding-standard#1149 🤔 the only thing I can think of is that we can try to reach level 5 of phpstan that checks missing type declarations and remove this sniff.
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 good thing is that we're already on level 5 :) https://github.com/doctrine/mongodb-odm/blob/2.2.x/phpstan.neon.dist#L5
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.
Level 6 sorry 😞
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.
Dang, so close. Personally I'd rather not clutter the code with useless inheritdoc
just to satisfy CS Fixer. How about merging all the other changes, still keep the rule as excluded, and work towards level 6? I'd also much appreciate @alcaeus input on this
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 don't like inheritdoc
either, I'm fine keeping the rule excluded. Should I remove all the inheritdoc
? (apart from the ones added in this PR) 🤔
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.
👍 for removing all @inheritDocs
48f89a9
to
5c8ba4c
Compare
d171792
to
adde551
Compare
adde551
to
c8db8af
Compare
This will avoid deprecations with Symfony 5.4
Thanks @franmomu and sorry for keeping you waiting 🎉 |
Summary
This is the last PR adding return type declarations (I'll create a couple for parameter type declarations), there is one change in
GraphLookup:: convertTargetFieldName
, this method is called in:mongodb-odm/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup.php
Lines 92 to 106 in 38fc494
and
mongodb-odm/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup.php
Lines 123 to 128 in 38fc494
In both calls the argument is a
string
, so it will never be anarray
.