Skip to content

bug: Fix array/object shape phpdoc type parse#6962

Merged
kubawerlos merged 6 commits intoPHP-CS-Fixer:masterfrom
mvorisek:fix_6959_phpdoc_shape_parse
May 18, 2023
Merged

bug: Fix array/object shape phpdoc type parse#6962
kubawerlos merged 6 commits intoPHP-CS-Fixer:masterfrom
mvorisek:fix_6959_phpdoc_shape_parse

Conversation

@mvorisek
Copy link
Copy Markdown
Contributor

@mvorisek mvorisek commented May 15, 2023

  • fix array shape parse with implicit key
  • fix array shape parse with no value (array{})
  • add support for object shapes
  • fix shape parsing when multiple colons are present (previously parsed by [^?:\h]+\h*\??\h*:\h*/.+?:\h*, now parsed by the actual grammar)

array shape key grammar: https://github.com/phpstan/phpdoc-parser/blob/1.20.4/doc/grammars/type.abnf#L70

@mvorisek mvorisek changed the title Fix array/object shape phpdoc type with implicit key parse bug: Fix array/object shape phpdoc type with implicit key parse May 15, 2023
@mvorisek mvorisek marked this pull request as draft May 15, 2023 08:37
@mvorisek mvorisek force-pushed the fix_6959_phpdoc_shape_parse branch from 372326a to 5e1bfbe Compare May 15, 2023 11:43
@mvorisek mvorisek changed the title bug: Fix array/object shape phpdoc type with implicit key parse bug: Fix array/object shape phpdoc type parse May 15, 2023
@mvorisek mvorisek force-pushed the fix_6959_phpdoc_shape_parse branch from 5e1bfbe to 8d4010a Compare May 15, 2023 11:48
@mvorisek mvorisek marked this pull request as ready for review May 15, 2023 11:54
@Wirone Wirone added kind/enhancement topic/phpdoc PHPDoc tags, Doctrine Annotations etc. labels May 15, 2023
@mvorisek mvorisek force-pushed the fix_6959_phpdoc_shape_parse branch from ef95f94 to cdb20e3 Compare May 15, 2023 12:58
@mvorisek mvorisek force-pushed the fix_6959_phpdoc_shape_parse branch from cdb20e3 to c1a61dd Compare May 15, 2023 14:09
Copy link
Copy Markdown
Member

@Wirone Wirone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I am not sure if I understand all changes in TypeExpression, but looking at test cases and applied fixes to the code base it looks like it works as it should, so 👍 from me. I won't merge it, though, I want to wait for other review as well.

@Wirone Wirone requested a review from kubawerlos May 18, 2023 12:09
@kubawerlos kubawerlos merged commit 234e98f into PHP-CS-Fixer:master May 18, 2023
@kubawerlos
Copy link
Copy Markdown
Member

Thank you @mvorisek 👍🏼

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

Labels

kind/enhancement topic/phpdoc PHPDoc tags, Doctrine Annotations etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants