Skip to content
6.1
Switch branches/tags
Code

Latest commit

…` mutation support to PhpDocExtractor (raphaelvoisin)

This PR was merged into the 6.1 branch.

Discussion
----------

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

| Q             | A
| ------------- | ---
| Branch?       | 6.1 <!-- see below -->
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       |  <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        |  <!-- required for new features -->

By definition, PHP 8 promoted properties are declared in the constructor. Therefore, a new particular case raises when trying to extract (using [PhpDocExtractor](https://github.com/symfony/symfony/blob/6.1/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php)) 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](https://github.com/symfony/symfony/blob/6.1/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php) as well to reflect the new priorities ?

Commits
-------

92b0da1 [PropertyInfo] Add PHP 8.0 promoted properties ``@param`` mutation support to `PhpDocExtractor`
1df76df

Files

Permalink
Failed to load latest commit information.

Symfony is a PHP framework for web and console applications and a set of reusable PHP components. Symfony is used by thousands of web applications and most of the popular PHP projects.

Installation

Sponsor

Symfony 6.1 is backed by basecom.

As a professional software service provider, basecom implements customized solutions in the areas of e-commerce, PIM solutions and web portals. With our experience and certified expertise, we have been one of the most renowned Symfony specialists in Germany for many years.

Help Symfony by sponsoring its development!

Documentation

Community

Contributing

Symfony is an Open Source, community-driven project with thousands of contributors. Join them contributing code or contributing documentation.

Security Issues

If you discover a security vulnerability within Symfony, please follow our disclosure procedure.

About Us

Symfony development is led by the Symfony Core Team and supported by Symfony contributors.