Skip to content

GraphQL\Type\Definition\Deprecated constructor promotion fails PHP7.4 lints #1843

@justlevine

Description

@justlevine

Came across this very downstream (generating stubfiles for WPGraphQL.

Tl;dr: GraphQL\Type\Definition\Deprecated uses a public string as its arg, but Constructor Promotion is only available in PHP8+ (https://www.php.net/manual/en/language.oop5.decon.php).

I'm not sure how real this issue besides the failing downstream lint (https://github.com/AxeWP/wp-graphql-stubs/actions/runs/21398618877/job/61603298081). If it is real, the solution is simply to manually define the class prop and assign it in the constructor.

Also assumedly, setting PHPStan's phpversion with a minVersion: 70400 would prevent this sort of smell (PHP incompatibility with a version lower than the one CI is stanning) in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions