Skip to content

Commit 941ec64

Browse files
authored
Recommend to always use exit() instead of exit
1 parent 7096729 commit 941ec64

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

spec.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,18 @@ $someInstance
766766
->run();
767767
```
768768

769+
The `exit()` and `die()` functions SHOULD always be called with parentheses even if no argument is given to clearly
770+
distinguish them from an access to a constant named `exit` or `die`. For example:
771+
772+
```php
773+
exit();
774+
exit(1);
775+
exit("Success!");
776+
die();
777+
778+
$result = foo() ?? exit();
779+
```
780+
769781
### 4.8 Function Callable References
770782

771783
A function or method may be referenced in a way that creates a closure out of it, by providing `...` in place of arguments.

0 commit comments

Comments
 (0)