Fix most errors from PHPCS and PHPStan#466
Conversation
Signed-off-by: John Blackbourn <john@johnblackbourn.com> Signed-off-by: Andy Fragen <andy@thefragens.com> Signed-off-by: Carrie Dils <carriedils@gmail.com> Signed-off-by: Norcross <andrew.norcross@gmail.com> Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: joedolson <joedolson@users.noreply.github.com> Signed-off-by: Joe Dolson <design@joedolson.com> Signed-off-by: Shadi Sharaf <shady@sharaf.me> Co-authored-by: Chuck Adams <chaz@chaz.works> Co-authored-by: Andy Fragen <andy@thefragens.com> Co-authored-by: Norcross <andrew.norcross@gmail.com> Co-authored-by: Carrie Dils <cdils@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: rmccue <21655+rmccue@users.noreply.github.com> Co-authored-by: cdils <3099408+cdils@users.noreply.github.com> Co-authored-by: joedolson <joedolson@users.noreply.github.com> Co-authored-by: Joe Dolson <design@joedolson.com> Co-authored-by: Shady Sharaf <shady@sharaf.me>
Signed-off-by: Chuck Adams <chaz@chaz.works>
Signed-off-by: Mika Ipstenu Epstein <ipstenu@halfelf.org>
Signed-off-by: Ipstenu (Mika Epstein) <Ipstenu@users.noreply.github.com> Signed-off-by: Mika <ipstenu@halfelf.org> Signed-off-by: Mika Ipstenu Epstein <ipstenu@halfelf.org> Signed-off-by: Mika Epstein <ipstenu@halfelf.org>
Signed-off-by: Andy Fragen <andy@thefragens.com>
Signed-off-by: Marc Armengou <83702259+marcarmengou@users.noreply.github.com>
Co-authored-by: Carrie Dils <cdils@users.noreply.github.com>
Co-authored-by: Chuck Adams <chaz@chaz.works>
Signed-off-by: Chuck Adams <chaz@chaz.works>
Signed-off-by: Chuck Adams <chaz@chaz.works>
Signed-off-by: Chuck Adams <chaz@chaz.works>
Signed-off-by: Chuck Adams <chaz@chaz.works>
Signed-off-by: Chuck Adams <chaz@chaz.works>
Signed-off-by: Chuck Adams <chaz@chaz.works>
| return $color; | ||
| } | ||
|
|
||
| return null; |
There was a problem hiding this comment.
I'm not sure I understand this? Why return null? Why not just return '' as in line 20?
There was a problem hiding this comment.
I'm just replicating the behavior of the WP function which falls off the end, thus implicitly returning null. phpstan is just forcing us to be explicit about that. Frankly I'm not sure why it's not just using the WP function, but it's only used in one place anyway, so 🤷
There was a problem hiding this comment.
Why not just return an empty string if it falls off instead of null?
| return $result; | ||
| } | ||
|
|
||
| // FIXME: Updater\Updater has neither a constructor nor a run() method. |
There was a problem hiding this comment.
Well, they both existed in 1.3.0
There was a problem hiding this comment.
FAIR\Updater\Updater has nothing but static functions, so maybe it's just using the wrong class? Fair\Updater\Package does take a $did argument (but also requires a second arg of $filepath). I'm not familiar enough with this part of the code to know what's right, though my IDE does mark the surrounding function as unused...
Signed-off-by: Chuck Adams <chaz@chaz.works>
Signed-off-by: Chuck Adams <chaz@chaz.works>
Signed-off-by: Chuck Adams <chaz@chaz.works>
Signed-off-by: Chuck Adams <chaz@chaz.works>
|
I've now fixed or suppressed the remaining warnings and errors, except for the one phpstan error that's a legit bug, and that needs someone who knows the code better. |
Not all issues are fixed yet, but I've left warnings enabled and the baseline disabled so they can keep failing in CI til we fix them here. The FIXME comment in inc/packages/admin/namespace.php suggests there's probably a genuine bug in that code path.