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
- if ($condition) {
- $instance = $condition($instance) ?: $instance;
- }
- return $this->resolver->handle($instance, $args);
- }
- /**
- * Extending an entry.
- *
- );
- }
- $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)
- );
- }
- $this->resolveArgs($ref, $args)
- );
- }
- return $ref->invokeArgs(
- $ref->isStatic() && ! \is_object($callable[0]) ? null : $callable[0],
- $this->resolveArgs($ref, $args)
- );
- } catch (UnresolvableArgumentException $err) {
- throw new Exception($err->getCaller() . '(): ' . $err->getMessage(), $err->getPrevious());
- }
Your project must not contain invalid instantiations 4
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_instantiation
- if (\is_string($callable) && \str_contains($callable, '::')) {
- $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)
- if (! $param->isOptional()) {
- throw new UnresolvableArgumentException(
- ++$position,
- $param->getName(),
- $err->getName(),
- $ref,
- $err
- );
- }
- $args[$position] = $param->getDefaultValue();