Skip to content

[PropertyInfo] PhpStanExtractor parsing failure #61301

@Seldaek

Description

@Seldaek

Symfony version(s) affected

7.3.2

Description

I get this while running my tests after upgrading to 7.3, and I have no idea why/where this even comes from sorry for the lack of details:

[PHPStan\\PhpDocParser\\Parser\\ParserException] Unexpected token \":\", expected '}' at offset 67 on line 1","code":0,"line":310,"file":"vendor/phpstan/phpdoc-parser/src/Parser/TokenIterator.php","exception":{}},"thrown_at":"vendor/phpstan/phpdoc-parser/src/Parser/TokenIterator.php:310"

It seems to originate from symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php then PropertyInfoLoader::getPropertyTypes from validator and then PropertyInfoExtractor::getType..

How to reproduce

I was able to pinpoint it to this property, but I had to debug the code to even find where the error was happening, the current error reporting is really not very user friendly 😅 Having the class/file/... affected would be very helpful.

/**
  * @phpstan-type NotificationResource array{key_id: int, app_id?: int, subscription_id?: int, resource_id: ''|numeric-string|int, active: bool, contents: string, schedule: string, timezone: string, creation_dt: int}
 */
class Foo {
    /**
     * @var array<NotificationResource>
     */
    public array $resources = [];
}

Not sure what exactly trips it up, but I guess something in the type alias maybe the literal string '' isn't supported yet?

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions