You are here

function test17 in Coder 8.2

Same name in this branch
  1. 8.2 coder_sniffer/Drupal/Test/Commenting/FunctionCommentUnitTest.inc \test17()
  2. 8.2 coder_sniffer/Drupal/Test/bad/bad.php \test17()
  3. 8.2 coder_sniffer/Drupal/Test/good/good.php \test17()
Same name and namespace in other branches
  1. 8.3 tests/Drupal/Commenting/FunctionCommentUnitTest.inc \test17()
  2. 8.3 tests/Drupal/bad/bad.php \test17()
  3. 7.2 coder_sniffer/Test/bad/bad.php \test17()
  4. 8.3.x tests/Drupal/Commenting/FunctionCommentUnitTest.inc \test17()
  5. 8.3.x tests/Drupal/bad/bad.php \test17()

Return with optional null and function with some void returns.

When a function has an optional null as a return value then it should not result in an error when there is a void return in the function.

Parameters

string $arg: An argument.

Return value

int|null Return has an optional null.

File

coder_sniffer/Drupal/Test/good/good.php, line 1431
This file contains all the valid notations for the drupal coding standard.

Code

function test17($arg) {
  if ($arg === 1) {
    return;
  }
  return 1;
}