Your project should not use invalid return types
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_return_typehint
- if (\is_array($entry) && \is_string($entry[0])) {
- $entry[0] = $this->resolve($entry[0], $args);
- }
- if (\is_object($entry) || \is_callable($entry)) {
- return $entry;
- }
- throw new InvalidArgumentException(
- \sprintf('Cannot resolve invalid entry of "%s"', \gettype($entry))
- );
Your project should not use invalid parameter and return typehints
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_typehint
- * @param array<int, mixed> $args
- * @return callable
- * @throws Exception
- * @throws InvalidArgumentException
- */
- public function resolve(array|callable|object|string $entry, array $args = [])
- {
- if (\is_string($entry) && ! \function_exists($entry)) {
- $entry = \str_contains($entry, '::')
- ? \explode('::', $entry)
- : $this->createInstance($entry, $args);
Your project must not contain invalid function or method calls
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_call
- if ($condition) {
- $instance = $condition($instance) ?: $instance;
- }
- return $this->resolver->handle($instance, $args);
- }
- /**
- * Extending an entry.
- *