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
- throw new Container\Exception(
- \sprintf('Cannot extending a non-object or a callable entry of "%s"', $id)
- );
- }
- $extended = $this->make($callback, [$entry]);
- if (! \is_a($extended, $class = \get_class($entry))) {
- throw new Container\Exception(
- \sprintf('Argument #2 callback must be returns of type "%s"', $class)
- );
- if ($callback) {
- $instance = $callback($instance) ?: $instance;
- }
- return $this->resolver->handle($instance, $args);
- }
- /**
- * Extending an entry.
- *
- if (\is_object($entry) && ! \is_callable($entry)) {
- return $entry;
- }
- return $this->handledEntries[$id] = $this->resolver->handle($entry);
- }
- /**
- * Determine whether the **entry** is registered.
- *
- // Otherwise convert it to closure.
- $callable = \Closure::fromCallable($callable);
- }
- $ref = $this->createCallableReflection($callable);
- $caller = $ref->getName();
- /** @var array{object|null, TArgs} */
- $params = [];
- ? \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;
- }
Your project must not contain invalid instantiations
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_instantiation
- if (! \is_array($callable)) {
- return new \ReflectionFunction($callable);
- }
- try {
- $ref = new \ReflectionMethod($callable[0], $callable[1]);
- } catch (\ReflectionException $err) {
- throw new InvalidArgumentException($err->getMessage(), $err->getCode(), $err);
- }
- // If trying to statically call a non-static method (at least on PHP 7.x)