Improve `sprintf` return type inference
closes https://github.com/phpstan/phpstan/issues/11201 closes https://github.com/phpstan/phpstan/issues/10493
the composer error is valid, as we previously inferred a non-empty-string return type, even though the sprintf pattern is not known at static analysis time.
other errors are the same ones are unrelated
This pull request has been marked as ready for review.
the reported phpstan error is interesstig.. it seems - depending on some unknown factor - reports that we are catching a non-throwable but ignoring this very same error by identifer leads to a "No error with identifier catch.notThrowable is reported on line 200."
see the 2 variants at
- https://github.com/phpstan/phpstan-src/pull/3168/commits/ff9189e5e14e3cbe3dc1b87eba1cd09763cb52da
- https://github.com/phpstan/phpstan-src/pull/3168/commits/fd5e76270f38ebf0e04137fff4426d4db264d7d7
(its unrelated to this PR though)
I think its related to this Consistency::flexEntity call in the exception classes.. some class-alias stuff is going on there.. this might lead to a race condition depending on the order which classes will be scanned when
There's an opportunity to grab the code from Hoa packages and make a small single modern library with no magic and simple PSR-4 autoloading and replace Hoa in phpstan-src. I might look into it this summer.
I might look into it this summer.
ok, what can we do to fix the build until then?
Try to rebase on top of: https://github.com/phpstan/phpstan-src/commit/323315554048a22e6c01d635d6c5bb68f10d5aa1