schlndh

Results 13 comments of schlndh

First, I would recommend trying [this](https://github.com/phpstan/phpstan/discussions/7108#discussioncomment-2636342) (set `nodesByStringCountMax: 0`). I also compared the runtime of multiple versions of phpstan on a subset of mediawiki. I first tried with 8 threads...

I looked a bit more into the mediawiki performance and I found that [this file](https://github.com/wikimedia/mediawiki/blob/d71887e045a810fe9b9fb85b6e2d4e89692a83ec/includes/media/IPTC.php#L42) (and that specific method) is what triggers the slowdown between 1.4.10 and 1.5.0. In 1.4.10...

@herndlm Thanks for the context. In fact I used something quite similar (at least as far as I can tell from having a brief look) before this. Here is my...

@ondrejmirtes Ok thanks. I didn't even try that. However, it does not have properly narrowed return type: https://phpstan.org/r/c17d9c39-fe2c-44d6-8b9d-18c8bf3126cb

This is a duplicate of https://github.com/phpstan/phpstan/issues/8101

I found this possibly related issue: https://phpstan.org/r/ac2b69f1-1e28-4b22-a3c9-7171bae6c540 Surprisingly, changing it to `if (count($arr) > 0)`, or removing the if and adding `non-empty-array $arr` makes the issue disappear.

@ondrejmirtes It's not better. See https://github.com/phpstan/phpstan-src/pull/2972#discussion_r1527450851

I added a fix for https://github.com/phpstan/phpstan/issues/5987 (because previously it was a bit more broken compared to 1.10.x). But I can't say that I'm confident that I didn't break something else...

@ondrejmirtes ~It turns out that neither approach works consistently out of the box.~ It seems that `FunctionParameterClosureTypeExtension` only narrows down the type inside the closure. It doesn't narrow it down...

@ondrejmirtes I created a [proof-of-concept PR](https://github.com/phpstan/phpstan-src/pull/3347) which applies `FunctionParameterClosureTypeExtension` in `FunctionCallParametersCheck`. Please let me know whether this is a direction that you're comfortable with, so that I don't get too...