You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PHPStan can be hotfixed by assuming all regexes containing \K are "not yet understood". But understanding \K is not that dificult, so better variant of fix would be to implement the support right away.
\K can be used to reset the match start. For example, the pattern foo\Kbar matches "foobar", but reports that it has matched "bar". The use of \K does not interfere with the setting of captured substrings. For example, when the pattern (foo)\Kbar matches "foobar", the first substring is still set to "foo".
To fix this issue, $matches[0] must be of type string (instead of non-empty-string) when \K escape sequence is present anywhere in the regex. Or only when "there is NOT at least something always matched after \K - a\K.* vs a\K.+".
Bug report
phpstan/phpstan-src#3897 has broken our pipelines as we use
\K
heavily (https://github.com/atk4/data/actions/runs/14046848345/job/39329419333).PHPStan can be hotfixed by assuming all regexes containing
\K
are "not yet understood". But understanding\K
is not that dificult, so better variant of fix would be to implement the support right away./cc @staabm
Code snippet that reproduces the problem
https://phpstan.org/r/bcf6e7a9-64b3-4bbd-b7d7-fb1c44f0efc8
Expected output
no error
The text was updated successfully, but these errors were encountered: