Skip to content

Commit fbcc951

Browse files
authored
Merge pull request #799 from Automattic/feature/declarationcompatibility-sync-with-wp
2 parents 9749b01 + ff14488 commit fbcc951

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

WordPressVIPMinimum/Sniffs/Classes/DeclarationCompatibilitySniff.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class DeclarationCompatibilitySniff extends AbstractScopeSniff {
4040
'widget_options' => [
4141
'default' => 'array()',
4242
],
43-
'constol_options' => [
43+
'control_options' => [
4444
'default' => 'array()',
4545
],
4646
],
@@ -103,7 +103,7 @@ class DeclarationCompatibilitySniff extends AbstractScopeSniff {
103103
'output' => [
104104
'pass_by_reference' => true,
105105
],
106-
'object',
106+
'data_object',
107107
'depth' => [
108108
'default' => '0',
109109
],
@@ -118,7 +118,7 @@ class DeclarationCompatibilitySniff extends AbstractScopeSniff {
118118
'output' => [
119119
'pass_by_reference' => true,
120120
],
121-
'object',
121+
'data_object',
122122
'depth' => [
123123
'default' => '0',
124124
],
@@ -158,7 +158,7 @@ class DeclarationCompatibilitySniff extends AbstractScopeSniff {
158158
'elements',
159159
],
160160
'unset_children' => [
161-
'el',
161+
'element',
162162
'children_elements' => [
163163
'pass_by_reference' => true,
164164
],
@@ -215,7 +215,7 @@ protected function processTokenWithinScope( File $phpcsFile, $stackPtr, $currSco
215215
return;
216216
}
217217

218-
// Meed to define the originalParentClassName since we might override the parentClassName due to signature notations grouping.
218+
// Need to define the originalParentClassName since we might override the parentClassName due to signature notations grouping.
219219
$originalParentClassName = $parentClassName;
220220

221221
if ( array_key_exists( $parentClassName, $this->checkClasses ) === false ) {

WordPressVIPMinimum/Tests/Classes/DeclarationCompatibilityUnitTest.inc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,21 @@ class MyWalker extends Walker {
125125
function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
126126
} // Ok.
127127

128-
function unset_children( $el, $children_elements ) {
128+
function unset_children( $element, $children_elements ) {
129129
} // Bad. $children_elements should be passed by reference
130-
130+
131131
function walk( $elements, $max_depth, ...$args ) {
132132
} // Ok.
133-
133+
134134
function paged_walk( $elements, $max_depth, $page_num, $per_page ) {
135135
} // Bad. Missing $args.
136136

137137
function paged_walk( $elements, $max_depth, $page_num, $per_page, $args ) {
138138
} // Bad. $args is not variadic.
139+
140+
function start_el( $output, $data_object, $depth, $args = array(), $current_object_id = 0 ) {
141+
} // Bad. $output should be passed by reference, $depth should have a default value.
142+
143+
function end_el( &$output, $data_object, $depth = 0, $args = array() ) {
144+
} // Ok.
139145
}

WordPressVIPMinimum/Tests/Classes/DeclarationCompatibilityUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function getErrorList() {
4747
128 => 1,
4848
134 => 1,
4949
137 => 1,
50+
140 => 1,
5051
];
5152
}
5253

0 commit comments

Comments
 (0)