From 3552c9bbc8cafa4ee282d014a6dd51a1dcbed080 Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Sat, 7 Nov 2020 00:40:24 +0100 Subject: [PATCH] Use Slevomat.Classes.RequireSingleLineMethodSignature instead of Arguments --- Symfony/Sniffs/Functions/ArgumentsSniff.php | 77 ------------------- Symfony/Tests/Functions/ArgumentsUnitTest.inc | 12 --- Symfony/Tests/Functions/ArgumentsUnitTest.php | 62 --------------- Symfony/ruleset.xml | 5 ++ 4 files changed, 5 insertions(+), 151 deletions(-) delete mode 100644 Symfony/Sniffs/Functions/ArgumentsSniff.php delete mode 100644 Symfony/Tests/Functions/ArgumentsUnitTest.inc delete mode 100644 Symfony/Tests/Functions/ArgumentsUnitTest.php diff --git a/Symfony/Sniffs/Functions/ArgumentsSniff.php b/Symfony/Sniffs/Functions/ArgumentsSniff.php deleted file mode 100644 index e7009aa..0000000 --- a/Symfony/Sniffs/Functions/ArgumentsSniff.php +++ /dev/null @@ -1,77 +0,0 @@ - - * @license http://spdx.org/licenses/MIT MIT License - * @link https://github.com/djoos/Symfony-coding-standard - */ - -namespace Symfony\Sniffs\Functions; - -use PHP_CodeSniffer\Files\File; -use PHP_CodeSniffer\Sniffs\Sniff; - -/** - * Checks whether functions are defined on one line. - * - * @category PHP - * @package Symfony-coding-standard - * @author wicliff wolda - * @license http://spdx.org/licenses/MIT MIT License - * @link http://pear.php.net/package/PHP_CodeSniffer - */ -class ArgumentsSniff implements Sniff -{ - /** - * Registers the tokens that this sniff wants to listen for. - * - * @return array - */ - public function register() - { - return array( - T_FUNCTION, - ); - } - - /** - * Called when one of the token types that this sniff is listening for - * is found. - * - * @param File $phpcsFile The file where the token was found. - * @param int $stackPtr The position of the current token - * in the stack passed in $tokens. - * - * @return void|int Optionally returns a stack pointer. The sniff will not be - * called again on the current file until the returned stack - * pointer is reached. Return (count($tokens) + 1) to skip - * the rest of the file. - */ - public function process(File $phpcsFile, $stackPtr) - { - $tokens = $phpcsFile->getTokens(); - $function = $tokens[$stackPtr]; - - $openerLine = $tokens[$function['parenthesis_opener']]['line']; - $closerLine = $tokens[$function['parenthesis_closer']]['line']; - - if ($openerLine !== $closerLine) { - $error = 'Declare all the arguments on the same line '; - $error .= 'as the method/function name, '; - $error .= 'no matter how many arguments there are.'; - - $phpcsFile->addError( - $error, - $stackPtr, - 'Invalid' - ); - } - } - -} diff --git a/Symfony/Tests/Functions/ArgumentsUnitTest.inc b/Symfony/Tests/Functions/ArgumentsUnitTest.inc deleted file mode 100644 index 34f8a44..0000000 --- a/Symfony/Tests/Functions/ArgumentsUnitTest.inc +++ /dev/null @@ -1,12 +0,0 @@ - - * @license http://spdx.org/licenses/MIT MIT License - * @link https://github.com/djoos/Symfony2-coding-standard - */ - -namespace Symfony\Tests\Functions; - -use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; - -/** - * Unit test class for the ArgumentsUnitTest sniff. - * - * A sniff unit test checks a .inc file for expected violations of a single - * coding standard. Expected errors and warnings are stored in this class. - * - * PHP version 5 - * - * @category PHP - * @package Symfony-coding-standard - * @author wicliff - * @license http://spdx.org/licenses/MIT MIT License - * @link https://github.com/djoos/Symfony2-coding-standard - */ -class ArgumentsUnitTest extends AbstractSniffUnitTest -{ - /** - * Returns the lines where errors should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of errors that should occur on that line. - * - * @return array - */ - public function getErrorList() - { - return array( - 3 => 1, - ); - } - - /** - * Returns the lines where warnings should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of errors that should occur on that line. - * - * @return array - */ - public function getWarningList() - { - return array(); - } -} diff --git a/Symfony/ruleset.xml b/Symfony/ruleset.xml index 979beff..ef93bc2 100755 --- a/Symfony/ruleset.xml +++ b/Symfony/ruleset.xml @@ -115,4 +115,9 @@ + + + + +