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.
- *
- * @param string $message
- * @param \Throwable|null $prev
- */
- public function __construct(string $message, ?\Throwable $prev = null)
- {
- parent::__construct($message, $prev?->getCode() ?: 0, $prev);
- }
- }
- $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 should not use invalid return types 2
- 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);
- }
- return $entry;
- }
- /**
- * Handle callable.
- *
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();
Your project should not contain unused code 4
- Read doc
- Productivity
- Minor
More information: https://insight.symfony.com/what-we-analyse/php.unused_local_variable_or_private_member
- * @param string $name
- * @param string $entry
- * @param \Throwable|null $prev
- */
- public function __construct(
- private int $position,
- private string $name,
- private string $entry,
- private ReflectionFunction|ReflectionMethod $ref,
- ?\Throwable $prev = null,
- ) {
- * @param string $entry
- * @param \Throwable|null $prev
- */
- public function __construct(
- private int $position,
- private string $name,
- private string $entry,
- private ReflectionFunction|ReflectionMethod $ref,
- ?\Throwable $prev = null,
- ) {
- $this->caller = $ref instanceof ReflectionMethod
- * @param \Throwable|null $prev
- */
- public function __construct(
- private int $position,
- private string $name,
- private string $entry,
- private ReflectionFunction|ReflectionMethod $ref,
- ?\Throwable $prev = null,
- ) {
- $this->caller = $ref instanceof ReflectionMethod
- ? $ref->getDeclaringClass()->getName() . '::' . $ref->getName()
- */
- public function __construct(
- private int $position,
- private string $name,
- private string $entry,
- private ReflectionFunction|ReflectionMethod $ref,
- ?\Throwable $prev = null,
- ) {
- $this->caller = $ref instanceof ReflectionMethod
- ? $ref->getDeclaringClass()->getName() . '::' . $ref->getName()
- : $ref->getName();