Elektrine lite

← Feed

@OndrejMirtes@phpc.social

Post #1159786

2026-04-12 20:16 UTC

@bobmagicii@phpc.social @beberlei@phpc.social @asgrim@phpc.social I wouldn't say it's tedious, it just reflects the actual complexity of the problem. You have: ReflectionNamedType ReflectionUnionType (can also contain multiple intersections - DNF) ReflectionIntersectionType You can't simplify this to "getClass”. Every type behaves different, you need to write code for each of these cases and decide what you want to do with them. Once PHP adds yet another type, you need to add support to it and decide once again the behaviour.

Replies (2)

  • @beberlei@phpc.social 2026-04-13 12:15

    @OndrejMirtes@phpc.social @bobmagicii@phpc.social @asgrim@phpc.social you are right that use case is important, for PHPStan the exact type relationship and compisition is important, for me: I only need a simple list of all classes that could go in there. :)

    Open ##1159785

  • @asgrim@phpc.social 2026-04-12 21:02

    @OndrejMirtes @bobmagicii @beberlei this is definitely some useful information to... reflect on 😁

    Open ##1591019