Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
primogenial
/
languages
/
wp-content
/
themes
/
storefront
/
vendor
/
squizlabs
/
php_codesniffer
/
src
/
Standards
/
Generic
/
Tests
/
CodeAnalysis
:
EmptyPHPStatementUnitTest.inc.fixed
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php /* * Test empty statement: two consecutive semi-colons without executable code between them. */ function_call(); // OK. // The below examples are all bad. function_call(); function_call(); function_call(); /* some comment */ function_call(); /* some comment */ ?> <input name="<?php something_else(); ?>" /> <input name="<?php something_else(); ?>" /> /* * Test empty statement: no code between PHP open and close tag. */ <input name="<?php something_else() ?>" /> <!-- OK. --> <input name="<?php something_else(); ?>" /> <!-- OK. --> <input name="<?php /* comment */ ?>" /> <!-- OK. --> <input name="" /> <!-- Bad. --> <input name="" /> <!-- Bad. --> <!-- /* * Test detecting & fixing a combination of the two above checks. */ --> <input name="" /> <!-- Bad. --> <!-- Tests with short open echo tag. --> <input name="<?= 'some text' ?>" /> <!-- OK. --> <input name="" /> <!-- Bad. --> <input name="" /> <!-- Bad. --> <?php // Guard against false positives for two consecutive semi-colons in a for statement. for ( $i = 0; ; $i++ ) {} // Test for useless semi-colons for ( $i = 0; ; $i++ ) {} if (true) {} while (true) {} class ABC {} switch ( $a ) { case 1: break; case 2: break; default: break; } // Do not break closures and anonymous classes and curlies without scope owners. $a = function () {}; $b = new class {}; echo $a{0}; if ($foo) { } // Do not remove semicolon after match $c = match ($a) { 1 => true, };