Skip to content

Commit 67dc734

Browse files
committed
feat: add logical_operators as a required rule
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent 8e06808 commit 67dc734

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## 1.5.0 - UNRELEASED
5+
### Notes
6+
The `logical_operators` rule is considered risky as operators `and` and `&&`
7+
have different precedence and in rare cases the logic of existing code could change.
8+
So to run run this new version of the configuration, you need to adjust your composer scripts like this:
9+
10+
```diff
11+
- "cs:check": "php-cs-fixer fix --dry-run --diff",
12+
+ "cs:check": "php-cs-fixer fix --dry-run --allow-risky yes --diff",
13+
"cs:fix": "php-cs-fixer fix",
14+
```
15+
16+
### Added
17+
- `logical_operators`: Disallow `and` and `or` operator in favor of `&&` and `||`.
18+
419
## 1.4.0 — 2025-07-19
520
### Added
621
* `no_whitespace_in_blank_line`: Remove trailing whitespace at the end of blank lines

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
}
2424
},
2525
"scripts": {
26-
"cs:check": "php-cs-fixer fix --dry-run --diff",
26+
"cs:check": "php-cs-fixer fix --dry-run --allow-risky yes --diff",
2727
"cs:fix": "php-cs-fixer fix",
2828
"lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l"
2929
}

src/Config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function getRules() : array {
4141
'indentation_type' => true,
4242
'line_ending' => true,
4343
'list_syntax' => true,
44+
'logical_operators' => true,
4445
'lowercase_cast' => true,
4546
'lowercase_keywords' => true,
4647
'method_argument_space' => [

0 commit comments

Comments
 (0)