Repository navigation
Commit 1cdf865
committed
Code Quality: Stop passing a
The bulk compatibility checks in `Plugin_Upgrader::bulk_upgrade()` and `Theme_Upgrader::bulk_upgrade()` handed the `WP_Error` they had just built to `$this->skin->before()`, which takes no parameter. The `$this->skin->error( $result )` call on the next line is what reports the failure, and the `$this->skin->after()` call below it already passes nothing.
The argument was inert only because of which skin those paths reach. Both `Bulk_Plugin_Upgrader_Skin::before()` and `Bulk_Theme_Upgrader_Skin::before()` ignore the `$title` they are given and call the parent with the plugin or theme name instead, so the object was discarded before anything could read it. A skin without that override, such as a plain `Bulk_Upgrader_Skin`, instead places it in the `%1$s` of the `Updating Plugin %1$s (%2$d/%3$d)` header, where PHP 8 throws `Object of class WP_Error could not be converted to string` and takes down the update screen. Removing the argument closes a latent fatal rather than only tidying an unused value.
Nothing reads the parameter today: every `before()` implementation in core either declares none at all or documents a `string $title`, and a survey of the plugin and theme directories turned up no consumer: only copies of this same loop passing the same dead argument.
This empties `tests/phpstan/baselines/arguments.count.neon`, so as that file's header directs it is deleted along with its `includes` entry in `phpstan.neon.dist`.
Developed in WordPress#13571.
Follow-up to r56525, r57252, r63020.
Props soean.
See #65817.
git-svn-id: https://develop.svn.wordpress.org/trunk@63788 602fd350-edb4-49c9-b593-d223f7449a82WP_Error to the skin's before().1 parent 825b49c commit 1cdf865
4 files changed
Lines changed: 4 additions & 35 deletions
File tree
- src/wp-admin/includes
- tests/phpstan/baselines
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
359 | | - | |
| 359 | + | |
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
| |||
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
373 | | - | |
| 373 | + | |
374 | 374 | | |
375 | 375 | | |
376 | 376 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
457 | | - | |
| 457 | + | |
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
| |||
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
471 | | - | |
| 471 | + | |
472 | 472 | | |
473 | 473 | | |
474 | 474 | | |
| |||
This file was deleted.
0 commit comments