Skip to content

Commit

Permalink
[PropertyAccess] the property path constructor already implements the…
Browse files Browse the repository at this point in the history
… type check
  • Loading branch information
Tobion committed Feb 19, 2015
1 parent 4e11c07 commit 9cacecb
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Symfony/Component/PropertyAccess/PropertyAccessor.php
Expand Up @@ -40,10 +40,8 @@ public function __construct($magicCall = false)
*/
public function getValue($objectOrArray, $propertyPath)
{
if (is_string($propertyPath)) {
if (!$propertyPath instanceof PropertyPathInterface) {
$propertyPath = new PropertyPath($propertyPath);
} elseif (!$propertyPath instanceof PropertyPathInterface) {
throw new UnexpectedTypeException($propertyPath, 'string or Symfony\Component\PropertyAccess\PropertyPathInterface');
}

$propertyValues = & $this->readPropertiesUntil($objectOrArray, $propertyPath, $propertyPath->getLength());
Expand All @@ -56,10 +54,8 @@ public function getValue($objectOrArray, $propertyPath)
*/
public function setValue(&$objectOrArray, $propertyPath, $value)
{
if (is_string($propertyPath)) {
if (!$propertyPath instanceof PropertyPathInterface) {
$propertyPath = new PropertyPath($propertyPath);
} elseif (!$propertyPath instanceof PropertyPathInterface) {
throw new UnexpectedTypeException($propertyPath, 'string or Symfony\Component\PropertyAccess\PropertyPathInterface');
}

$propertyValues = & $this->readPropertiesUntil($objectOrArray, $propertyPath, $propertyPath->getLength() - 1);
Expand Down

0 comments on commit 9cacecb

Please sign in to comment.