Skip to content

Allow main asymmetric visibility to be omitted#3

Open
rhydb wants to merge 1 commit into
phpactor:mainfrom
rhydb:asym-omit-main
Open

Allow main asymmetric visibility to be omitted#3
rhydb wants to merge 1 commit into
phpactor:mainfrom
rhydb:asym-omit-main

Conversation

@rhydb
Copy link
Copy Markdown

@rhydb rhydb commented May 8, 2026

Some places to check for these tokens were missed in c6c5c98, which meant that the main visibility could not be omitted. This PR adds them to the list of modifiers, and to the allowed start tokens of member declarations and parameters.

As the test outputs show, they are added to the setVisibilityToken for parameters, and to modifiers for everything else. They have not been added to the explicit modifiers for traits, enums, or interface members. If the main visibility is omitted, it isn't added to the output - is this ok?

I have not tested the LSP, but this should hopefully fix phpactor/phpactor#2959 as the tokens are now picked up.

@rhydb
Copy link
Copy Markdown
Author

rhydb commented May 8, 2026

I noticed that existing tests in ParserGrammarTest.php fail because of the new "setVisibilityToken": null. These tests (anything that has "visibilityToken": ...) just need to add this to their expected output. I guess this should be done separately.

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.

Asymmetric visiblity error when main visibility is omitted

1 participant