Skip to content

Commit

Permalink
Merge pull request #1308 from WordPress-Coding-Standards/feature/1306…
Browse files Browse the repository at this point in the history
…-fix-strict-in-array

PHP.StrictInArray: don't throw an error for no parameters found
  • Loading branch information
JDGrimes authored Feb 26, 2018
2 parents 10ab802 + a38deb4 commit c0e2913
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 19 deletions.
15 changes: 0 additions & 15 deletions WordPress/Sniffs/PHP/StrictInArraySniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,4 @@ public function process_parameters( $stackPtr, $group_name, $matched_content, $p
}
}

/**
* Process the function if no parameters were found.
*
* @since 0.11.0
*
* @param int $stackPtr The position of the current token in the stack.
* @param array $group_name The name of the group which was matched.
* @param string $matched_content The token content (function name) which was matched.
*
* @return void
*/
public function process_no_parameters( $stackPtr, $group_name, $matched_content ) {
$this->phpcsFile->addError( 'Missing arguments to %s.', $stackPtr, 'MissingArguments', array( $matched_content ) );
}

} // End class.
1 change: 1 addition & 0 deletions WordPress/Tests/PHP/StrictInArrayUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ array_keys( $testing, 'my_key', false ); // Warning.
array_keys( array( '1', 1, true ), 'my_key', false ); // Warning
in_array( 1, array( '1', 1 ), TRUE ); // Ok.

use function in_array; // OK.
4 changes: 1 addition & 3 deletions WordPress/Tests/PHP/StrictInArrayUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ class StrictInArrayUnitTest extends AbstractSniffUnitTest {
* @return array <int line number> => <int number of errors>
*/
public function getErrorList() {
return array(
17 => 1,
);
return array();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion WordPress/Tests/WP/DeprecatedFunctionsUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ comments_popup_script();
get_comments_popup_template();
get_currentuserinfo();
is_comments_popup();
popuplinks();
use function popuplinks as something_else; // Related to issue #1306.

/*
* Warning.
Expand Down

0 comments on commit c0e2913

Please sign in to comment.