Giovanni Giacobbi
Giovanni Giacobbi
I'm sorry for opening another can of worms, but I just realized that in the subject-is-array case, the resulting type should not be `array{...original...}|array{}` but rather `array{...all keys are optional...}`...
I agree it looks weird without parens, but it really depends on the grammar definition of the type syntax. Does `~` have a lower precedence of `|`? I ran a...
I like the use case, I ran into something similar in the past. But I was wondering: Wouldn't an annotation be more suitable for this job rather than a plugin...
> You can write an annotation - an ignore annotation :) > That's surely a solution, but it would ignore every possible error, not only the intended one. I think...
> I've just skimmed the patch, and it looks good to me, but I think we should establish some coding style rules first – otherwise we might go back and...
> an agreed upon style is needed, but even more so, an automatic formatter that is checked in CI. clang-format is the obvious candidate. I don't think we want to...
I'm a bit lost on this approach, but I'd be happy to investigate it. Should I open a dedicated issue for it? This PR is about getting one subset of...
I still don't understand the approach of returning the types, are you sure it shouldn't be an looseIntersectWith($type, $version)? How would you tackle things that don't involve basic constants, like...
Another example that comes to mind is: if ($a == 15) ... ``` /** @var mixed $a */ if ($a == 15) { assertType('15|numeric-string', $a); } ``` In this case...
I'm working on an updated PR to handle more cases. This also fixes a problem I found, see this: https://phpstan.org/r/62751f1c-596f-4d7c-8a82-ff027b0515d5 Note that the evaluation of the expression actually gets it...