-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add param out for propertyAccessor * Fix stub
- Loading branch information
1 parent
d8a0bc0
commit a32bc86
Showing
10 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
stubs/Symfony/Component/PropertyAccess/Exception/AccessException.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\PropertyAccess\Exception; | ||
|
||
class AccessException extends RuntimeException | ||
{ | ||
} |
7 changes: 7 additions & 0 deletions
7
stubs/Symfony/Component/PropertyAccess/Exception/ExceptionInterface.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\PropertyAccess\Exception; | ||
|
||
interface ExceptionInterface extends \Throwable | ||
{ | ||
} |
7 changes: 7 additions & 0 deletions
7
stubs/Symfony/Component/PropertyAccess/Exception/InvalidArgumentException.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\PropertyAccess\Exception; | ||
|
||
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface | ||
{ | ||
} |
7 changes: 7 additions & 0 deletions
7
stubs/Symfony/Component/PropertyAccess/Exception/RuntimeException.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\PropertyAccess\Exception; | ||
|
||
class RuntimeException extends \RuntimeException implements ExceptionInterface | ||
{ | ||
} |
7 changes: 7 additions & 0 deletions
7
stubs/Symfony/Component/PropertyAccess/Exception/UnexpectedTypeException.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\PropertyAccess\Exception; | ||
|
||
class UnexpectedTypeException extends RuntimeException | ||
{ | ||
} |
23 changes: 23 additions & 0 deletions
23
stubs/Symfony/Component/PropertyAccess/PropertyAccessorInterface.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\PropertyAccess; | ||
|
||
interface PropertyAccessorInterface | ||
{ | ||
|
||
/** | ||
* @phpstan-template T of object|array<mixed> | ||
* @phpstan-param T &$objectOrArray | ||
* @phpstan-param-out ($objectOrArray is object ? T : array<mixed>) $objectOrArray | ||
* @phpstan-param string|PropertyPathInterface $propertyPath | ||
* @phpstan-param mixed $value | ||
* | ||
* @return void | ||
* | ||
* @throws Exception\InvalidArgumentException If the property path is invalid | ||
* @throws Exception\AccessException If a property/index does not exist or is not public | ||
* @throws Exception\UnexpectedTypeException If a value within the path is neither object nor array | ||
*/ | ||
public function setValue(&$objectOrArray, $propertyPath, $value); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
$propertyAccessor = new \Symfony\Component\PropertyAccess\PropertyAccessor(); | ||
|
||
$array = [1 => 'ea']; | ||
$propertyAccessor->setValue($array, 'foo', 'bar'); | ||
assertType('array', $array); | ||
|
||
$object = new \stdClass(); | ||
$propertyAccessor->setValue($object, 'foo', 'bar'); | ||
assertType('stdClass', $object); |