Your project must not contain invalid function or method calls 5
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_call
- $this->factories[$id] = \is_object($factory) && ! ($factory instanceof Closure)
- ? \get_class($factory)
- : $factory;
- $entry = $this->resolver->resolve($this->factories[$id]);
- if (\is_object($entry) && $this->isInjectable($entry)) {
- $entry->setContainer($this);
- }
- if ($condition) {
- $instance = $condition($instance) ?: $instance;
- }
- return $this->resolver->handle($instance, $args);
- }
- /**
- * Extending an entry.
- *
- ? \explode('::', $entry)
- : $this->createInstance($entry, $args);
- }
- if (\is_array($entry) && \is_string($entry[0])) {
- $entry[0] = $this->resolve($entry[0], $args);
- }
- if (\is_object($entry) || \is_callable($entry)) {
- return $entry;
- }
- // Otherwise convert it to closure.
- $callable = Closure::fromCallable($callable);
- }
- $ref = $this->createCallableReflection($callable);
- $caller = $ref->getName();
- /** @var array{object|null, TArgs} */
- $params = [];
- }
- try {
- $params[] = $this->resolveArgs($ref, $args);
- return $ref->invokeArgs(...$params);
- } catch (Exception $err) {
- throw new Exception($caller . '(): ' . $err->getMessage(), $err->getPrevious());
- }
- }
Your project should not use invalid return types 3
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_return_typehint
- if ($condition) {
- $instance = $condition($instance) ?: $instance;
- }
- return $this->resolver->handle($instance, $args);
- }
- /**
- * Extending an entry.
- *
- 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))
- );
- $args[$position] = $param->getDefaultValue();
- }
- }
- return $args;
- }
- }