Your project must not contain invalid function or method calls 3
- 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);
- }
- // Otherwise convert it to closure.
- $entry = \Closure::fromCallable($entry);
- }
- $ref = $this->createCallableReflection($entry);
- $caller = $ref->getName();
- /** @var list<object|string|null> */
- $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 ($callback) {
- $instance = $callback($instance) ?: $instance;
- }
- return $this->resolver->handle($instance, $args);
- }
- /**
- * Extending an entry.
- *
- * When $className is not instantiable or its constructor depends on non-exists container entry.
- */
- private function createInstance(string $className, array $args = []): object
- {
- if ($this->container->has($className)) {
- return $this->container->get($className);
- }
- if (! \class_exists($className)) {
- throw new Exception(
- \sprintf('Cannot resolve an entry or class named "%s" of non-exists', $className)
- $args[$position] = $param->getDefaultValue();
- }
- }
- return $args;
- }
- /**
- * @param \ReflectionParameter $param
- * @return string
Your project must not contain invalid instantiations 3
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_instantiation
- /** @var array<string> */
- $callable = \explode('::', $callable);
- }
- if (! \is_array($callable)) {
- return new \ReflectionFunction($callable);
- }
- try {
- $ref = new \ReflectionMethod($callable[0], $callable[1]);
- } catch (\ReflectionException $err) {
- 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)
- 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)