Your project must not contain invalid instantiations 4
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_instantiation
- // 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),
- // 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).
- $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)
- // 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)