From 51493b552a58bb4f25beda00a27d4f144c2dfa9f Mon Sep 17 00:00:00 2001 From: bugreportuser <37939393+bugreportuser@users.noreply.github.com> Date: Sat, 23 Feb 2019 08:37:37 -0600 Subject: [PATCH] Add @psalm-property and @psalm-method override tests --- tests/MagicMethodAnnotationTest.php | 22 ++++++++++ tests/MagicPropertyTest.php | 65 +++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/tests/MagicMethodAnnotationTest.php b/tests/MagicMethodAnnotationTest.php index 3581710cc..ea0a1a355 100644 --- a/tests/MagicMethodAnnotationTest.php +++ b/tests/MagicMethodAnnotationTest.php @@ -400,6 +400,28 @@ class MagicMethodAnnotationTest extends TestCase $child = new Child(); + $a = $child->getString(); + $child->setInteger(4);', + 'assertions' => [ + '$a' => 'string', + ], + ], + 'overrideMethodAnnotations' => [ + 'getString(); $child->setInteger(4);', 'assertions' => [ diff --git a/tests/MagicPropertyTest.php b/tests/MagicPropertyTest.php index e12de67e9..0a45ddf94 100644 --- a/tests/MagicPropertyTest.php +++ b/tests/MagicPropertyTest.php @@ -434,6 +434,71 @@ class MagicPropertyTest extends TestCase $a->foo = "hello"; $a->bar = "hello"; // not a property', ], + 'overridePropertyAnnotations' => [ + 'foo = "hello"; + $a->bar = "hello"; // not a property', + ], + 'overrideWithReadWritePropertyAnnotations' => [ + 'foo = []; + + $a = new A(); + $a->takesString($a->foo);', + ], ]; }