Fix PropertyAccessorInterface stub (#176)

This commit is contained in:
Vincent Langlet 2021-05-10 08:35:42 +02:00 committed by GitHub
parent b1e6ad594c
commit 0bd4de0cd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 1 deletions

View File

@ -9,7 +9,7 @@ interface PropertyAccessorInterface
* @psalm-param T $objectOrArray
* @psalm-param string|PropertyPathInterface $propertyPath
* @psalm-param mixed $value
* @psalm-self-out T $objectOrArray
* @psalm-param-out T $objectOrArray
*/
public function setValue(&$objectOrArray, $propertyPath, $value);

View File

@ -40,3 +40,28 @@ Feature: PropertyAccessorInterface
"""
When I run Psalm
Then I see no errors
Scenario: Set value does not modify the propertyAccessor variable
Given I have the following code
"""
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
class Company
{
/**
* @var PropertyAccessorInterface
*/
private $propertyAccessor;
public function __construct(PropertyAccessorInterface $propertyAccessor) {
$this->propertyAccessor = $propertyAccessor;
}
public function doThings(Company $thing): void {
$this->propertyAccessor->setValue($thing, 'foo', 'bar');
$this->propertyAccessor->setValue($thing, 'foo', 'bar');
}
}
"""
When I run Psalm
Then I see no errors