Repository navigation
Commit fa31aae
committed
Code Quality: Resolve the
Only one of the unreachable statements in the baseline could never run, the trailing `wp_send_json_error()` in `wp_ajax_set_attachment_thumbnail()`, which would only have appended a second response after one had already been sent, and it is removed. The others are kept on purpose:
* Translatable strings after a `return`, so that they are added to the POT file.
* An `exit` or `break` that keeps a `switch` case from reading as falling through.
* The `wp_die()` fallback for a list table supplied by the `wp_list_table_class_name` filter whose `ajax_response()` returns.
* The `die()` that stops a request with an invalid nonce even if a custom `wp_die()` handler returns.
Since these should never be fixed, they are ignored inline with a reason rather than left in a baseline, which would invite contributors to remove them. Unlike the counted entries used for the HTML API in r64294, an inline ignore names the exact statement, so a genuine unreachable statement added to the same file is still reported. The Ajax handlers involved are also documented as never returning.
Developed in #16224.
Follow-up to r29029, r63023, r64294.
Props mukesh27, westonruter.
See #66739.
git-svn-id: https://develop.svn.wordpress.org/trunk@65773 602fd350-edb4-49c9-b593-d223f7449a82deadCode.unreachable PHPStan errors.1 parent 916de6f commit fa31aae
7 files changed
Lines changed: 14 additions & 60 deletions
File tree
- src
- wp-admin
- includes
- wp-includes
- tests/phpstan/baselines
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | | - | |
| 297 | + | |
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| |||
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
98 | | - | |
| 100 | + | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
| |||
2684 | 2686 | | |
2685 | 2687 | | |
2686 | 2688 | | |
| 2689 | + | |
| 2690 | + | |
2687 | 2691 | | |
2688 | 2692 | | |
2689 | 2693 | | |
| |||
2705 | 2709 | | |
2706 | 2710 | | |
2707 | 2711 | | |
2708 | | - | |
| 2712 | + | |
2709 | 2713 | | |
2710 | 2714 | | |
2711 | 2715 | | |
| |||
2804 | 2808 | | |
2805 | 2809 | | |
2806 | 2810 | | |
| 2811 | + | |
| 2812 | + | |
2807 | 2813 | | |
2808 | 2814 | | |
2809 | 2815 | | |
| |||
2849 | 2855 | | |
2850 | 2856 | | |
2851 | 2857 | | |
2852 | | - | |
2853 | | - | |
2854 | 2858 | | |
2855 | 2859 | | |
2856 | 2860 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | | - | |
| 248 | + | |
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1365 | 1365 | | |
1366 | 1366 | | |
1367 | 1367 | | |
1368 | | - | |
| 1368 | + | |
1369 | 1369 | | |
1370 | 1370 | | |
1371 | 1371 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1399 | 1399 | | |
1400 | 1400 | | |
1401 | 1401 | | |
1402 | | - | |
| 1402 | + | |
1403 | 1403 | | |
1404 | 1404 | | |
1405 | 1405 | | |
| |||
This file was deleted.
0 commit comments