Open SignpostMarv opened 4 years ago
I think setUp()
method analyzer has to be run with $scope->collect_initializations = true
and it'll fix the issue automatically.
where would I poke around to have that kick in ?
Depending on the visibility of TestCase::$foo
(e.g. not private), this would be runtime behavior. Just saying. Psalm would not be able to detect it unchanged. Even if private PHP has reflection, so again, runtime behavior.
/E: Have you tried to mark the TestCase::$foo
property as @psalm
immutable? No idea if the phpunit plugin needs to understand Phpunit\TestCase::setUp
as eligible for (implicit) setter injection / initialization and immutable has enough introspection on class properties for the class itself, but then technically this should be the outcome (without even taking care of visibility / reflection or runtime behavior)
have emailed GitHub re the rather unpleasant commit ref spam caused by rebasing- it should be resolved by an interface change in GitHub "approximately 1-2 quarters from now."
TestCase::$foo
isT|null
TestCase::setUp()
setsTestCase::$foo
toT
TestCase::$foo
TestCase::assertInstanceOf(T::class, $this->foo)
is redundantnot quite sure on the exact error/test case that should occur, but this is a vague mashup of what I'm thinking: