Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8148308

Browse files
Merge remote-tracking branch 'origin/1.3.x' into 1.4.x
2 parents c9f5ceb + a32bc86 commit 8148308

File tree

9 files changed

+78
-0
lines changed

9 files changed

+78
-0
lines changed

‎extension.neon‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ parameters:
6666
- stubs/Symfony/Component/OptionsResolver/Exception/InvalidOptionsException.stub
6767
- stubs/Symfony/Component/OptionsResolver/Options.stub
6868
- stubs/Symfony/Component/Process/Process.stub
69+
- stubs/Symfony/Component/PropertyAccess/Exception/AccessException.stub
70+
- stubs/Symfony/Component/PropertyAccess/Exception/ExceptionInterface.stub
71+
- stubs/Symfony/Component/PropertyAccess/Exception/InvalidArgumentException.stub
72+
- stubs/Symfony/Component/PropertyAccess/Exception/RuntimeException.stub
73+
- stubs/Symfony/Component/PropertyAccess/Exception/UnexpectedTypeException.stub
74+
- stubs/Symfony/Component/PropertyAccess/PropertyAccessorInterface.stub
6975
- stubs/Symfony/Component/PropertyAccess/PropertyPathInterface.stub
7076
- stubs/Symfony/Component/Security/Acl/Model/AclInterface.stub
7177
- stubs/Symfony/Component/Security/Acl/Model/EntryInterface.stub
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Symfony\Component\PropertyAccess\Exception;
4+
5+
class AccessException extends RuntimeException
6+
{
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Symfony\Component\PropertyAccess\Exception;
4+
5+
interface ExceptionInterface extends \Throwable
6+
{
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Symfony\Component\PropertyAccess\Exception;
4+
5+
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
6+
{
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Symfony\Component\PropertyAccess\Exception;
4+
5+
class RuntimeException extends \RuntimeException implements ExceptionInterface
6+
{
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Symfony\Component\PropertyAccess\Exception;
4+
5+
class UnexpectedTypeException extends RuntimeException
6+
{
7+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Symfony\Component\PropertyAccess;
4+
5+
interface PropertyAccessorInterface
6+
{
7+
8+
/**
9+
* @phpstan-template T of object|array<mixed>
10+
* @phpstan-param T &$objectOrArray
11+
* @phpstan-param-out ($objectOrArray is object ? T : array<mixed>) $objectOrArray
12+
* @phpstan-param string|PropertyPathInterface $propertyPath
13+
* @phpstan-param mixed $value
14+
*
15+
* @return void
16+
*
17+
* @throws Exception\InvalidArgumentException If the property path is invalid
18+
* @throws Exception\AccessException If a property/index does not exist or is not public
19+
* @throws Exception\UnexpectedTypeException If a value within the path is neither object nor array
20+
*/
21+
public function setValue(&$objectOrArray, $propertyPath, $value);
22+
23+
}

‎tests/Type/Symfony/ExtensionTest.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public function dataFileAsserts(): iterable
2828
yield from $this->gatherAssertTypes(__DIR__ . '/data/ExampleOptionCommand.php');
2929
yield from $this->gatherAssertTypes(__DIR__ . '/data/ExampleOptionLazyCommand.php');
3030
yield from $this->gatherAssertTypes(__DIR__ . '/data/kernel_interface.php');
31+
yield from $this->gatherAssertTypes(__DIR__ . '/data/property_accessor.php');
3132
yield from $this->gatherAssertTypes(__DIR__ . '/data/request_get_content.php');
3233

3334
$ref = new ReflectionMethod(Request::class, 'getSession');
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types = 1);
2+
3+
use function PHPStan\Testing\assertType;
4+
5+
$propertyAccessor = new \Symfony\Component\PropertyAccess\PropertyAccessor();
6+
7+
$array = [1 => 'ea'];
8+
$propertyAccessor->setValue($array, 'foo', 'bar');
9+
assertType('array', $array);
10+
11+
$object = new \stdClass();
12+
$propertyAccessor->setValue($object, 'foo', 'bar');
13+
assertType('stdClass', $object);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /