minor #39695 [PropertyAccess] throw type error when incompatible types are passed (xabbuh)
This PR was merged into the 5.2 branch.
Discussion
----------
[PropertyAccess] throw type error when incompatible types are passed
| Q | A
| ------------- | ---
| Branch? | 5.2
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Commits
-------
4c5cff6558
throw type error when incompatible types are passed
This commit is contained in:
commit
1e8fe94fff
@ -127,7 +127,7 @@ PhpUnitBridge
|
||||
PropertyAccess
|
||||
--------------
|
||||
|
||||
* Dropped support of a boolean as the first argument of `PropertyAccessor::__construct()`.
|
||||
* Dropped support for booleans as the first argument of `PropertyAccessor::__construct()`.
|
||||
Pass a combination of bitwise flags instead.
|
||||
|
||||
PropertyInfo
|
||||
|
@ -92,6 +92,8 @@ class PropertyAccessor implements PropertyAccessorInterface
|
||||
trigger_deprecation('symfony/property-access', '5.2', 'Passing a boolean as the first argument to "%s()" is deprecated. Pass a combination of bitwise flags instead (i.e an integer).', __METHOD__);
|
||||
|
||||
$magicMethods = ($magicMethods ? self::MAGIC_CALL : 0) | self::MAGIC_GET | self::MAGIC_SET;
|
||||
} elseif (!\is_int($magicMethods)) {
|
||||
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an integer, "%s" given.', __METHOD__, get_debug_type($readInfoExtractor)));
|
||||
}
|
||||
|
||||
$this->magicMethodsFlags = $magicMethods;
|
||||
|
Reference in New Issue
Block a user