DEVSENSE / phptools-docs

PHP Tools public content
Apache License 2.0
80 stars 10 forks source link

Formatting does not remove closing ?> tag #370

Open murugappanrm opened 1 year ago

murugappanrm commented 1 year ago

PHP Tools version: 1.36.13517.

When saving a php script the closing ?> tag is not removed if present in a pure PHP file. This is trivial but it need to be fixed to ensure compliance.

Miloslav commented 9 months ago

Thank you for the suggestions.

It appears you're right and PSR-2 is saying:

The closing ?> tag MUST be omitted from files containing only PHP.

I'm not sure if formatter itself should do this, or other component. Anyway we will take a look at it.

Thanks!

murugappanrm commented 9 months ago

@Miloslav hi,

Thank you for responding. This is not a big issue but helps prevents us forgetting to comply. With regards to where this fix should be done, I can quite definitely say it has to be done in Devsense PHP extension as I can confirm that this is the only extension I am using for formatting. I do use other extensions but they are for snippets only and they do not do formatting.

Miloslav commented 9 months ago

Hi,

We've added a diagnostic warning and code action for this one in the latest version. Please check it out.

Thanks again for the suggestion.

murugappanrm commented 9 months ago

@Miloslav Hi,

Thank you for the update. Solution works and acceptable. The PHP Intelephense extension works auto. I mean i do not have to worry about the closing as it auto removes if there is no code below the closing tag.

I love all the improvements especially the one on auto-completing for Server parameters and Globals. I always had trouble with that. one. Thank you.