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

PEAR ScopeClosingBrace sniff does not work with mixed HTML/PHP #644

Closed
powelski opened this issue Jul 19, 2015 · 2 comments
Closed

PEAR ScopeClosingBrace sniff does not work with mixed HTML/PHP #644

powelski opened this issue Jul 19, 2015 · 2 comments

Comments

@powelski
Copy link

I'm getting an error when I use a mix of PHP alternative syntax and endforeach, like this:

<ul>
    <?php foreach ($array as $value) : ?>
        <li><?php echo $value ?></li>
    <?php endforeach ?>
</ul>

The error message is Closing brace must be on a line by itself and it points out the line with endforeach. It disappears when I delete indentation of this line.

@gsherwood
Copy link
Member

It's not the alternate syntax that causes this (it happens with standard syntax as well) but rather the mixing of PHP and HTML like you would in a template file. The built-in standards that PHPCS has don't work very well with template files because they were written for standard include files.

But in this case, I think I can get the sniff to ignore this syntax without affecting anything else.

@gsherwood gsherwood changed the title "Closing brace must be on a line by itself" vs. alternative syntax PEAR ScopeClosingBrace sniff does not work with mixed HTML/PHP Jul 21, 2015
@gsherwood
Copy link
Member

I've made this sniff support mixed HMTL/PHP syntax now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants