Skip to content

Commit d34e77a

Browse files
authoredJan 29, 2025
Merge pull request #109 from TimWolla/patch-1
Recommend to always use `exit()` instead of `exit`
2 parents ddd8d9c + 941ec64 commit d34e77a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
 

‎spec.md

+12
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,18 @@ $someInstance
824824
->run();
825825
```
826826

827+
The `exit()` and `die()` functions SHOULD always be called with parentheses even if no argument is given to clearly
828+
distinguish them from an access to a constant named `exit` or `die`. For example:
829+
830+
```php
831+
exit();
832+
exit(1);
833+
exit("Success!");
834+
die();
835+
836+
$result = foo() ?? exit();
837+
```
838+
827839
### 4.8 Function Callable References
828840

829841
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)