-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add support for sensitive parameters in stubs #8689
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
Conversation
0fba3f5
to
2e3e0bd
Compare
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.
You'll likely need to cherry-pick this e7ff926 commit from my PR.
2e3e0bd
to
cb0bfb7
Compare
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.
Thanks for working on this! This LGTM as far as I am qualified to tell.
d03edf8
to
197faf4
Compare
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.
Verified that it does the job with #8352.
Is there a particular reason why we went with a doc-comment instead of |
197faf4
to
79c4ead
Compare
No, not really. It's just that we have been using phpdoc and attributes don't offer too much value in this case as we have to process stubs via PHP-Parser anyway. |
79c4ead
to
408c96b
Compare
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.
Sorry for the delay. They're just minor comments.
@@ -4090,7 +4178,7 @@ function initPhpParser() { | |||
installPhpParser($version, $phpParserDir); | |||
} | |||
|
|||
spl_autoload_register(function(string $class) use($phpParserDir) { | |||
spl_autoload_register(function(string $class) use ($phpParserDir) { |
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.
Since you made the one above static
, this one can also be static.
@@ -970,6 +983,10 @@ public function getMethodSynopsisFilename(): string { | |||
return implode('_', $this->name->parts); | |||
} | |||
|
|||
public function getAttributeName(): string { |
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 name is a bit confusing. It's not the attribute name but the canonicalized (ie lowercased) function/method name to attach the given attribute to.
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.
Yes, you are right. However, I think it's better if the method name reflects the use-case (similarly togetMethodSynopsisFilename()
and getArgInfoName()
) instead of using "canonicalized". That's why I changed getAttributeName()
for getNameForAttributes()
in b2ed625. Hopefully, it addresses your comments and make intention more clear.
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.
Yes, perfect 🙂
case 'prefer-ref': | ||
case 'sensitive-param': | ||
$varName = $tag->getVariableName(); | ||
if (!isset($paramMeta[$varName])) { |
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 isset block is redundant, $paramMeta[$varName][$tag->name] = true;
will automatically create the outer array.
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.
Yeah, I also noticed this, but didn't want to touch it as this piece of code was originally written by Nikita
To make the implementation of #8352 easier.