Description
I'd like to have a bitmask argument in the PropertyAccessor constructor. Currently, it's hard to understand on the first sight what each argument means while initializing PropertyAccessor. I know that PropertyAccessor intended not to be used in the application code, but it doesn't prevent to use it anyway.
Related issue #30536
Example
Before:
new PropertyAccessor(
$magicCall = false,
$throwExceptionOnInvalidIndex = false,
$cacheItemPool = null,
$throwExceptionOnInvalidPropertyPath = false
);
After:
new PropertyAccessor(
$magicCall = false,
$throwExceptionBitmask = 0,
$cacheItemPool = null
);
- To throw an exception on the invalid index:
new PropertyAccessor(
$magicCall = false,
$throwExceptionBitmask = PropertyAccessor::THROW_EXCEPTION_ON_INVALID_INDEX, /* THROW_EXCEPTION_ON_INVALID_INDEX = 1 */
$cacheItemPool = null
);
- To throw an exception on the invalid property path:
new PropertyAccessor(
$magicCall = false,
$throwExceptionBitmask = PropertyAccessor::THROW_EXCEPTION_ON_INVALID_PROPERTY_PATH, /* THROW_EXCEPTION_ON_INVALID_PROPERTY_PATH = 2 */
$cacheItemPool = null
);