Your project must not contain invalid PHP files 8

More information: https://insight.symfony.com/what-we-analyse/php.php_syntax_error

  1. /**
  2. * @param array<string, string|null> $parameters Parameter name => type (FQCN for class-typed named types, (string) $type for builtins/unions, null untyped).
  3. * @param string|null $returnType Declared return type, self/static/parent resolved to FQCN at extraction.
  4. */
  5. public function __construct(
  6. public readonly string $id,
    Syntax error, unexpected T_STRING, expecting T_VARIABLE
    Time to fix: about 15 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. public readonly array $parameters = [],
  8. public readonly ?string $returnType = null,
  9. public readonly bool $auto = false,
  10. ) {
  11. // .
  1. class AliasEntry extends Entry
  2. {
  3. /**
  4. * @param string $factory Registered id of the alias target.
  5. */
  6. public function __construct(string $id, public readonly string $factory, bool $auto = false)
    Syntax error, unexpected T_STRING, expecting T_VARIABLE
    Time to fix: about 15 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. {
  8. parent::__construct($id, [], null, $auto);
  9. }
  10. /**
  1. /**
  2. * @param string|object $factory Closure, function name, or invokable object.
  3. *
  4. * @throws InvalidArgumentException When the factory is not a supported callable shape or takes parameters by reference.
  5. */
  6. public function __construct(string $id, public readonly string|object $factory, bool $auto = false)
    Syntax error, unexpected T_STRING, expecting T_VARIABLE
    Time to fix: about 15 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. {
  8. if ($factory instanceof Closure) {
  9. $reflection = new ReflectionFunction($factory);
  10. } elseif (\is_object($factory)) {
  11. if (! \method_exists($factory, '__invoke')) {
  1. /**
  2. * @param string $factory class-string of an instantiable class (dispatch guarantees buildability; re-asserted defensively).
  3. *
  4. * @throws InvalidArgumentException When the class does not exist, is not instantiable, or its constructor takes parameters by reference.
  5. */
  6. public function __construct(string $id, public readonly string $factory, bool $auto = false)
    Syntax error, unexpected T_STRING, expecting T_VARIABLE
    Time to fix: about 15 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. {
  8. if (! \class_exists($factory) || ! (new ReflectionClass($factory))->isInstantiable()) {
  9. throw InvalidArgumentException::notInstantiable($id, $factory);
  10. }
  1. * An EntryFactory instance — the explicit door for registering an
  2. * object instance: `new EntryFactory(fn () => $instance)`.
  3. */
  4. class FactoryEntry extends Entry
  5. {
  6. public function __construct(string $id, public readonly EntryFactory $factory, bool $auto = false)
    Syntax error, unexpected T_STRING, expecting T_VARIABLE
    Time to fix: about 15 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. {
  8. [$parameters, $returnType] = self::extractMetadata(new ReflectionMethod($factory, 'create'));
  9. parent::__construct($id, $parameters, $returnType, $auto);
  10. }
  1. /**
  2. * @param string|array{class-string|object, string} $factory
  3. *
  4. * @throws InvalidArgumentException When the pair shape, class, method, or method visibility is invalid.
  5. */
  6. public function __construct(string $id, public readonly string|array $factory, bool $auto = false)
    Syntax error, unexpected T_STRING, expecting T_VARIABLE
    Time to fix: about 15 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. {
  8. if (\is_string($factory)) {
  9. if (! \str_contains($factory, '::')) {
  10. throw InvalidArgumentException::notClassMethodString($id, $factory);
  11. }
  1. * auto-entry replacement, and setEventDispatcher()); payloads are readonly —
  2. * listeners observe, they no longer mutate.
  3. */
  4. final class EntryRegistered
  5. {
  6. public function __construct(public readonly Entry $entry) {}
    Syntax error, unexpected T_STRING, expecting T_VARIABLE
    Time to fix: about 15 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. }
  1. * is not infrastructure (auto), not an alias, and the value is an object.
  2. */
  3. final class EntryResolved
  4. {
  5. public function __construct(
  6. public readonly string $id,
    Syntax error, unexpected T_STRING, expecting T_VARIABLE
    Time to fix: about 15 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Fery Wardiyanto
  7. public readonly object $instance,
  8. ) {}
  9. }