Skip to content

Commit 19dba20

Browse files
committed
Support @reqired annotation and #[Required] attribute for properties.
Prevent PropertyNotSetInConstructor when ContainerAwareTrait used. fix test
1 parent 6c5bead commit 19dba20

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

tests/acceptance/acceptance/PropertyAccessorInterface.feature

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ Feature: PropertyAccessorInterface
4141
"""
4242
class Company
4343
{
44-
public string $name = 'Acme';
44+
/**
45+
* @var string
46+
*/
47+
public $name = 'Acme';
4548
}
4649
$company = new Company();
4750

tests/acceptance/acceptance/RequiredAttribute.feature

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ Feature: RequiredAttribute
4141
"""
4242
<?php
4343
44-
class MyServiceB {
45-
/** @var string */
44+
class MyServiceC {
45+
/**
46+
* @var string
47+
*/
4648
public $a;
4749
public function __construct(){}
4850
@@ -51,5 +53,5 @@ Feature: RequiredAttribute
5153
When I run Psalm
5254
Then I see these errors
5355
| Type | Message |
54-
| PropertyNotSetInConstructor | Property MyServiceB::$a is not defined in constructor of MyServiceB and in any methods called in the constructor |
56+
| PropertyNotSetInConstructor | Property MyServiceC::$a is not defined in constructor of MyServiceC and in any methods called in the constructor |
5557
And I see no other errors

0 commit comments

Comments
 (0)