Your project must not contain invalid function or method calls 2
- 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,
- );
- }
- }
- }
- }
- [$class, $method] = \explode('::', $factory, 2);
- } else {
- if (\count($factory) !== 2) {
- throw InvalidArgumentException::invalidMethodPair($id, $factory);
- }
- [$class, $method] = [$factory[0], $factory[1]];
- }
Your project must not contain invalid instantiations 4
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_instantiation
- // statement's begin line when a paren group survives to the `;` —
- // 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).
- // 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)
- $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)
- ? new AliasEntry($id, $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),