Chris@0: getTokens(); Chris@0: Chris@0: $fileExtension = strtolower(substr($phpcsFile->getFilename(), -9)); Chris@0: if ($fileExtension !== '.info.yml') { Chris@0: return ($phpcsFile->numTokens + 1); Chris@0: } Chris@0: Chris@0: if (preg_match('/^dependencies:/', $tokens[$stackPtr]['content']) === 0) { Chris@0: return; Chris@0: } Chris@0: Chris@0: $nextLine = ($stackPtr + 1); Chris@0: Chris@0: while (isset($tokens[$nextLine]) === true) { Chris@0: // Dependency line without namespace. Chris@0: if (preg_match('/^[\s]+- [^:]+[\s]*$/', $tokens[$nextLine]['content']) === 1) { Chris@0: $error = 'All dependencies must be prefixed with the project name, for example "drupal:"'; Chris@0: $phpcsFile->addWarning($error, $nextLine, 'NonNamespaced'); Chris@0: } else if (preg_match('/^[\s]+- [^:]+:[^:]+[\s]*$/', $tokens[$nextLine]['content']) === 0 Chris@0: && preg_match('/^[\s]*#.*$/', $tokens[$nextLine]['content']) === 0 Chris@0: ) { Chris@0: // Not a dependency line with namespace or comment - stop. Chris@0: return $nextLine; Chris@0: } Chris@0: Chris@0: $nextLine++; Chris@0: } Chris@0: Chris@0: }//end process() Chris@0: Chris@0: Chris@0: }//end class