Commit 3b95d2c
committed
WP 6.5/6.8/6.9: account for new function and constant polyfills
I checked the WordPress src/wp-includes/compat.php file for new polyfills that should be added and here is what I found that was missing in this repository:
WP 6.5 added polyfills for:
* `IMAGETYPE_AVIF` and `IMG_AVIF` constants, which were introduced in PHP 8.1.
WP 6.8 added polyfills for:
* `array_find()`, `array_find_key()`, `array_any()` and `array_all()`, which were introduced in PHP 8.4.
WP 6.9 added polyfills for:
* `array_first()` and `array_last()`, which were introduced in PHP 8.5.
* `IMAGETYPE_HEIF` constant, which was introduced in PHP 8.5.
Note: The `IMAGETYPE_AVIF` and `IMAGETYPE_HEIF` constants are not yet flagged by PHPCompatibility. Since excluding error codes that don't exist yet doesn't trigger errors in PHPCS, we may as well add the exclusions proactively. Unless I'm missing something, I believe PHPCompatibility should be updated to check for these constants.
Note: WP 6.9 also added polyfills for `utf8_encode()` and `utf8_decode()`, which were deprecated in PHP 8.2 and will be removed in PHP 9.0. These are intentionally not excluded here, as these functions are deprecated and developers should migrate to `mb_convert_encoding()`. My understanding is that the WordPress polyfill exists for backward compatibility with legacy code, but PHPCompatibility should still warn about their usage.1 parent 6f578a3 commit 3b95d2c
2 files changed
+29
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
39 | 47 | | |
40 | 48 | | |
41 | 49 | | |
| |||
55 | 63 | | |
56 | 64 | | |
57 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
58 | 75 | | |
59 | 76 | | |
60 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
0 commit comments