From a8252a43b823c44e4cc4fd8a1a21fc066a8cbe76 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 3 Jan 2021 12:55:43 +0100 Subject: [PATCH] remove unneeded sprintf() call --- src/Symfony/Component/PropertyAccess/PropertyAccessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index f23383a8d9..f38b9140e7 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -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); }