Skip to content
Open
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
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ includes:
- tests/phpstan/baselines/empty.property.neon
- tests/phpstan/baselines/empty.variable.neon
- tests/phpstan/baselines/encapsedStringPart.nonString.neon
- tests/phpstan/baselines/foreach.nonIterable.neon
- tests/phpstan/baselines/function.alreadyNarrowedType.neon
- tests/phpstan/baselines/function.impossibleType.neon
- tests/phpstan/baselines/function.resultUnused.neon
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ public function remove_rewrite_rules() {
}

// Remove registered custom meta capabilities.
foreach ( $this->cap as $cap ) {
foreach ( (array) $this->cap as $cap ) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if $this->cap is a stdClass as the class property docblock claims, then will the (array) cast not create a clone of the data, iterate over the clone, delete properties from the clone, and then leave the original $this->cap untouched?

if so, wouldn’t that create a logical defect and nullify this code?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your comment would be valid i believe if we were actually unsetting properties of the actual $cap property. We don't though. So the only downside i see with this code is that its actually using a bit of extra memory because of the cloning.

unset( $post_type_meta_caps[ $cap ] );
}
}
Expand Down
25 changes: 0 additions & 25 deletions tests/phpstan/baselines/foreach.nonIterable.neon

This file was deleted.

Loading