phpstan: column with whitespace-only size spec #2020
+1
−1
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.
@gechetspr this fixes the single phpstan error about the condition always being true. It has been adressed as an add-on in other pull requests, but I think it makes sense to handle this in a dedicated PR so CI improves for everyone.
However (this is pushing the limits of my PHP/regex knowledge): I think phpstan might actually be wrong here?
My reasoning: the function uses a regex on the column definition (e.g.
VARCHAR (25)
). The second match of the regex refers to anything between the brackets (column size). I think, because of the comments inside the regex, phpstan detects there will always be at least one space between the brackets. In that case the if statement is indeed always true.But the regex contains an
/x
modifier, which ignores those whitespaces, no?@staabm would you be able to chime in on what's happening here?
Edit: FWIW the other failing (mysql) tests is addressed separately in #2021.