Skip to content

Comments

feat: add support for property access in conditional types#293

Open
brambaud wants to merge 1 commit intophpstan:2.3.xfrom
brambaud:issue/phpstan-src-7545/conditional-return-type-support-this
Open

feat: add support for property access in conditional types#293
brambaud wants to merge 1 commit intophpstan:2.3.xfrom
brambaud:issue/phpstan-src-7545/conditional-return-type-support-this

Conversation

@brambaud
Copy link

See phpstan/phpstan#7545

From what I understood, we first need phpdoc-parser to be able to parse things like @return ($this->t is T::A ? string : null) and then we'll need follow-up PR to phpstan/phpstan-src.

It also supports parent::$value, self::$value and static::$value because I thought it would be better to be consistent. If this is too much I understand.

@brambaud brambaud force-pushed the issue/phpstan-src-7545/conditional-return-type-support-this branch from 68cf874 to d229ea7 Compare February 20, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant