-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Adjust logic targeting inaccessible nodes #21
base: master
Are you sure you want to change the base?
Conversation
Loosen parent check from Class_ to ClassLike, to include Traits, Interfaces, and Enums. Remove protected nodes, regardless if the class is final or not. Adjust test
if (!$this->includeInaccessibleClassNodes | ||
&& $parent instanceof Class_ | ||
&& ($node instanceof ClassMethod || $node instanceof ClassConst || $node instanceof Property) | ||
&& ($node->isPrivate() || $node->isProtected()) | ||
) { |
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.
if (!$this->includeInaccessibleClassNodes | |
&& $parent instanceof Class_ | |
&& ($node instanceof ClassMethod || $node instanceof ClassConst || $node instanceof Property) | |
&& ($node->isPrivate() || $node->isProtected()) | |
) { | |
if ( | |
!$this->includeInaccessibleClassNodes | |
&& $parent instanceof Class_ | |
&& ($node instanceof ClassMethod || $node instanceof ClassConst || $node instanceof Property) | |
&& ($node->isPrivate() || $node->isProtected()) | |
) { |
Thank you for your contribution! I've given up on WC and disabled this feature, thus including inaccessible things. Could WC stubs be executed with this PR? |
What is someone extends a WC class with protected methods? Will this introduce static analysis errors? |
Changes
Class_
toClassLike
to includeTraits
,Interfaces
, andEnums
.Reason
Unfortunately, sometimes developers define protected or private methods in interfaces or traits.
I'm looking at you WooCommerce:
The missing abstract method (
get_values_for_total
) is defined in a trait:https://github.com/woocommerce/woocommerce/blob/c4a7e9a11b62e9f62fd507f5a0c8ae09740619a0/plugins/woocommerce/includes/traits/trait-wc-item-totals.php#L32