diff --git a/WordPressVIPMinimum/Sniffs/Classes/DeclarationCompatibilitySniff.php b/WordPressVIPMinimum/Sniffs/Classes/DeclarationCompatibilitySniff.php index 712cacd0..a71b4907 100644 --- a/WordPressVIPMinimum/Sniffs/Classes/DeclarationCompatibilitySniff.php +++ b/WordPressVIPMinimum/Sniffs/Classes/DeclarationCompatibilitySniff.php @@ -40,7 +40,7 @@ class DeclarationCompatibilitySniff extends AbstractScopeSniff { 'widget_options' => [ 'default' => 'array()', ], - 'constol_options' => [ + 'control_options' => [ 'default' => 'array()', ], ], @@ -103,7 +103,7 @@ class DeclarationCompatibilitySniff extends AbstractScopeSniff { 'output' => [ 'pass_by_reference' => true, ], - 'object', + 'data_object', 'depth' => [ 'default' => '0', ], @@ -118,7 +118,7 @@ class DeclarationCompatibilitySniff extends AbstractScopeSniff { 'output' => [ 'pass_by_reference' => true, ], - 'object', + 'data_object', 'depth' => [ 'default' => '0', ], @@ -158,7 +158,7 @@ class DeclarationCompatibilitySniff extends AbstractScopeSniff { 'elements', ], 'unset_children' => [ - 'el', + 'element', 'children_elements' => [ 'pass_by_reference' => true, ], @@ -215,7 +215,7 @@ protected function processTokenWithinScope( File $phpcsFile, $stackPtr, $currSco return; } - // Meed to define the originalParentClassName since we might override the parentClassName due to signature notations grouping. + // Need to define the originalParentClassName since we might override the parentClassName due to signature notations grouping. $originalParentClassName = $parentClassName; if ( array_key_exists( $parentClassName, $this->checkClasses ) === false ) { diff --git a/WordPressVIPMinimum/Tests/Classes/DeclarationCompatibilityUnitTest.inc b/WordPressVIPMinimum/Tests/Classes/DeclarationCompatibilityUnitTest.inc index a7ecaacf..740a7883 100644 --- a/WordPressVIPMinimum/Tests/Classes/DeclarationCompatibilityUnitTest.inc +++ b/WordPressVIPMinimum/Tests/Classes/DeclarationCompatibilityUnitTest.inc @@ -125,15 +125,21 @@ class MyWalker extends Walker { function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { } // Ok. - function unset_children( $el, $children_elements ) { + function unset_children( $element, $children_elements ) { } // Bad. $children_elements should be passed by reference - + function walk( $elements, $max_depth, ...$args ) { } // Ok. - + function paged_walk( $elements, $max_depth, $page_num, $per_page ) { } // Bad. Missing $args. function paged_walk( $elements, $max_depth, $page_num, $per_page, $args ) { } // Bad. $args is not variadic. + + function start_el( $output, $data_object, $depth, $args = array(), $current_object_id = 0 ) { + } // Bad. $output should be passed by reference, $depth should have a default value. + + function end_el( &$output, $data_object, $depth = 0, $args = array() ) { + } // Ok. } diff --git a/WordPressVIPMinimum/Tests/Classes/DeclarationCompatibilityUnitTest.php b/WordPressVIPMinimum/Tests/Classes/DeclarationCompatibilityUnitTest.php index 1a6b89a7..817bc324 100644 --- a/WordPressVIPMinimum/Tests/Classes/DeclarationCompatibilityUnitTest.php +++ b/WordPressVIPMinimum/Tests/Classes/DeclarationCompatibilityUnitTest.php @@ -47,6 +47,7 @@ public function getErrorList() { 128 => 1, 134 => 1, 137 => 1, + 140 => 1, ]; }