These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
0 ignored issues
–
show
|
|||
2 | /** |
||
3 | * A test class for running all PHP_CodeSniffer unit tests. |
||
4 | * |
||
5 | * PHP version 5 |
||
6 | * |
||
7 | * @category PHP |
||
8 | * @package PHP_CodeSniffer |
||
9 | * @author Greg Sherwood <[email protected]> |
||
10 | * @author Marc McIntyre <[email protected]> |
||
11 | * @copyright 2006-2012 Squiz Pty Ltd (ABN 77 084 670 600) |
||
12 | * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence |
||
13 | * @link http://pear.php.net/package/PHP_CodeSniffer |
||
14 | */ |
||
15 | |||
16 | if (defined('PHP_CODESNIFFER_IN_TESTS') === false) { |
||
17 | define('PHP_CODESNIFFER_IN_TESTS', true); |
||
18 | } |
||
19 | |||
20 | define('FULL_PATH', realpath(__DIR__.'/..')); |
||
21 | define('STANDARDS_PATH', FULL_PATH); |
||
22 | define('STANDARD_NAME', 'CodingStandard'); |
||
23 | |||
24 | $vendorPath = FULL_PATH.'/vendor'; |
||
25 | |||
26 | if (is_dir($vendorPath) === false) { |
||
27 | echo 'Install dependencies first'.PHP_EOL; |
||
28 | exit(1); |
||
29 | } |
||
30 | |||
31 | require_once $vendorPath.'/autoload.php'; |
||
32 | require_once __DIR__.'/AbstractSniffUnitTest.php'; |
||
33 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.