You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Property @var not resolved when a trait in another file assigns a parent's property #99
When a trait in its own file assigns a property declared in a parent class from another namespace, the class name in the property's @var is not resolved. The right object is rejected.
Sorry for the number of issues lately: we are trying to run TypePHP on a large codebase (PHPStan level 9, ~23k files), and each one comes from that work. Thanks for the quick replies so far.
Three files plus a runner, default config (no typephp.php, so src/** is checked):
composer.json
{"require": {"typephp/typephp": "0.10.26"}}
src/Base.php
<?phpnamespaceModel;
class User {}
class Base
{
/** @var User|null */public ?object$owner = null;
}
No playground link: the bug needs several files, and the same code in a single file passes.
Expected output
OK: User in src/Base.php is Model\User.
Context: our entities declare field properties in generated base classes and assign them from traits in feature modules, so property checks reject most of them.
No worries at all and no need to apologize.. This bug report is extremly important to resolve many hidden edge cases and make this library better for everyone.. If you encounter more bugs dont hesitate to report more so we can help each other..
Activity
rcalicdan commentedon Oct 3, 2026
No worries at all and no need to apologize.. This bug report is extremly important to resolve many hidden edge cases and make this library better for everyone.. If you encounter more bugs dont hesitate to report more so we can help each other..