function test1 in Coder 8.3
Same name in this branch
Same name and namespace in other branches
- 8.2 coder_sniffer/DrupalPractice/Test/good/good.php \test1()
- 8.2 coder_sniffer/Drupal/Test/Commenting/DocCommentStarUnitTest.inc \test1()
- 8.2 coder_sniffer/Drupal/Test/Commenting/FunctionCommentUnitTest.inc \test1()
- 8.2 coder_sniffer/Drupal/Test/bad/bad.php \test1()
- 8.2 coder_sniffer/Drupal/Test/good/good.php \test1()
- 7.2 coder_sniffer/Test/bad/bad.php \test1()
- 7.2 coder_sniffer/Test/good/good.php \test1()
- 8.3.x tests/DrupalPractice/good/good.php \test1()
- 8.3.x tests/Drupal/Commenting/DocCommentStarUnitTest.inc \test1()
- 8.3.x tests/Drupal/Commenting/FunctionCommentUnitTest.inc \test1()
- 8.3.x tests/Drupal/bad/bad.php \test1()
Ignoring the array value in a foreach loop is OK.
File
- tests/
DrupalPractice/ good/ good.php, line 28
Code
function test1() {
$array = array(
1,
2,
);
foreach ($array as $key => $value) {
print $key;
}
try {
print 'foo';
} catch (Exception $e) {
// $e is unused here, which is fine.
print 'error';
}
// Initializing an array on the fly is allowed.
$items['foo'] = 'bar';
return $items;
}