Your project must not contain invalid function or method calls

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

in src/Container.php, line 133
  1. // Recreate the factory closure against the clone; rebinding
  2. // keeps any captured value (the ctor-provided dispatcher)
  3. // while re-pointing the captured container.
  4. $this->entries[$id] = new CallableEntry(
  5. $id,
  6. Closure::bind($entry->factory, $this, self::class),
    Parameter #1 $closure of static method Closure::bind() expects Closure, callable-string|object given.
    Time to fix: about 9 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. auto: true,
  8. );
  9. }
  10. }
  11. }

Your project must not contain invalid instantiations 2

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

in src/Container.php, line 315
  1. // without them the closing `});` line can never be marked covered.
  2. $this->entries[$id] = (match (true) {
  3. // Invokable shapes first — the is_object guard is load-bearing: a class-string naming
  4. // an invokable class must fall through to the ClassName arm (build, never invoke).
  5. FactoryEntry::isValid($factory) => new FactoryEntry($id, $factory),
  6. CallableEntry::isValid($factory) => new CallableEntry($id, $factory),
    Parameter #2 $factory of class Projek\Container\Entry\CallableEntry constructor expects callable-string|object, callable(): mixed given.
    Last edited by Fery Wardiyanto
  7. ClassNameEntry::isValid($factory) => new ClassNameEntry($id, $factory),
  8. MethodPairEntry::isValid($factory) => new MethodPairEntry($id, $factory),
  9. // any other string — incl. non-buildable type symbols (interface, trait, abstract
  10. // class, enum): must name a pre-registered entry (the typo catcher).
  11. \is_string($factory) => $this->has($factory)
in src/Container.php, line 317
  1. // Invokable shapes first — the is_object guard is load-bearing: a class-string naming
  2. // an invokable class must fall through to the ClassName arm (build, never invoke).
  3. FactoryEntry::isValid($factory) => new FactoryEntry($id, $factory),
  4. CallableEntry::isValid($factory) => new CallableEntry($id, $factory),
  5. ClassNameEntry::isValid($factory) => new ClassNameEntry($id, $factory),
  6. MethodPairEntry::isValid($factory) => new MethodPairEntry($id, $factory),
    Parameter #2 $factory of class Projek\Container\Entry\MethodPairEntry constructor expects array{class-string<T of object>|T of object, non-empty-string}|non-empty-string, array{class-string<T of object>|(T of object&T of object), string}|string given.
    Last edited by Fery Wardiyanto
  7. // any other string — incl. non-buildable type symbols (interface, trait, abstract
  8. // class, enum): must name a pre-registered entry (the typo catcher).
  9. \is_string($factory) => $this->has($factory)
  10. ? new AliasEntry($id, $factory)
  11. : throw InvalidArgumentException::unresolvableString($id, $factory),

Your project should not use invalid parameter and return typehints 5

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

  1. *
  2. * @phpstan-assert-if-true Closure|callable-string|callable $factory
  3. *
  4. * @psalm-assert-if-true Closure|callable-string|callable $factory
  5. */
  6. public static function isValid(mixed $factory): bool
    Template type T of method Projek\Container\Entry\CallableEntry::isValid() is not referenced in a parameter.
    Time to fix: about 9 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. {
  8. return $factory instanceof Closure
  9. || (\is_object($factory) && \method_exists($factory, '__invoke'))
  10. || (\is_string($factory) && \function_exists($factory));
  11. }
  1. *
  2. * @phpstan-assert-if-true class-string<T> $factory
  3. *
  4. * @psalm-assert-if-true class-string<T> $factory
  5. */
  6. public static function isValid(mixed $factory): bool
    Template type T of method Projek\Container\Entry\ClassNameEntry::isValid() is not referenced in a parameter.
    Time to fix: about 9 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. {
  8. return \is_string($factory) && \class_exists($factory)
  9. && (new ReflectionClass($factory))->isInstantiable();
  10. }
  1. *
  2. * @phpstan-assert-if-true EntryFactory $factory
  3. *
  4. * @psalm-assert-if-true EntryFactory $factory
  5. */
  6. public static function isValid(mixed $factory): bool
    Template type T of method Projek\Container\Entry\FactoryEntry::isValid() is not referenced in a parameter.
    Time to fix: about 9 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. {
  8. return $factory instanceof EntryFactory;
  9. }
  10. /**
  1. *
  2. * @phpstan-assert-if-true string|array{class-string<T>|T, string} $factory
  3. *
  4. * @psalm-assert-if-true string|array{class-string<T>|T, string} $factory
  5. */
  6. public static function isValid(mixed $factory): bool
    Template type T of method Projek\Container\Entry\MethodPairEntry::isValid() is not referenced in a parameter.
    Time to fix: about 9 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. {
  8. return (\is_string($factory) && \str_contains($factory, '::'))
  9. || (\is_array($factory) && count($factory) === 2);
  10. }
  1. }
  2. /**
  3. * A string "Class::method" or array pair "[class, method]" factory.
  4. */
  5. public static function invalidMethodPair(string $id, string|array $factory): static
    Method Projek\Container\InvalidArgumentException::invalidMethodPair() has parameter $factory with no value type specified in iterable type array.
    Time to fix: about 9 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  6. {
  7. if (is_array($factory)) {
  8. $class = var_export($factory[0] ?? null, true);
  9. $method = var_export($factory[1] ?? null, true);
  10. $factory = "[$class, $method]";