Rule Definition
A file should either declare symbol and cause no side effect or execute logic with side effects but not both.
Remediation
Separate symbols and execution of logic that will cause side effect.
Violation Code Sample
<?php
if (!defined(FOO)) {
die(1);
}
class Foo {
public function __construct() {
}
}
?>
Reference
https://pear.php.net/package/PHP_CodeSniffer/docs/2.5.0/PHP_CodeSniffer/PSR1_Sniffs_Files_SideEffectsSniff.html
Related Technologies
Technical Criterion
Programming Practices - Unexpected Behavior
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.