Your project must not contain invalid function or method calls 7

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

in src/Container.php, line 88
  1. if (\is_object($entry) && ! \is_callable($entry)) {
  2. return $entry;
  3. }
  4. return $this->handledEntries[$id] = $this->resolver->handle($entry);
    Parameter #1 $callable of method Projek\Container\Resolver<(callable)|list<object|string>|string,list<mixed>>::handle() expects array{class-string|object, string}|(callable(): mixed)|string, mixed given.
    Last edited by Fery Wardiyanto
  5. }
  6. /**
  7. * Determine whether the **entry** is registered.
  8. *
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<(callable)|list<object|string>|string,list<mixed>>::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. }
in src/Container.php, line 194
  1. if ($callback) {
  2. $instance = $callback($instance) ?: $instance;
  3. }
  4. return $this->resolver->handle($instance, $args);
    Parameter #1 $callable of method Projek\Container\Resolver<(callable)|list<object|string>|string,list<mixed>>::handle() expects array{class-string|object, string}|(callable(): mixed)|string, mixed given.
    Last edited by Fery Wardiyanto
  5. }
  6. /**
  7. * Extending an entry.
  8. *
  1. public function resolve($entry, array $args = [])
  2. {
  3. if (\is_string($entry) && ! \function_exists($entry)) {
  4. $entry = \str_contains($entry, '::')
  5. ? \explode('::', $entry)
  6. : $this->createInstance($entry, $args);
    Parameter #2 $args of method Projek\Container\Resolver<TCallable of (callable)|list<object|string>|string,TArgs of list<mixed>>::createInstance() expects TArgs of list<mixed>, list<mixed> given.
    Last edited by Fery Wardiyanto
  7. }
  8. if (\is_array($entry) && \is_string($entry[0])) {
  9. $entry[0] = $this->resolve($entry[0], $args);
  10. }
  1. // Otherwise convert it to closure.
  2. $callable = \Closure::fromCallable($callable);
  3. }
  4. $ref = $this->createCallableReflection($callable);
    Parameter #1 $callable of method Projek\Container\Resolver<TCallable of (callable)|list<object|string>|string,TArgs of list<mixed>>::createCallableReflection() expects TCallable of array{class-string|object, string}|(callable(): mixed)|string, (Closure(): mixed)|(TCallable of array{class-string|object, string}|(callable(): mixed)|string) given.
    Last edited by Fery Wardiyanto
  5. $caller = $ref->getName();
  6. /** @var array{object|null, TArgs} */
  7. $params = [];
  1. }
  2. try {
  3. $params[] = $this->resolveArgs($ref, $args);
  4. return $ref->invokeArgs(...$params);
    Method ReflectionFunction::invokeArgs() invoked with 3 parameters, 1-2 required.
    Last edited by Fery Wardiyanto
  5. } catch (Exception $err) {
  6. throw new Exception($caller . '(): ' . $err->getMessage(), $err->getPrevious());
  7. }
  8. }
  1. );
  2. }
  3. try {
  4. $args = ($constructor = $ref->getConstructor())
  5. ? $this->resolveArgs($constructor, $ref->hasMethod('__invoke') ? [] : $args)
    Parameter #2 $args of method Projek\Container\Resolver<TCallable of (callable)|list<object|string>|string,TArgs of list<mixed>>::resolveArgs() expects TArgs of list<mixed>, list<mixed> given.
    Last edited by Fery Wardiyanto
  6. : [];
  7. return $ref->newInstanceArgs($args);
  8. } catch (Exception $err) {
  9. throw new Exception($className . '::__construct(): ' . $err->getMessage(), $err->getPrevious());

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 TArgs of list<mixed> but returns array<int, mixed>.
    Last edited by Fery Wardiyanto
  5. }
  6. }

Your project must not contain invalid instantiations 3

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

  1. /** @var array{class-string, 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, TCallable of (callable(): mixed)|string 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 #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)
  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)