Your project must not contain invalid PHP files 8
- Read doc
- Reliability
- Critical
More information: https://insight.symfony.com/what-we-analyse/php.php_syntax_error
- /**
- * @param array<string, string|null> $parameters Parameter name => type (FQCN for class-typed named types, (string) $type for builtins/unions, null untyped).
- * @param string|null $returnType Declared return type, self/static/parent resolved to FQCN at extraction.
- */
- public function __construct(
- public readonly string $id,
- public readonly array $parameters = [],
- public readonly ?string $returnType = null,
- public readonly bool $auto = false,
- ) {
- // .
- class AliasEntry extends Entry
- {
- /**
- * @param string $factory Registered id of the alias target.
- */
- public function __construct(string $id, public readonly string $factory, bool $auto = false)
- {
- parent::__construct($id, [], null, $auto);
- }
- /**
- /**
- * @param string|object $factory Closure, function name, or invokable object.
- *
- * @throws InvalidArgumentException When the factory is not a supported callable shape or takes parameters by reference.
- */
- public function __construct(string $id, public readonly string|object $factory, bool $auto = false)
- {
- if ($factory instanceof Closure) {
- $reflection = new ReflectionFunction($factory);
- } elseif (\is_object($factory)) {
- if (! \method_exists($factory, '__invoke')) {
- /**
- * @param string $factory class-string of an instantiable class (dispatch guarantees buildability; re-asserted defensively).
- *
- * @throws InvalidArgumentException When the class does not exist, is not instantiable, or its constructor takes parameters by reference.
- */
- public function __construct(string $id, public readonly string $factory, bool $auto = false)
- {
- if (! \class_exists($factory) || ! (new ReflectionClass($factory))->isInstantiable()) {
- throw InvalidArgumentException::notInstantiable($id, $factory);
- }
- * An EntryFactory instance — the explicit door for registering an
- * object instance: `new EntryFactory(fn () => $instance)`.
- */
- class FactoryEntry extends Entry
- {
- public function __construct(string $id, public readonly EntryFactory $factory, bool $auto = false)
- {
- [$parameters, $returnType] = self::extractMetadata(new ReflectionMethod($factory, 'create'));
- parent::__construct($id, $parameters, $returnType, $auto);
- }
- /**
- * @param string|array{class-string|object, string} $factory
- *
- * @throws InvalidArgumentException When the pair shape, class, method, or method visibility is invalid.
- */
- public function __construct(string $id, public readonly string|array $factory, bool $auto = false)
- {
- if (\is_string($factory)) {
- if (! \str_contains($factory, '::')) {
- throw InvalidArgumentException::notClassMethodString($id, $factory);
- }
- * auto-entry replacement, and setEventDispatcher()); payloads are readonly —
- * listeners observe, they no longer mutate.
- */
- final class EntryRegistered
- {
- public function __construct(public readonly Entry $entry) {}
- }
- * is not infrastructure (auto), not an alias, and the value is an object.
- */
- final class EntryResolved
- {
- public function __construct(
- public readonly string $id,
- public readonly object $instance,
- ) {}
- }