Skip to content

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