Commit 7cd84911 authored by Dane Powell's avatar Dane Powell Committed by Klaus Purer
Browse files

feat(DataTypeNamespace): Data types in @throws tags must be fully namespaced (#3050837)

parent 9c1ccd9e
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Tokens;

/**
 * Checks that data types in param, return, var tags are fully namespaced.
 * Checks that data types in param, return, var, and throws tags are fully namespaced.
 *
 * @category PHP
 * @package  PHP_CodeSniffer
@@ -90,7 +90,8 @@ class DataTypeNamespaceSniff implements Sniff
        while ($tag !== false) {
            if (($tokens[$tag]['content'] === '@var'
                || $tokens[$tag]['content'] === '@return'
                || $tokens[$tag]['content'] === '@param')
                || $tokens[$tag]['content'] === '@param'
                || $tokens[$tag]['content'] === '@throws')
                && isset($tokens[($tag + 1)]) === true
                && $tokens[($tag + 1)]['code'] === T_DOC_COMMENT_WHITESPACE
                && isset($tokens[($tag + 2)]) === true
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@ class Test {
   *
   * @return TestClass
   *   Yep.
   *
   * @throws TestClass
   */
  public function test1(TestClass $y) {
    return $y;
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@ class Test {
   *
   * @return \Some\Namespaced\TestClass
   *   Yep.
   *
   * @throws \Some\Namespaced\TestClass
   */
  public function test1(TestClass $y) {
    return $y;
+2 −1
Original line number Diff line number Diff line
@@ -20,7 +20,8 @@ class DataTypeNamespaceUnitTest extends CoderSniffUnitTest
        return array(
                15 => 1,
                18 => 1,
                29 => 1,
                21 => 1,
                31 => 1,
               );

    }//end getErrorList()