Skip to content

[PropertyInfo] Add PHP 8.0 promoted properties @param mutation support to PhpDocExtractor #45062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

raphaelvoisin
Copy link
Contributor

Q A
Branch? 6.1
Bug fix? no
New feature? yes
Deprecations? no
Tickets
License MIT
Doc PR

By definition, PHP 8 promoted properties are declared in the constructor. Therefore, a new particular case raises when trying to extract (using PhpDocExtractor) a promoted property that is mutated via @param in the constructor.

class Php80Dummy {
    /**
     * @param string $promotedAndMutatedProperty
     */
    public function __construct(private mixed $promotedAndMutatedProperty)
    {
    }
}

$promotedAndMutatedProperty extracted types is currently [null] (because of "mixed"), but IMO should be [string].

However, I'm not sure if this is the intended behaviour for everyone (opinions welcomed). If it is, I guess I should update PhpDocExtractorTest as well to reflect the new priorities ?

@nicolas-grekas nicolas-grekas force-pushed the propertyinfo_phpdoc_promoted_props branch from 4eb266a to 92b0da1 Compare March 6, 2022 11:37
@nicolas-grekas
Copy link
Member

Thank you @raphaelvoisin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants