Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[PropertyAccess] Throw an InvalidArgumentException when the type do not match #17738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
CS
  • Loading branch information
dunglas committed Feb 23, 2016
commit 28dc4e3d4825fc5e9d66097f7463bfadaa267ed4
7 changes: 3 additions & 4 deletions src/Symfony/Component/PropertyAccess/PropertyAccessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,8 @@ private function writeIndex(&$array, $index, $value)
* @param string $property The property to write
* @param mixed $value The value to write
*
* @throws NoSuchPropertyException If the property does not exist or is not
* public.
* @throws NoSuchPropertyException If the property does not exist or is not
* public.
* @throws \TypeError
*/
private function writeProperty(&$object, $property, $value)
Expand Down Expand Up @@ -575,7 +575,7 @@ private function writeProperty(&$object, $property, $value)
}

/**
* Emulates PHP 7 behavior in PHP 5.
* Throws a {@see \TypeError} as in PHP 7 when using PHP 5.
*
* @param object $object
* @param string $method
Expand All @@ -591,7 +591,6 @@ private function callMethod($object, $method, $value) {
return;
}

// Emulates PHP 7 behavior
set_error_handler(function ($errno, $errstr) use ($object, $method) {
if (E_RECOVERABLE_ERROR === $errno && false !== strpos($errstr, sprintf('passed to %s::%s() must', get_class($object), $method))) {
throw new \TypeError($errstr);
Expand Down