Loading core/lib/Drupal/Core/Utility/CallableResolver.php +3 −1 Changes for core/lib/Drupal/Core/Utility/CallableResolver.php: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -66,7 +66,9 @@ public function getCallableFromDefinition(callable|array|string $definition): ca } if (is_array($definition)) { throw new \InvalidArgumentException(sprintf('The callable definition provided "[%s]" is not a valid callable.', implode(",", $definition))); // The definition can contain an object, for example [$object, 'method']. $parts = array_map(static fn ($part) => is_scalar($part) ? (string) $part : get_debug_type($part), $definition); throw new \InvalidArgumentException(sprintf('The callable definition provided "[%s]" is not a valid callable.', implode(",", $parts))); } if (!is_string($definition)) { Loading core/tests/Drupal/Tests/Core/Utility/CallableResolverTest.php +5 Changes for core/tests/Drupal/Tests/Core/Utility/CallableResolverTest.php: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -137,6 +137,11 @@ public static function callableResolverExceptionHandlingTestCases(): array { \InvalidArgumentException::class, 'The callable definition provided "[stdClass,method_not_exists]" is not a valid callable.', ], 'Missing method on object, array notation' => [ [new \stdClass(), 'method_not_exists'], \InvalidArgumentException::class, 'The callable definition provided "[stdClass,method_not_exists]" is not a valid callable.', ], 'Missing method on class, static notation' => [ \stdClass::class . '::method_not_exists', \InvalidArgumentException::class, Loading Loading
core/lib/Drupal/Core/Utility/CallableResolver.php +3 −1 Changes for core/lib/Drupal/Core/Utility/CallableResolver.php: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -66,7 +66,9 @@ public function getCallableFromDefinition(callable|array|string $definition): ca } if (is_array($definition)) { throw new \InvalidArgumentException(sprintf('The callable definition provided "[%s]" is not a valid callable.', implode(",", $definition))); // The definition can contain an object, for example [$object, 'method']. $parts = array_map(static fn ($part) => is_scalar($part) ? (string) $part : get_debug_type($part), $definition); throw new \InvalidArgumentException(sprintf('The callable definition provided "[%s]" is not a valid callable.', implode(",", $parts))); } if (!is_string($definition)) { Loading
core/tests/Drupal/Tests/Core/Utility/CallableResolverTest.php +5 Changes for core/tests/Drupal/Tests/Core/Utility/CallableResolverTest.php: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -137,6 +137,11 @@ public static function callableResolverExceptionHandlingTestCases(): array { \InvalidArgumentException::class, 'The callable definition provided "[stdClass,method_not_exists]" is not a valid callable.', ], 'Missing method on object, array notation' => [ [new \stdClass(), 'method_not_exists'], \InvalidArgumentException::class, 'The callable definition provided "[stdClass,method_not_exists]" is not a valid callable.', ], 'Missing method on class, static notation' => [ \stdClass::class . '::method_not_exists', \InvalidArgumentException::class, Loading