throw type error when incompatible types are passed
This commit is contained in:
parent
5b9e187631
commit
4c5cff6558
@ -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