Skip to content

Commit

Permalink
Merge pull request #118 from ec-europa/feature/DQA-7674
Browse files Browse the repository at this point in the history
DQA-7674: Adapt sniff for x000 to be compatible with d10
  • Loading branch information
jonhy81 authored Sep 26, 2023
2 parents d06f6d9 + f7732b0 commit 561aee0
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ public function process(File $phpcsFile, $stackPtr)
$tokens = $phpcsFile->getTokens();
$functionName = $tokens[($stackPtr + 2)]['content'];
$fileName = substr(basename($phpcsFile->getFilename()), 0, -8);
if (empty(preg_match('/'.$fileName.'_update_(\d000)/', $functionName, $match)) === false) {
$phpcsFile->addError('Update schema '.$match[1].' is reserved for upgrading.', $stackPtr, "Update".$match[1]."NotAllowed");
if (str_starts_with($functionName, "{$fileName}_update_") === true && str_ends_with($functionName, '000') === true) {
$number = preg_replace('/[^0-9]/', '', $functionName);
$phpcsFile->addError("Update schema $number is reserved for upgrading.", $stackPtr, "Update{$number}NotAllowed");
}

}//end process()
Expand Down

0 comments on commit 561aee0

Please sign in to comment.