[PropertyAccess] Fixed inverted logic
This commit is contained in:
parent
3e81333823
commit
f42e588de6
@ -42,7 +42,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
||||
public function __construct($magicCall = false, $throwExceptionOnInvalidIndex = false)
|
||||
{
|
||||
$this->magicCall = $magicCall;
|
||||
$this->ignoreInvalidIndices = $throwExceptionOnInvalidIndex;
|
||||
$this->ignoreInvalidIndices = !$throwExceptionOnInvalidIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -116,7 +116,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
||||
*
|
||||
* @throws UnexpectedTypeException If a value within the path is neither object nor array.
|
||||
*/
|
||||
private function &readPropertiesUntil(&$objectOrArray, PropertyPathInterface $propertyPath, $lastIndex, $ignoreInvalidIndices = false)
|
||||
private function &readPropertiesUntil(&$objectOrArray, PropertyPathInterface $propertyPath, $lastIndex, $ignoreInvalidIndices = true)
|
||||
{
|
||||
$propertyValues = array();
|
||||
|
||||
@ -131,7 +131,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
||||
|
||||
// Create missing nested arrays on demand
|
||||
if ($isIndex && $isArrayAccess && !isset($objectOrArray[$property])) {
|
||||
if ($ignoreInvalidIndices) {
|
||||
if (!$ignoreInvalidIndices) {
|
||||
if (!is_array($objectOrArray)) {
|
||||
if (!$objectOrArray instanceof \Traversable) {
|
||||
throw new NoSuchIndexException(sprintf(
|
||||
|
Reference in New Issue
Block a user