Conversation
Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>
MasterOdin
commented
Oct 26, 2025
| $selectColumns = array_filter($selectColumns, 'strlen'); | ||
| $writeColumns = array_filter($writeColumns, 'strlen'); | ||
| $selectColumns = array_filter($selectColumns, fn($v) => $v && strlen($v) > 0); | ||
| $writeColumns = array_filter($writeColumns, fn($v) => $v && strlen($v) > 0); |
Member
Author
There was a problem hiding this comment.
Per phpstan/phpstan#2266, the maintainer of phpstan made a conscious decision to encode this where the callable passed to array_filter must return a boolean value (I think), which strlen doesn't do.
Passing 'strlen' would also implicitly filter out both emtpy strings and false values, whereas doing it explicitly throws a type error passing a boolean to strlen, so this is certainly more type safe in general I guess.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR updates our usage of phpstan from 1.9.x to 1.12.x, which is the latest minor release of the 1.x branch. While preferable to move to phpstan 2.1, per #2362, there's a lot of errors that get thrown out that we'd need to fix before doing so, as I don't want to add them to the baseline.