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

PHP Formatting: No space between 'AND !$var'. #4635

Closed
NotherGithubAccount opened this issue Sep 14, 2022 · 3 comments · Fixed by #4741
Closed

PHP Formatting: No space between 'AND !$var'. #4635

NotherGithubAccount opened this issue Sep 14, 2022 · 3 comments · Fixed by #4741
Assignees
Labels
kind:bug Bug report or fix PHP [ci] enable extra PHP tests (php/php.editor)
Milestone

Comments

@NotherGithubAccount
Copy link

Apache NetBeans version

Apache NetBeans 15 release candidate

What happened

if ($a AND !$b) formats to if ($a AND!$b). It works correctly with &&, the behavior is the same with OR and ||.

When checking the "Unary Operator" box in Tools -> Options -> Editor -> Formatting for PHP and spaces, the result is
($a AND ! $b)
While that works as advertised, imho there should always be a space after AND/OR.

How to reproduce

Create corresponding test code and select source->format.

Did this work correctly in an earlier version?

No / Don't know

Operating System

Debian 11 5.18.0-0.deb11.4-amd64

JDK

OpenJDK Runtime Environment (build 11.0.16+8-post-Debian-1deb11u1)

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

Afaik, always.

Are you willing to submit a pull request?

No

Code of Conduct

Yes

@NotherGithubAccount NotherGithubAccount added kind:bug Bug report or fix needs:triage Requires attention from one of the committers labels Sep 14, 2022
@mbien mbien added the PHP [ci] enable extra PHP tests (php/php.editor) label Sep 15, 2022
@junichi11
Copy link
Member

Reproducible. Thanks!

@junichi11 junichi11 self-assigned this Oct 6, 2022
@junichi11 junichi11 removed the needs:triage Requires attention from one of the committers label Oct 6, 2022
@junichi11 junichi11 added this to the NB16 milestone Oct 6, 2022
junichi11 added a commit to junichi11/netbeans that referenced this issue Oct 6, 2022
…che#4635

- `WHITESPACE_BEFORE_BINARY_OP` and `WHITESPACE_AFTER_BINARY_OP` are added to `&&` and `||`
- There is the problem if we add them to `AND`, `OR`, and `XOR`
- See: https://bz.apache.org/netbeans/show_bug.cgi?id=240274
- e.g. if they are false, `copy($old,$new) or die("error");` -> `copy($old,$new) ordie("error");`
- Instead, add always `WHITESPACE_AROUND_TEXTUAL_OP` as a new token
junichi11 added a commit to junichi11/netbeans that referenced this issue Oct 6, 2022
…che#4635

- `WHITESPACE_BEFORE_BINARY_OP` and `WHITESPACE_AFTER_BINARY_OP` are added to `&&` and `||`
- There is the problem if we add them to `AND`, `OR`, and `XOR`
- See: https://bz.apache.org/netbeans/show_bug.cgi?id=240274
- e.g. if they are false, `copy($old,$new) or die("error");` -> `copy($old,$new) ordie("error");`
- Instead, add `WHITESPACE_AROUND_TEXTUAL_OP` as a new token
junichi11 added a commit to junichi11/netbeans that referenced this issue Oct 6, 2022
…he#4635

- `WHITESPACE_BEFORE_BINARY_OP` and `WHITESPACE_AFTER_BINARY_OP` are added to `&&` and `||`
- There is the problem if we add them to `AND`, `OR`, and `XOR`
- See: https://bz.apache.org/netbeans/show_bug.cgi?id=240274
- e.g. if they are false, `copy($old,$new) or die("error");` -> `copy($old,$new) ordie("error");`
- Instead, add `WHITESPACE_AROUND_TEXTUAL_OP` as a new token
tmysik added a commit that referenced this issue Oct 7, 2022
…l-operators

Fix the formatting for the textual operators(`AND`, `OR`, `XOR`) #4635
@NotherGithubAccount
Copy link
Author

Thanks for the quick fix!

@junichi11
Copy link
Member

You are welcome :)

Chris2011 pushed a commit to Chris2011/netbeans that referenced this issue Dec 15, 2022
…he#4635

- `WHITESPACE_BEFORE_BINARY_OP` and `WHITESPACE_AFTER_BINARY_OP` are added to `&&` and `||`
- There is the problem if we add them to `AND`, `OR`, and `XOR`
- See: https://bz.apache.org/netbeans/show_bug.cgi?id=240274
- e.g. if they are false, `copy($old,$new) or die("error");` -> `copy($old,$new) ordie("error");`
- Instead, add `WHITESPACE_AROUND_TEXTUAL_OP` as a new token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Bug report or fix PHP [ci] enable extra PHP tests (php/php.editor)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants