Commit 30f7e0c1 authored by Nikolay Lobachev's avatar Nikolay Lobachev Committed by Klaus Purer
Browse files

fix(Deprecated): Allow non stable releases like rc, alpha in deprecated...

fix(Deprecated): Allow non stable releases like rc, alpha in deprecated message versions (#3074947 by LOBsTerr)
parent a11339f8
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -91,13 +91,14 @@ class DeprecatedSniff implements Sniff
            $phpcsFile->addError($error, $stackPtr, 'IncorrectTextLayout', [$depText]);
        } else {
            // The text follows the basic layout. Now check that the versions
            // match drupal:n.n.n or project:n.x-n.n. The text must be all lower
            // case and numbers can be one or two digits.
            // match drupal:n.n.n or project:n.x-n.n or project:n.x-n.n-version[n].
            // The text must be all lower case and numbers can be one or two digits.
            foreach (['deprecation-version' => $matches[1], 'removal-version' => $matches[2]] as $name => $version) {
                if (preg_match('/^drupal:\d{1,2}\.\d{1,2}\.\d{1,2}$/', $version) === 0
                    && preg_match('/^[a-z\d_]+:\d{1,2}\.x\-\d{1,2}\.\d{1,2}$/', $version) === 0
                    && preg_match('/^[a-z\d_]+:\d{1,2}\.x\-\d{1,2}\.\d{1,2}-[a-z]{1,5}\d{1,2}$/', $version) === 0
                ) {
                    $error = "The %s '%s' does not match the lower-case machine-name standard: drupal:n.n.n or project:n.x-n.n";
                    $error = "The %s '%s' does not match the lower-case machine-name standard: drupal:n.n.n or project:n.x-n.n or project:n.x-n.n-version[n]";
                    $phpcsFile->addWarning($error, $stackPtr, 'DeprecatedVersionFormat', [$name, $version]);
                }
            }
+10 −0
Original line number Diff line number Diff line
@@ -58,3 +58,13 @@ function z() {
 *   This function block is OK.
 * @see http://www.drupal.org/node/7890
 */

/**
 * This doc block will pass the 'Deprecated' standards checks.
 *
 * @deprecated in project:8.x-1.0-beta3 and is removed from project:8.x-1.0-rc1.
 *   Not stable versions rc, alpha and etc should be correctly accepted.
 * @see http://www.drupal.org/node/7890
 */
function w() {
}