You are here

function test2 in Coder 8.3.x

Same name in this branch
  1. 8.3.x tests/DrupalPractice/CodeAnalysis/VariableAnalysisUnitTest.inc \test2()
  2. 8.3.x tests/DrupalPractice/good/good.php \test2()
  3. 8.3.x tests/Drupal/Commenting/DocCommentStarUnitTest.inc \test2()
  4. 8.3.x tests/Drupal/Commenting/InlineCommentUnitTest.inc \test2()
  5. 8.3.x tests/Drupal/Commenting/FunctionCommentUnitTest.inc \test2()
  6. 8.3.x tests/Drupal/WhiteSpace/ScopeClosingBraceUnitTest.inc \test2()
  7. 8.3.x tests/Drupal/bad/bad.php \test2()
  8. 8.3.x tests/DrupalPractice/Objects/drupal8/example.module \test2()
Same name and namespace in other branches
  1. 8.3 tests/DrupalPractice/CodeAnalysis/VariableAnalysisUnitTest.inc \test2()
  2. 8.3 tests/DrupalPractice/good/good.php \test2()
  3. 8.3 tests/Drupal/Commenting/DocCommentStarUnitTest.inc \test2()
  4. 8.3 tests/Drupal/Commenting/InlineCommentUnitTest.inc \test2()
  5. 8.3 tests/Drupal/Commenting/FunctionCommentUnitTest.inc \test2()
  6. 8.3 tests/Drupal/WhiteSpace/ScopeClosingBraceUnitTest.inc \test2()
  7. 8.3 tests/Drupal/bad/bad.php \test2()
  8. 8.3 tests/DrupalPractice/Objects/drupal8/example.module \test2()
  9. 8.2 coder_sniffer/DrupalPractice/Test/CodeAnalysis/VariableAnalysisUnitTest.inc \test2()
  10. 8.2 coder_sniffer/DrupalPractice/Test/good/good.php \test2()
  11. 8.2 coder_sniffer/Drupal/Test/Commenting/DocCommentStarUnitTest.inc \test2()
  12. 8.2 coder_sniffer/Drupal/Test/Commenting/FunctionCommentUnitTest.inc \test2()
  13. 8.2 coder_sniffer/Drupal/Test/bad/bad.php \test2()
  14. 8.2 coder_sniffer/Drupal/Test/good/good.php \test2()
  15. 7.2 coder_sniffer/Test/bad/bad.php \test2()

Allow various weird inline var doc comments people want to use.

File

tests/Drupal/Commenting/InlineCommentUnitTest.inc, line 93
Example inline comments.

Code

function test2() {

  /**
   * @var string $x
   * @var string $y
   */
  list($x, $y) = something();
  $date_format = '';
  $time_format = '';

  // Date formats cannot be loaded during install or update.
  if (!defined('MAINTENANCE_MODE')) {
    if ($date_format_entity = DateFormat::load('html_date')) {

      /** @var \Drupal\Core\Datetime\DateFormatInterface $date_format_entity */
      $date_format = $date_format_entity
        ->getPattern();
    }
    if ($time_format_entity = DateFormat::load('html_time')) {

      /** @var \Drupal\Core\Datetime\DateFormatInterface $time_format_entity */
      $time_format = $time_format_entity
        ->getPattern();
    }
  }
  return $x;
}