minor #39694 [PropertyAccess] remove unneeded sprintf() call (xabbuh)

This PR was merged into the 4.4 branch.

Discussion
----------

[PropertyAccess] remove unneeded sprintf() call

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Commits
-------

a8252a43b8 remove unneeded sprintf() call
This commit is contained in:
Alexander M. Turek 2021-01-03 13:23:32 +01:00
commit 04671ee726

View File

@ -398,7 +398,7 @@ class PropertyAccessor implements PropertyAccessorInterface
if (__FILE__ === $trace['file']
&& $access[self::ACCESS_NAME] === $trace['function']
&& $object instanceof $trace['class']
&& preg_match((sprintf('/Return value (?:of .*::\w+\(\) )?must be of (?:the )?type (\w+), null returned$/')), $e->getMessage(), $matches)
&& preg_match('/Return value (?:of .*::\w+\(\) )?must be of (?:the )?type (\w+), null returned$/', $e->getMessage(), $matches)
) {
throw new AccessException(sprintf('The method "%s::%s()" returned "null", but expected type "%3$s". Did you forget to initialize a property or to make the return type nullable using "?%3$s"?', false === strpos(\get_class($object), "@anonymous\0") ? \get_class($object) : (get_parent_class($object) ?: 'class').'@anonymous', $access[self::ACCESS_NAME], $matches[1]), 0, $e);
}