Your project must not contain invalid instantiations 3
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_instantiation
- if (isset($this->handledEntries[$id])) {
- return $this->handledEntries[$id];
- }
- $this->dispatch($instance = new Container\Events\AfterResolution(
- $this->entries[$id],
- $id,
- ));
- $entry = $instance->entry;
- $this->factories[$id] = \is_object($factory) && ! ($factory instanceof Closure)
- ? \get_class($factory)
- : $factory;
- $this->dispatch($reg = new Container\Events\BeforeRegistration(
- $this->factories[$id],
- $id,
- ));
- $this->entries[$id] = $this->resolver->resolve($reg->factory);
- if (isset($this->handledEntries[$id])) {
- unset($this->handledEntries[$id]);
- }
- $this->dispatch(new Container\Events\AfterRegistration(
- $this->entries[$id],
- $id,
- ));
- return $this;
- }
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
- $this->dispatch($reg = new Container\Events\BeforeRegistration(
- $this->factories[$id],
- $id,
- ));
- $this->entries[$id] = $this->resolver->resolve($reg->factory);
- if (isset($this->handledEntries[$id])) {
- unset($this->handledEntries[$id]);
- }
Your project should not use invalid parameter and return typehints 3
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_typehint
- {
- /**
- * @param array{class-string<object>|string,string}|callable|object|string $entry
- * @param string $id
- */
- public function __construct(
- public array|object|string $entry,
- public string $id,
- ) {
- // .
- }
- {
- /**
- * @param array{class-string<object>|string,string}|callable|object|string $factory
- * @param string $id
- */
- public function __construct(
- public array|object|string $factory,
- public string $id,
- ) {
- // .
- }
- /**
- * @package Projek\Container
- */
- final class AfterRegistration
- {
- public function __construct(
- /** @var callable|object $entry */
- public array|object|string $entry,
- public string $id,
- ) {
- // .