Skip to content
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

Non-internal functions formatting #160

Open
PrinceOfAbyss opened this issue Jan 6, 2025 · 2 comments
Open

Non-internal functions formatting #160

PrinceOfAbyss opened this issue Jan 6, 2025 · 2 comments

Comments

@PrinceOfAbyss
Copy link

Suppose a piece of code (mixed HTML + PHP) like this:

<h1 class="wp-heading-inline"><?php echo esc_html( get_admin_page_title() ); ?></h1>
Notice this space char -----------------------------------------------------------------⬏

If you are familiar with Wordpress, there are functions that echo the value they produce automatically...

So the code below escapes and echoes the title all in one neat function:

<option selected="selected" value=""><?php esc_html_e( 'Select attribute', 'woodmart-child' );?></option>
Notice there is no space char though -----------------------------------------------------------------------⬏

As you notice though, phpfmt, obviously because esc_html_e() isn't a built-in function, fails to format the code correctly, and so it doesn't add a space after ; and before ?>

driade added a commit to driade/phpfmt8 that referenced this issue Jan 8, 2025
@driade
Copy link

driade commented Jan 8, 2025

Hi @PrinceOfAbyss let's see if the latest release works driade/phpfmt8@e24b9fa

@PrinceOfAbyss
Copy link
Author

This worked like a charm! Thank you very much!

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

No branches or pull requests

2 participants