Repository navigation
Commit 87e64ab
committed
Code Quality: Remove always-true strict comparisons.
PHPStan reports these conditions as always true (`notIdentical.alwaysTrue`), so they are simplified and the matching entries are removed from the PHPStan baseline:
* In `WP_Links_List_Table::prepare_items()`, `$cat_id` is compared with `0` instead of `'all'`. Since r58069 it has always been an integer from `absint()`, so the string comparison could never fail. An empty category was already ignored by `get_bookmarks()`.
* In `wp_get_layout_style()`, the flex layout's `$gap_value` is checked against an empty string instead of `null`, since it is always the string result of `trim()`. The style engine already drops empty declarations, so the CSS output is unchanged.
* In `WP_Rewrite::add_rewrite_tag()` and `WP_Rewrite::remove_rewrite_tag()`, the redundant `null` check is removed, since `array_search()` returns either a key or `false`.
Developed in #13670.
Follow-up to r36217, r54274, r58069, r63023.
Props arshidkv12, westonruter.
See #65817.
Fixes #66155.
git-svn-id: https://develop.svn.wordpress.org/trunk@63887 602fd350-edb4-49c9-b593-d223f7449a821 parent 9b621ad commit 87e64ab
4 files changed
Lines changed: 4 additions & 19 deletions
File tree
- src
- wp-admin/includes
- wp-includes
- block-supports
- tests/phpstan/baselines
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
780 | 780 | | |
781 | 781 | | |
782 | 782 | | |
783 | | - | |
| 783 | + | |
784 | 784 | | |
785 | 785 | | |
786 | 786 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
799 | 799 | | |
800 | 800 | | |
801 | 801 | | |
802 | | - | |
| 802 | + | |
803 | 803 | | |
804 | 804 | | |
805 | 805 | | |
| |||
823 | 823 | | |
824 | 824 | | |
825 | 825 | | |
826 | | - | |
| 826 | + | |
827 | 827 | | |
828 | 828 | | |
829 | 829 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 21 | | |
37 | 22 | | |
38 | 23 | | |
| |||
0 commit comments