Repository navigation
Commit 72daaa2
committed
Narrow the comment_meta argument before parsing it
PHPStan reported two errors on the calls added in the previous commit:
Parameter #1 $assoc_args of function WP_CLI\Utils\parse_shell_arrays
expects array<string, string>, array<string, mixed> given.
Utils\parse_shell_arrays() is annotated for string values throughout, while
Comment_Command's methods correctly declare their arguments as
array<string, mixed> - a flag arrives as true, not as a string.
Rather than weaken that annotation, hand the function only the one key it
needs to look at, and only when it holds a string. That is not a workaround
for the type checker: is_json() rejects anything that is not a string, so a
non-string value was never going to be parsed either way.
Post_Command makes the same call without complaint only because its
$assoc_args parameters carry no type at all, and missingType.parameter is in
the ignore list.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014SSZzqMJRDTiLiDxQEPYcL1 parent bb0e04b commit 72daaa2
1 file changed
Lines changed: 28 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
78 | 104 | | |
79 | 105 | | |
80 | 106 | | |
| |||
145 | 171 | | |
146 | 172 | | |
147 | 173 | | |
148 | | - | |
| 174 | + | |
149 | 175 | | |
150 | 176 | | |
151 | 177 | | |
| |||
243 | 269 | | |
244 | 270 | | |
245 | 271 | | |
246 | | - | |
| 272 | + | |
247 | 273 | | |
248 | 274 | | |
249 | 275 | | |
| |||
0 commit comments