8000 Add argument to PropertyAccess::createPropertyAccessor · symfony/symfony@e69c6bd · GitHub
[go: up one dir, main page]

Skip to content

Commit e69c6bd

Browse files
committed
Add argument to PropertyAccess::createPropertyAccessor
Remove extra arg on PropertyAccessBuilder
1 parent 052c314 commit e69c6bd

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/Symfony/Component/PropertyAccess/PropertyAccess.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,31 @@ final class PropertyAccess
2121
/**
2222
* Creates a property accessor with the default configuration.
2323
*
24+
* @param bool $throwExceptionOnInvalidIndex
25+
*
2426
* @return PropertyAccessor The new property accessor
2527
*/
26-
public static function createPropertyAccessor()
28+
public static function createPropertyAccessor($throwExceptionOnInvalidIndex = false)
2729
{
28-
return self::createPropertyAccessorBuilder()->getPropertyAccessor();
30+
return self::createPropertyAccessorBuilder($throwExceptionOnInvalidIndex)->getPropertyAccessor();
2931
}
3032

3133
/**
3234
* Creates a property accessor builder.
3335
*
36+
* @param bool $enableExceptionOnInvalidIndex
37+
*
3438
* @return PropertyAccessorBuilder The new property accessor builder
3539
*/
36-
public static function createPropertyAccessorBuilder()
40+
public static function createPropertyAccessorBuilder($enableExceptionOnInvalidIndex = false)
3741
{
38-
return new PropertyAccessorBuilder();
42+
$propertyAccessorBuilder = new PropertyAccessorBuilder();
43+
44+
if ($enableExceptionOnInvalidIndex) {
45+
$propertyAccessorBuilder->enableExceptionOnInvalidIndex();
46+
}
47+
48+
return $propertyAccessorBuilder;
3949
}
4050

4151
/**

0 commit comments

Comments
 (0)
0