Add syntax for subtraction type by rvanvelzen · Pull Request #240 · phpstan/phpdoc-parser · GitHub
Skip to content

Add syntax for subtraction type#240

Draft
rvanvelzen wants to merge 1 commit intophpstan:1.23.xfrom
rvanvelzen:subtraction-type
Draft

Add syntax for subtraction type#240
rvanvelzen wants to merge 1 commit intophpstan:1.23.xfrom
rvanvelzen:subtraction-type

Conversation

@rvanvelzen
Copy link
Copy Markdown
Contributor

This is a preliminary syntax implementation for subtraction type syntax.

Merging now isn't necessary because the work in phpstan-src is far from done. Any feedback is still appreciated though.

@ondrejmirtes
Copy link
Copy Markdown
Member

),
],
[
'string~int~float',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One non-parentheised expression should not allow more than one ~ to prevent associativity ambiguity as not standartized not needed.

As you can see, currently float is even missing in the parsed type.

Copy link
Copy Markdown
Contributor

@mvorisek mvorisek Sep 8, 2024

Choose a reason for hiding this comment

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

These cases should be tested:

  • A|B~C (expected A|(B~C))
  • A~B|C (expected (A~B)|C)
  • A&B~C (expected syntax error?)
  • A~B&C (expected syntax error?)

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.

3 participants