Skip to content

Commit

Permalink
Support @reqired annotation and #[Required] attribute for properties.
Browse files Browse the repository at this point in the history
Prevent PropertyNotSetInConstructor when ContainerAwareTrait used.

fix test
  • Loading branch information
Punk-UnDeaD committed Mar 24, 2021
1 parent 6c5bead commit 19dba20
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ Feature: PropertyAccessorInterface
"""
class Company
{
public string $name = 'Acme';
/**
* @var string
*/
public $name = 'Acme';
}
$company = new Company();
Expand Down
8 changes: 5 additions & 3 deletions tests/acceptance/acceptance/RequiredAttribute.feature
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ Feature: RequiredAttribute
"""
<?php
class MyServiceB {
/** @var string */
class MyServiceC {
/**
* @var string
*/
public $a;
public function __construct(){}
Expand All @@ -51,5 +53,5 @@ Feature: RequiredAttribute
When I run Psalm
Then I see these errors
| Type | Message |
| PropertyNotSetInConstructor | Property MyServiceB::$a is not defined in constructor of MyServiceB and in any methods called in the constructor |
| PropertyNotSetInConstructor | Property MyServiceC::$a is not defined in constructor of MyServiceC and in any methods called in the constructor |
And I see no other errors

0 comments on commit 19dba20

Please sign in to comment.