Your project must not contain invalid function or method calls
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_call
- // Recreate the factory closure against the clone; rebinding
- // keeps any captured value (the ctor-provided dispatcher)
- // while re-pointing the captured container.
- $this->entries[$id] = new CallableEntry(
- $id,
- Closure::bind($entry->factory, $this, self::class),
- auto: true,
- );
- }
- }
- }
Your project must not contain invalid instantiations 2
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_instantiation
- // without them the closing `});` line can never be marked covered.
- $this->entries[$id] = (match (true) {
- // Invokable shapes first — the is_object guard is load-bearing: a class-string naming
- // an invokable class must fall through to the ClassName arm (build, never invoke).
- FactoryEntry::isValid($factory) => new FactoryEntry($id, $factory),
- CallableEntry::isValid($factory) => new CallableEntry($id, $factory),
- ClassNameEntry::isValid($factory) => new ClassNameEntry($id, $factory),
- MethodPairEntry::isValid($factory) => new MethodPairEntry($id, $factory),
- // any other string — incl. non-buildable type symbols (interface, trait, abstract
- // class, enum): must name a pre-registered entry (the typo catcher).
- \is_string($factory) => $this->has($factory)
- // Invokable shapes first — the is_object guard is load-bearing: a class-string naming
- // an invokable class must fall through to the ClassName arm (build, never invoke).
- FactoryEntry::isValid($factory) => new FactoryEntry($id, $factory),
- CallableEntry::isValid($factory) => new CallableEntry($id, $factory),
- ClassNameEntry::isValid($factory) => new ClassNameEntry($id, $factory),
- MethodPairEntry::isValid($factory) => new MethodPairEntry($id, $factory),
- // any other string — incl. non-buildable type symbols (interface, trait, abstract
- // class, enum): must name a pre-registered entry (the typo catcher).
- \is_string($factory) => $this->has($factory)
- ? new AliasEntry($id, $factory)
- : throw InvalidArgumentException::unresolvableString($id, $factory),
Your project should not use invalid parameter and return typehints
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_typehint
- }
- /**
- * A string "Class::method" or array pair "[class, method]" factory.
- */
- public static function invalidMethodPair(string $id, string|array $factory): static
- {
- if (is_array($factory)) {
- $class = var_export($factory[0] ?? null, true);
- $method = var_export($factory[1] ?? null, true);
- $factory = "[$class, $method]";