I've searched for this but it is a difficult issue to concisely search.
I believe in strict language requirements and error/warning reporting.
I run PHP with All and Strict error reporting enabled. If a error or warning is generated, I fix the issue. I don't juggle the error reporting level to "hide" the message.
I want single-statement inline clauses to be flagged. For example, I want a warning, say something like:
"Single-statement inline if clause"
issued for the following:
if ($userLoggedIn === false) return; // If the user is not logged in, return to caller.
or it could be:
if ($userLoggedIn === false) // If the user is not logged in
return; // return to the caller
I want any none-braced clauses reported.
I want PHP to tell me when there is an instance like the above instead of the following:
If ($userLoggedIn === false) { // If the user is not logged in
return; // return to the caller.
}
Is there anyway to tell PHP to warn of this sort of coding?
I doubt there is, but I thought I'd go ahead and ask.