Elektrine lite

← Feed

@OndrejMirtes@phpc.social

Post #2539113

2026-03-26 09:04 UTC

@harald Interfaces too. Trait is not really a declaring class, the class using the trait is. But the information about the trait is also available: https://apiref.phpstan.org/2.1.x/PHPStan.Reflection.Php.PhpMethodReflection.html#_getDeclaringTrait PHPStan knows everything about your code. It needs it for 1st party rules, but you can use it too.

Replies (1)

  • @harald@hub.volse.no 2026-03-26 09:52

    @@OndrejMirtes@phpc.social Thanks for the clarification. I definitely need to look more into this. Just started using PHPStan a while ago, but it's way more powerful than I though!

    Open ##2539114