Your project must not contain invalid instantiations 2

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

  1. {
  2. if ($args === []) {
  3. return $this->resolver->resolveInstance($class);
  4. }
  5. $reflection = new ReflectionClass($class);
    Parameter #1 $objectOrClass of class ReflectionClass constructor expects class-string<T of object>|T of object, string given.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  6. if (! $reflection->isInstantiable()) {
  7. throw UnresolvableCallableException::notInstantiable($class);
  8. }
in src/Container.php, line 319
  1. // trait, abstract class, enum): must name a pre-registered entry
  2. // (the typo catcher).
  3. \is_string($factory) => $this->has($factory)
  4. ? new AliasEntry($id, $factory)
  5. : throw InvalidArgumentException::unresolvableString($id, $factory),
  6. \is_array($factory) => new MethodPairEntry($id, $factory), // pair validation in its ctor
    Parameter #2 $factory of class Projek\Container\Entry\MethodPairEntry constructor expects array{class-string|object, string}|string, array<mixed, mixed> given.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. // Plain objects only; invokables matched the arm above.
  8. // (\is_object, not `instanceof object` — the latter always
  9. // evaluates false: `object` is parsed as a class name.)
  10. \is_object($factory) => throw InvalidArgumentException::plainObjectNotAFactory($id, $factory),
  11. // Invalid factory of type %s.

Your project must not contain invalid function or method calls 4

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

  1. * @throws UnresolvableCallableException When the class is not instantiable (defensive).
  2. */
  3. private function instantiate(string $class, array $args): object
  4. {
  5. if ($args === []) {
  6. return $this->resolver->resolveInstance($class);
    Unable to resolve the template type T in call to method Projek\Callable\ResolverInterface::resolveInstance()
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. }
  8. $reflection = new ReflectionClass($class);
  9. if (! $reflection->isInstantiable()) {
  1. * @throws UnresolvableCallableException When the class is not instantiable (defensive).
  2. */
  3. private function instantiate(string $class, array $args): object
  4. {
  5. if ($args === []) {
  6. return $this->resolver->resolveInstance($class);
    Parameter #1 $entry of method Projek\Callable\ResolverInterface::resolveInstance() expects class-string<object>, string given.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. }
  8. $reflection = new ReflectionClass($class);
  9. if (! $reflection->isInstantiable()) {
in src/Container.php, line 131
  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, object|string given.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. auto: true,
  8. );
  9. }
  10. }
  11. }
in src/Container.php, line 428
  1. default => false,
  2. });
  3. if ($shape) {
  4. return $this->injectContainer(
  5. $this->getHandler()->handle($instance, $args)
    Parameter #1 $callable of method Projek\Callable\Handler::handle() expects array{class-string<object>|object, string}|(callable(): mixed)|object|string, array|(callable(): mixed)|object|string given.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  6. );
  7. }
  8. // Thrown from inside the boundary: the InvalidArgumentException
  9. // passes it untouched — the boundary never wraps a user-facing InvalidArgumentException.

Your project should not use invalid return types 2

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

in src/Container.php, line 183
  1. * Retrieve the effective service resolver — a singleton resolved through
  2. * the normal path, so a user override flows automatically.
  3. */
  4. final public function getResolver(): ResolverInterface
  5. {
  6. return $this->get(ResolverInterface::class);
    Method Projek\Container::getResolver() should return Projek\Callable\ResolverInterface but returns mixed.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. }
  8. /**
  9. * Resolve a registered entry, building and caching it on first use.
  10. *
in src/Container.php, line 146
  1. * When no implementation is provided by the developer, a minimalist
  2. * internal implementation is built lazily on first use.
  3. */
  4. final public function getEventDispatcher(): EventDispatcherInterface
  5. {
  6. return $this->get(EventDispatcherInterface::class);
    Method Projek\Container::getEventDispatcher() should return Psr\EventDispatcher\EventDispatcherInterface but returns mixed.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. }
  8. /**
  9. * Assign a PSR-14 event dispatcher implementation.
  10. *

Your project should not use invalid parameter and return typehints

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

in src/Container.php, line 351
  1. * @param array<mixed> $args Positional/named arguments for the invocation or constructor.
  2. *
  3. * @throws InvalidArgumentException If the input matches no family.
  4. * @throws ResolutionException If a package call fails to resolve.
  5. */
  6. public function make(array|callable|object|string $instance, array $args = []): mixed
    Method Projek\Container::make() has parameter $instance with no value type specified in iterable type array.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. {
  8. try {
  9. // A registered id wins even when it also looks like a
  10. // class or a function.
  11. if (\is_string($instance) && $this->entries->offsetExists($instance)) {

Your project is using a unnecessary isset call 2

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

  1. throw InvalidArgumentException::notClassMethodString($id, $factory);
  2. }
  3. [$class, $method] = \explode('::', $factory, 2);
  4. } else {
  5. if (\count($factory) !== 2 || ! isset($factory[0], $factory[1])) {
    Offset 1 on array{class-string|object, string} in isset() always exists and is not nullable.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  6. throw InvalidArgumentException::invalidPairSize($id);
  7. }
  8. [$class, $method] = [$factory[0], $factory[1]];
  9. }
  1. throw InvalidArgumentException::notClassMethodString($id, $factory);
  2. }
  3. [$class, $method] = \explode('::', $factory, 2);
  4. } else {
  5. if (\count($factory) !== 2 || ! isset($factory[0], $factory[1])) {
    Offset 0 on array{class-string|object, string} in isset() always exists and is not nullable.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  6. throw InvalidArgumentException::invalidPairSize($id);
  7. }
  8. [$class, $method] = [$factory[0], $factory[1]];
  9. }