File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed
src/Symfony/Component/PropertyAccess Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -40,10 +40,8 @@ public function __construct($magicCall = false)
40
40
*/
41
41
public function getValue ($ objectOrArray , $ propertyPath )
42
42
{
43
- if (is_string ( $ propertyPath) ) {
43
+ if (! $ propertyPath instanceof PropertyPathInterface ) {
44
44
$ propertyPath = new PropertyPath ($ propertyPath );
45
- } elseif (!$ propertyPath instanceof PropertyPathInterface) {
46
- throw new UnexpectedTypeException ($ propertyPath , 'string or Symfony\Component\PropertyAccess\PropertyPathInterface ' );
47
45
}
48
46
49
47
$ propertyValues = & $ this ->readPropertiesUntil ($ objectOrArray , $ propertyPath , $ propertyPath ->getLength ());
@@ -56,10 +54,8 @@ public function getValue($objectOrArray, $propertyPath)
56
54
*/
57
55
public function setValue (&$ objectOrArray , $ propertyPath , $ value )
58
56
{
59
- if (is_string ( $ propertyPath) ) {
57
+ if (! $ propertyPath instanceof PropertyPathInterface ) {
60
58
$ propertyPath = new PropertyPath ($ propertyPath );
61
- } elseif (!$ propertyPath instanceof PropertyPathInterface) {
62
- throw new UnexpectedTypeException ($ propertyPath , 'string or Symfony\Component\PropertyAccess\PropertyPathInterface ' );
63
59
}
64
60
65
61
$ propertyValues = & $ this ->readPropertiesUntil ($ objectOrArray , $ propertyPath , $ propertyPath ->getLength () - 1 );
You can’t perform that action at this time.
0 commit comments