File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -183,6 +183,38 @@ interface ExampleDomainAccessInterface
183183}
184184```
185185
186+ ### Parenthesis
187+
188+ Never use double parenthesis like '((/* something * /))'
189+
190+ ``` php
191+ # Valid
192+ $firstCondition = true;
193+ $secondCondition = false;
194+
195+ // Simple condition
196+ if ($firstCondition) {
197+ // Do something
198+ }
199+
200+ // Example with Coalescing operator
201+ trim((string) ($data[0]['address'] ?? ''));
202+
203+ // Adding parenthesis is accepted if there is an operator between operand
204+ if (($firstCondition) && ($secondCondition)) {
205+ // Do something
206+ }
207+
208+ # Invalid
209+ // Simple condition
210+ if (($firstCondition)) {
211+ // Do something
212+ }
213+
214+ // Example with Coalescing operator
215+ trim(($data[0]['address'] ?? null));
216+ ```
217+
186218### Passing object by reference
187219Objects are always passed by reference. Using '&' to request to pass it by reference can be confusing
188220
You can’t perform that action at this time.
0 commit comments