| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
I think we should distinguish two different case
|
Sorry, something went wrong.
There was a problem hiding this comment.
The correct way to find parent methods is ParentMethodHelper.
Sorry, something went wrong.
|
@VincentLanglet do you mean as separate rules? |
Sorry, something went wrong.
|
Not a class, but an error identifier for sure. |
Sorry, something went wrong.
|
Hi @kubawerlos could you rebase and solve the conflict ? |
Sorry, something went wrong.
| continue; | ||
| } | ||
|
|
||
| if (preg_match(self::INLINE_INHERIT_DOC_REGEX, $child->text, $matches) !== 1) { |
There was a problem hiding this comment.
Can't we do better ?
I know it'll be an edge case but you won't catch description like
/**
* Please do not add `{@inheritDoc}` to this method
*/
Sorry, something went wrong.
There was a problem hiding this comment.
Like this?
Sorry, something went wrong.
There was a problem hiding this comment.
I'm not very good in regex but looking at the test called InheritDocInsideBackticks i'm not sure we understood each other.
My point was that, we might not want to consider that a method with
/** * Foo @inheritDoc */
has an inheritDoc, cause it might be just a comment.
It wasn't related to backticks
(On the opposite,
/** * @inheritDoc Bar */
might be considered as an inherit doc with an extra comment... ; I dunno)
I never use inheritDoc so I can't stay what we can find in codebase.
Sorry, something went wrong.
There was a problem hiding this comment.
Updated test.
@inheritDoc Bar will be tokenised as a tag with extra description.
Sorry, something went wrong.
| final class InvalidInheritDocTagRule implements Rule | ||
| { | ||
|
|
||
| private const INLINE_INHERIT_DOC_REGEX = '~`[^`]*`(*SKIP)(*FAIL)|(?<![a-zA-Z0-9])\{@inheritDoc\b[^}]*\}~i'; |
There was a problem hiding this comment.
can this regex be simplified because it uses i modifier (case-less), so the pattern itself does not need to handle both upper and lower case things?
Sorry, something went wrong.
There was a problem hiding this comment.
What do you mean? To lowercase $child->text and drop i, or to match only on exact case match?
Sorry, something went wrong.
There was a problem hiding this comment.
I mean a-zA-Z does not make sense in a i modfied regex
Sorry, something went wrong.
There was a problem hiding this comment.
but as commented in the other stream.. I am not convinced this regex is a good idea.
Sorry, something went wrong.
There was a problem hiding this comment.
Let's see where phpstan/phpdoc-parser#298 will lead.
Sorry, something went wrong.
| break; | ||
| } | ||
|
|
||
| if ($inheritDocTagName === null) { |
There was a problem hiding this comment.
I am not sure about this additional regex matching on-top of regular phpDoc parsing.
all relevant cases should be detected by the phpdoc parser, if it is doing a good job.
if not we should improve the phpdoc parser IMO
Sorry, something went wrong.
There was a problem hiding this comment.
Definitely, this is not perfect. The limitation is {@inheritDoc} ends up as part of a PhpDocTextNode, not as a tag.
Sorry, something went wrong.
There was a problem hiding this comment.
take my feedback with a grain of salt. I think this is a gray area which needs @ondrejmirtes opinion.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Closes phpstan/phpstan#5561