Skip to content

Commit eb7356b

Browse files
committed
Code Quality: Fix the booleanAnd.alwaysFalse PHPStan error and remove the baseline.
`$parent_file` is hard-coded to the string `'themes.php'` earlier in this file and never reassigned, so `empty( $parent_file )` can never be true. Drop the always-false clause; the condition reduces to the half that was actually reachable. This also removes the file's only reference to $self, which was never defined, retiring its `variable.undefined` baseline entry as well. See #65817.
1 parent 21e4da0 commit eb7356b

4 files changed

Lines changed: 1 addition & 34 deletions

File tree

‎phpstan.neon.dist‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ includes:
2626
- tests/phpstan/baselines/argument.unresolvableType.neon
2727
- tests/phpstan/baselines/assign.propertyType.neon
2828
- tests/phpstan/baselines/binaryOp.invalid.neon
29-
- tests/phpstan/baselines/booleanAnd.alwaysFalse.neon
3029
- tests/phpstan/baselines/booleanAnd.leftAlwaysTrue.neon
3130
- tests/phpstan/baselines/booleanNot.alwaysTrue.neon
3231
- tests/phpstan/baselines/class.notFound.neon

‎src/wp-admin/themes.php‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,7 @@
373373
}
374374

375375
// 0 = name, 1 = capability, 2 = file.
376-
if ( 0 === strcmp( $self, $item[2] ) && empty( $parent_file )
377-
|| $parent_file && $item[2] === $parent_file
378-
) {
376+
if ( $parent_file && $item[2] === $parent_file ) {
379377
$class = ' current';
380378
}
381379

‎tests/phpstan/baselines/booleanAnd.alwaysFalse.neon‎

Lines changed: 0 additions & 25 deletions
This file was deleted.

‎tests/phpstan/baselines/variable.undefined.neon‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,6 @@ parameters:
398398
identifier: variable.undefined
399399
count: 1
400400
path: ../../../src/wp-admin/theme-install.php
401-
-
402-
message: '#^Variable \$self might not be defined\.$#'
403-
identifier: variable.undefined
404-
count: 1
405-
path: ../../../src/wp-admin/themes.php
406401
-
407402
message: '#^Variable \$submenu might not be defined\.$#'
408403
identifier: variable.undefined

0 commit comments

Comments
 (0)