mirror of
https://github.com/danog/psalm-plugin-symfony.git
synced 2024-11-30 04:29:10 +01:00
Fix PropertyAccessorInterface stub (#176)
This commit is contained in:
parent
b1e6ad594c
commit
0bd4de0cd1
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user