Your project must not contain invalid function or method calls 3

More information: https://insight.symfony.com/what-we-analyse/php.invalid_call

in src/Container.php, line 122
  1. $this->factories[$id] = \is_object($factory) && ! ($factory instanceof \Closure)
  2. ? \get_class($factory)
  3. : $factory;
  4. $entry = $this->resolver->resolve($this->factories[$id]);
    Parameter #1 $entry of method Projek\Container\Resolver::resolve() expects (callable(): mixed)|object|string, mixed given.
    Last edited by Fery Wardiyanto
  5. if (\is_object($entry) && $this->isInjectable($entry)) {
  6. $entry->setContainer($this);
  7. }
  1. // Otherwise convert it to closure.
  2. $entry = \Closure::fromCallable($entry);
  3. }
  4. $ref = $this->createCallableReflection($entry);
    Parameter #1 $callable of method Projek\Container\Resolver::createCallableReflection() expects callable(): mixed, mixed given.
    Last edited by Fery Wardiyanto
  5. $caller = $ref->getName();
  6. /** @var list<object|string|null> */
  7. $params = [];
  1. }
  2. try {
  3. $params[] = $this->resolveArgs($ref, $args);
  4. return $ref->invokeArgs(...$params);
    Parameter #1 $args|object of method ReflectionFunction::invokeArgs() expects array|object|null, mixed given.
    Last edited by Fery Wardiyanto
  5. } catch (Exception $err) {
  6. throw new Exception($caller . '(): ' . $err->getMessage(), $err->getPrevious());
  7. }
  8. }

Your project should not use invalid return types 3

More information: https://insight.symfony.com/what-we-analyse/php.invalid_return_typehint

in src/Container.php, line 194
  1. if ($callback) {
  2. $instance = $callback($instance) ?: $instance;
  3. }
  4. return $this->resolver->handle($instance, $args);
    Method Projek\Container::make() should return object but returns mixed.
    Last edited by Fery Wardiyanto
  5. }
  6. /**
  7. * Extending an entry.
  8. *
  1. * When $className is not instantiable or its constructor depends on non-exists container entry.
  2. */
  3. private function createInstance(string $className, array $args = []): object
  4. {
  5. if ($this->container->has($className)) {
  6. return $this->container->get($className);
    Method Projek\Container\Resolver::createInstance() should return object but returns mixed.
    Last edited by Fery Wardiyanto
  7. }
  8. if (! \class_exists($className)) {
  9. throw new Exception(
  10. \sprintf('Cannot resolve an entry or class named "%s" of non-exists', $className)
  1. $args[$position] = $param->getDefaultValue();
  2. }
  3. }
  4. return $args;
    Method Projek\Container\Resolver::resolveArgs() should return list<mixed> but returns array<int, mixed>.
    Last edited by Fery Wardiyanto
  5. }
  6. /**
  7. * @param \ReflectionParameter $param
  8. * @return string

Your project must not contain invalid instantiations 3

More information: https://insight.symfony.com/what-we-analyse/php.invalid_instantiation

  1. /** @var array<string> */
  2. $callable = \explode('::', $callable);
  3. }
  4. if (! \is_array($callable)) {
  5. return new \ReflectionFunction($callable);
    Parameter #1 $function of class ReflectionFunction constructor expects Closure|string, callable(): mixed given.
    Last edited by Fery Wardiyanto
  6. }
  7. try {
  8. $ref = new \ReflectionMethod($callable[0], $callable[1]);
  9. } catch (\ReflectionException $err) {
  1. if (! \is_array($callable)) {
  2. return new \ReflectionFunction($callable);
  3. }
  4. try {
  5. $ref = new \ReflectionMethod($callable[0], $callable[1]);
    Parameter #1 $objectOrMethod of class ReflectionMethod constructor expects object|string, mixed given.
    Last edited by Fery Wardiyanto
  6. } catch (\ReflectionException $err) {
  7. throw new InvalidArgumentException($err->getMessage(), $err->getCode(), $err);
  8. }
  9. // If trying to statically call a non-static method (at least on PHP 7.x)
  1. if (! \is_array($callable)) {
  2. return new \ReflectionFunction($callable);
  3. }
  4. try {
  5. $ref = new \ReflectionMethod($callable[0], $callable[1]);
    Parameter #2 $method of class ReflectionMethod constructor expects string, mixed given.
    Last edited by Fery Wardiyanto
  6. } catch (\ReflectionException $err) {
  7. throw new InvalidArgumentException($err->getMessage(), $err->getCode(), $err);
  8. }
  9. // If trying to statically call a non-static method (at least on PHP 7.x)