1.2.827. No Parenthesis For Language Construct¶
Some PHP language constructs, such are include
, require
, include_once
, require_once
, print
, echo
don’t need parenthesis. They accept parenthesis, but it is may lead to strange situations.
It it better to avoid using parenthesis with echo
, print
, return
, throw
, yield
, yield from
, include
, require
, include_once
, require_once
.
<?php
// This is an attempt to load 'foo.inc', or kill the script
include('foo.inc') or die();
// in fact, this is read by PHP as : include 1
// include 'foo.inc' or die();
?>
See also ON PHP LANGUAGE CONSTRUCTS AND PARENTHESES and include.
1.2.827.1. Connex PHP features¶
1.2.827.1.1. Suggestions¶
Remove parenthesis
1.2.827.1.2. Specs¶
Short name |
Structures/NoParenthesisForLanguageConstruct |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
ClearPHP |
|
Examples |
|
Available in |