Skip to content
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

Functions/RestrictedFunctions: fix false positive on class instantiation #561

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ public function is_targetted_token( $stackPtr ) {
\T_AS => \T_AS, // Use declaration alias.
\T_DOUBLE_COLON => \T_DOUBLE_COLON,
\T_OBJECT_OPERATOR => \T_OBJECT_OPERATOR,
\T_NEW => \T_NEW,
];
if ( isset( $skipped[ $this->tokens[ $prev ]['code'] ] ) ) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,7 @@ wpcom_vip_get_page_by_path(); // Ok - VIP recommended version of get_page_by_pat
get_page_by_path( $page_path ); // Warning.

$popular = stats_get_csv( 'postviews', [ 'days' => 2, 'limit' => 20 ] ); // Error.
$popular = custom_stats_get_csv( 'postviews', [ 'days' => 2, 'limit' => 20 ] ); // Ok.
$popular = custom_stats_get_csv( 'postviews', [ 'days' => 2, 'limit' => 20 ] ); // Ok.

$foo = new Link; // OK, class, not function.
$foo = new Mail(); // OK, class, not function.