Completely remove DiscouragePCRESniff
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 27 Nov 2013 23:57:14 +0000 (00:57 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 27 Nov 2013 23:57:14 +0000 (00:57 +0100)
CodeSniff/WCF/Sniffs/PHP/DiscouragePCRESniff.php [deleted file]
CodeSniff/WCF/ruleset.xml

diff --git a/CodeSniff/WCF/Sniffs/PHP/DiscouragePCRESniff.php b/CodeSniff/WCF/Sniffs/PHP/DiscouragePCRESniff.php
deleted file mode 100644 (file)
index e221f6b..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/**
- * Discourages use of raw PCRE functions. \wcf\system\Regex is a superior way to use Regex.
- * 
- * @author     Tim Duesterhus
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @category   Community Framework
- */
-class WCF_Sniffs_PHP_DiscouragePCRESniff/* extends Generic_Sniffs_PHP_ForbiddenFunctionsSniff*/ {
-       /**
-        * A list of forbidden functions with their alternatives.
-        *
-        * The value is NULL if no alternative exists. IE, the
-        * function should just not be used.
-        *
-        * @var array(string => string|null)
-        */
-       protected $forbiddenFunctions = array(
-               'preg_match_all' => null,
-               'preg_match' => null,
-               'preg_replace' => null,
-               'preg_replace_callback' => null,
-               'preg_split' => null
-       );
-       
-       /**
-        * Constructor.
-        */
-       public function __construct() {
-               return;
-       }
-       
-       /**
-        * Generates the error or warning for this sniff.
-        *
-        * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
-        * @param int                           $stackPtr  The position of the forbidden function
-        *                                                               in the token array.
-        * @param string                         $function  The name of the forbidden function.
-        * @param string                         $pattern   The pattern used for the match.
-        *
-        * @return void
-        */
-       protected function addError($phpcsFile, $stackPtr, $function, $pattern = null) {
-               $data = array($function);
-               $error = 'Use of raw PCRE %s() is discouraged. Please use \wcf\system\Regex which provides OO-access to regex';
-               $type = 'Discourage';
-               
-               $phpcsFile->addWarning($error, $stackPtr, $type, $data);
-       }
-}
index 9df07620ed48b24aabfbc797ac52fde2d9afa946..39307f3c03f686c90c813ccd9795c4d3a40a826d 100644 (file)
@@ -36,7 +36,6 @@
        <rule ref="WCF.Namespaces.ClassMustBeImported" />
        <rule ref="WCF.Namespaces.SortedUseDeclaration" />
        <rule ref="WCF.Namespaces.UseDeclaration" />
-       <!--rule ref="WCF.PHP.DiscouragePCRE" /--> <!-- TODO: Sniff is disabled by commenting out the extends in the sniff file! -->
        <rule ref="WCF.WhiteSpace.SuperfluousWhitespace" />
        <rule ref="Zend.Files.ClosingTag" />