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

Spaces under brackets are not fixed for if statements #66

Closed
umpirsky opened this issue May 27, 2012 · 3 comments
Closed

Spaces under brackets are not fixed for if statements #66

umpirsky opened this issue May 27, 2012 · 3 comments

Comments

@umpirsky
Copy link
Contributor

controls_spaces fixer does not handle cases like this:

Original: if( $test ){
Fixed: if ( $test ) {
Expected: if ($test) {

I experimented a bit and managed to fix this issue, but I have some weird case when it does not work.

Works for if ($this->tesT ($test)) {
Does not work for: if ($this->testtesT ($test)) {

Since I'm not a regex guru, this is a call for regex ninjas to take a look at my fix and help me finish it, or suggest new solution. I'm opened for all suggestions. Thanks in advance.

@ghost
Copy link

ghost commented Jun 16, 2012

See umpirsky#1

@umpirsky
Copy link
Contributor Author

PR ready thanks to Mr @MHeleniak.

fabpot added a commit that referenced this issue Jun 18, 2012
Commits
-------

00d5366 cosmetics
9bd0f30 fixed regexp in ControlSpacesFixer
ed5ffe0 Fix spaces under brackets for if statements.

Discussion
----------

Control spaces under brackets

Fixes spaces under brackets descrbed in [issue #66](https://github.com/fabpot/PHP-CS-Fixer/issues/66)

Example:

`if( $test ){` -> `if ($test) {`
@umpirsky
Copy link
Contributor Author

PR is merged, closing.

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

1 participant