Skip to content

Commit

Permalink
Merge pull request #561 from Automattic/fix/469-restrictedfunctions-f…
Browse files Browse the repository at this point in the history
…alse-positive-class-instantiation

Functions/RestrictedFunctions: fix false positive on class instantiation
  • Loading branch information
GaryJones authored Jul 27, 2020
2 parents 4d644cb + 35068c0 commit 84605b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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.

0 comments on commit 84605b5

Please sign in to comment.