Skip to content

Started reworking expression strings into Expression objects #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: 6.x
Choose a base branch
from

Conversation

mvriel
Copy link
Member

@mvriel mvriel commented Dec 9, 2022

Values of constants, named arguments, etc, should be parsed to include types and FQSENs that can be used in phpDocumentor to display links with. Since these are now simple strings, I have refactored this into a template string system with placeholder values that a consumer could replace with its own values.

TODO:

  • Finish all tests
  • Verify all expressions are converted
  • Write more tests
  • Check if there are more types, other than Name, that should be converted. Like identifier?

@mvriel
Copy link
Member Author

mvriel commented Dec 12, 2022

As part of checking whether everything works as expected I am adding
integration tests, and find out that the pretty printer can be a bit
greedy. This is exemplified in the ConstructorPromotionTest where I want
to pass a reference to a local class constant, but the ExpressionPrinter
picks up on the class reference and does not resolve it.

This is a major issue, and more work is needed to

a) parse the whole FQSEN and use that
b) find out how to resolve references, such as self

Another test is needed to see if it resolves relative references as
well, as the Standard PrettyPrinter code gives me the idea it does not.

mvriel added 9 commits June 8, 2025 21:00
Values of constants, named arguments, etc, should be parsed to include
types and FQSENs that can be used in phpDocumentor to display links
with. Since these are now simple strings, I have refactored this into a
template string system with placeholder values that a consumer could
replace with its own values.
The conversion from PHP-Parser's node to an Expression needs to take
into account whether the provided parser is an Expression parser or the
usual Standard parser.

If it is an ExpressionParser, we can create a real Expression out of it
As part of checking whether everything works as expected I am adding
integration tests, and find out that the pretty printer can be a bit
greedy. This is exemplified in the ConstructorPromotionTest where I want
to pass a reference to a local class constant, but the ExpressionPrinter
picks up on the class reference and does not resolve it.

This is a major issue, and more work is needed to

a) parse the whole FQSEN and use that
b) find out how to resolve references, such as self

Another test is needed to see if it resolves relative references as
well, as the Standard PrettyPrinter code gives me the idea it does not.
@jaapio jaapio force-pushed the feature/expressions-in-arguments branch from d39c047 to d74bc26 Compare June 8, 2025 20:47
@jaapio jaapio changed the base branch from 5.x to 6.x June 8, 2025 20:48
@jaapio jaapio force-pushed the feature/expressions-in-arguments branch from d74bc26 to 2675d07 Compare June 8, 2025 21:31
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.

2 participants