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

Classes/DeclarationCompatibility: sync with WP Core #799

Merged
merged 1 commit into from
Sep 19, 2023
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 @@ -40,7 +40,7 @@ class DeclarationCompatibilitySniff extends AbstractScopeSniff {
'widget_options' => [
'default' => 'array()',
],
'constol_options' => [
'control_options' => [
'default' => 'array()',
],
],
Expand Down Expand Up @@ -103,7 +103,7 @@ class DeclarationCompatibilitySniff extends AbstractScopeSniff {
'output' => [
'pass_by_reference' => true,
],
'object',
'data_object',
'depth' => [
'default' => '0',
],
Expand All @@ -118,7 +118,7 @@ class DeclarationCompatibilitySniff extends AbstractScopeSniff {
'output' => [
'pass_by_reference' => true,
],
'object',
'data_object',
'depth' => [
'default' => '0',
],
Expand Down Expand Up @@ -158,7 +158,7 @@ class DeclarationCompatibilitySniff extends AbstractScopeSniff {
'elements',
],
'unset_children' => [
'el',
'element',
'children_elements' => [
'pass_by_reference' => true,
],
Expand Down Expand Up @@ -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 ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function getErrorList() {
128 => 1,
134 => 1,
137 => 1,
140 => 1,
];
}

Expand Down