Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[PropertyInfo] PhpStanTypeHelper doesn't support ConstTypeNode #44491

Copy link
Copy link
Closed
@ostrolucky

Description

@ostrolucky
Issue body actions

Description

After updating from Symfony 5.3 to Symfony 5.4, our code started to crash. This is because new PhpStanExtractor was introduced that was prioritized above older extractors. This extractor started to return null type and hence serializer failed to denormalize our objects.

It returns null, because this is a UnionTypeNode containing ConstTypeNode and IdentifierTypeNode (null). However PhpStanTypeHelper doesn't handle ConstTypeNode and hence symfony/property-info will return null only.

Example

class Foo
{
   /**
     * @return PageType::*|null
     */
    public function getDynamicPageType(): ?string
    {
        return rand(0, 1) ? PageType::FOO : null;
    }
}

class PageType {
    const FOO = 'foo';
}

On Symfony 5.3, this returns string|null. On Symfony 5.4, because PhpStanExtractor was added which doesn't correctly handle unions, it returns null.

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.