diff --git a/tests/Type/Fixtures/NonFinalObject.php b/tests/Type/Fixtures/NonFinalObject.php new file mode 100644 index 0000000..c569508 --- /dev/null +++ b/tests/Type/Fixtures/NonFinalObject.php @@ -0,0 +1,10 @@ +, Tests\Type\Fixtures\MagicPropertyObject>', $result); } +function testNonFinalClassMissingPropertyDoesNotCrash(NonFinalObject $object): void +{ + $result = expect($object)->name; + assertType('Pest\Expectations\HigherOrderExpectation, mixed>', $result); +} + +function testNonFinalClassMissingPropertyChainDoesNotCrash(NonFinalObject $object): void +{ + $result = expect($object)->name->toBe('Nuno'); + assertType('Pest\Expectations\HigherOrderExpectation, Tests\Type\Fixtures\NonFinalObject>', $result); +} + +function testNonFinalClassRealPropertyStillResolves(NonFinalObject $object): void +{ + $result = expect($object)->title; + assertType('Pest\Expectations\HigherOrderExpectation, string>', $result); +} + function testUnionWithoutClassPropertyDoesNotCrash(): void { /** @var array|object|null $payload */