Completed
Branch new-admin-design (796b82)
by
unknown
18:06 queued 13:57
created
src/Standards/Generic/Sniffs/Files/OneInterfacePerFileSniff.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -16,36 +16,36 @@
 block discarded – undo
16 16
 {
17 17
 
18 18
 
19
-    /**
20
-     * Returns an array of tokens this test wants to listen for.
21
-     *
22
-     * @return array
23
-     */
24
-    public function register()
25
-    {
26
-        return [T_INTERFACE];
27
-
28
-    }//end register()
29
-
30
-
31
-    /**
32
-     * Processes this sniff, when one of its tokens is encountered.
33
-     *
34
-     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
35
-     * @param int                         $stackPtr  The position of the current token in
36
-     *                                               the stack passed in $tokens.
37
-     *
38
-     * @return void
39
-     */
40
-    public function process(File $phpcsFile, $stackPtr)
41
-    {
42
-        $nextInterface = $phpcsFile->findNext($this->register(), ($stackPtr + 1));
43
-        if ($nextInterface !== false) {
44
-            $error = 'Only one interface is allowed in a file';
45
-            $phpcsFile->addError($error, $nextInterface, 'MultipleFound');
46
-        }
47
-
48
-    }//end process()
19
+	/**
20
+	 * Returns an array of tokens this test wants to listen for.
21
+	 *
22
+	 * @return array
23
+	 */
24
+	public function register()
25
+	{
26
+		return [T_INTERFACE];
27
+
28
+	}//end register()
29
+
30
+
31
+	/**
32
+	 * Processes this sniff, when one of its tokens is encountered.
33
+	 *
34
+	 * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
35
+	 * @param int                         $stackPtr  The position of the current token in
36
+	 *                                               the stack passed in $tokens.
37
+	 *
38
+	 * @return void
39
+	 */
40
+	public function process(File $phpcsFile, $stackPtr)
41
+	{
42
+		$nextInterface = $phpcsFile->findNext($this->register(), ($stackPtr + 1));
43
+		if ($nextInterface !== false) {
44
+			$error = 'Only one interface is allowed in a file';
45
+			$phpcsFile->addError($error, $nextInterface, 'MultipleFound');
46
+		}
47
+
48
+	}//end process()
49 49
 
50 50
 
51 51
 }//end class
Please login to merge, or discard this patch.
php_codesniffer/src/Standards/Generic/Sniffs/Files/ByteOrderMarkSniff.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -16,65 +16,65 @@
 block discarded – undo
16 16
 class ByteOrderMarkSniff implements Sniff
17 17
 {
18 18
 
19
-    /**
20
-     * List of supported BOM definitions.
21
-     *
22
-     * Use encoding names as keys and hex BOM representations as values.
23
-     *
24
-     * @var array
25
-     */
26
-    protected $bomDefinitions = [
27
-        'UTF-8'       => 'efbbbf',
28
-        'UTF-16 (BE)' => 'feff',
29
-        'UTF-16 (LE)' => 'fffe',
30
-    ];
19
+	/**
20
+	 * List of supported BOM definitions.
21
+	 *
22
+	 * Use encoding names as keys and hex BOM representations as values.
23
+	 *
24
+	 * @var array
25
+	 */
26
+	protected $bomDefinitions = [
27
+		'UTF-8'       => 'efbbbf',
28
+		'UTF-16 (BE)' => 'feff',
29
+		'UTF-16 (LE)' => 'fffe',
30
+	];
31 31
 
32 32
 
33
-    /**
34
-     * Returns an array of tokens this test wants to listen for.
35
-     *
36
-     * @return array
37
-     */
38
-    public function register()
39
-    {
40
-        return [T_INLINE_HTML];
33
+	/**
34
+	 * Returns an array of tokens this test wants to listen for.
35
+	 *
36
+	 * @return array
37
+	 */
38
+	public function register()
39
+	{
40
+		return [T_INLINE_HTML];
41 41
 
42
-    }//end register()
42
+	}//end register()
43 43
 
44 44
 
45
-    /**
46
-     * Processes this sniff, when one of its tokens is encountered.
47
-     *
48
-     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
49
-     * @param int                         $stackPtr  The position of the current token in
50
-     *                                               the stack passed in $tokens.
51
-     *
52
-     * @return void
53
-     */
54
-    public function process(File $phpcsFile, $stackPtr)
55
-    {
56
-        // The BOM will be the very first token in the file.
57
-        if ($stackPtr !== 0) {
58
-            return;
59
-        }
45
+	/**
46
+	 * Processes this sniff, when one of its tokens is encountered.
47
+	 *
48
+	 * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
49
+	 * @param int                         $stackPtr  The position of the current token in
50
+	 *                                               the stack passed in $tokens.
51
+	 *
52
+	 * @return void
53
+	 */
54
+	public function process(File $phpcsFile, $stackPtr)
55
+	{
56
+		// The BOM will be the very first token in the file.
57
+		if ($stackPtr !== 0) {
58
+			return;
59
+		}
60 60
 
61
-        $tokens = $phpcsFile->getTokens();
61
+		$tokens = $phpcsFile->getTokens();
62 62
 
63
-        foreach ($this->bomDefinitions as $bomName => $expectedBomHex) {
64
-            $bomByteLength = (strlen($expectedBomHex) / 2);
65
-            $htmlBomHex    = bin2hex(substr($tokens[$stackPtr]['content'], 0, $bomByteLength));
66
-            if ($htmlBomHex === $expectedBomHex) {
67
-                $errorData = [$bomName];
68
-                $error     = 'File contains %s byte order mark, which may corrupt your application';
69
-                $phpcsFile->addError($error, $stackPtr, 'Found', $errorData);
70
-                $phpcsFile->recordMetric($stackPtr, 'Using byte order mark', 'yes');
71
-                return;
72
-            }
73
-        }
63
+		foreach ($this->bomDefinitions as $bomName => $expectedBomHex) {
64
+			$bomByteLength = (strlen($expectedBomHex) / 2);
65
+			$htmlBomHex    = bin2hex(substr($tokens[$stackPtr]['content'], 0, $bomByteLength));
66
+			if ($htmlBomHex === $expectedBomHex) {
67
+				$errorData = [$bomName];
68
+				$error     = 'File contains %s byte order mark, which may corrupt your application';
69
+				$phpcsFile->addError($error, $stackPtr, 'Found', $errorData);
70
+				$phpcsFile->recordMetric($stackPtr, 'Using byte order mark', 'yes');
71
+				return;
72
+			}
73
+		}
74 74
 
75
-        $phpcsFile->recordMetric($stackPtr, 'Using byte order mark', 'no');
75
+		$phpcsFile->recordMetric($stackPtr, 'Using byte order mark', 'no');
76 76
 
77
-    }//end process()
77
+	}//end process()
78 78
 
79 79
 
80 80
 }//end class
Please login to merge, or discard this patch.
php_codesniffer/src/Standards/Generic/Sniffs/Files/LineEndingsSniff.php 2 patches
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -95,18 +95,18 @@
 block discarded – undo
95 95
         if ($fix === true) {
96 96
             $tokens = $phpcsFile->getTokens();
97 97
             switch ($this->eolChar) {
98
-            case '\n':
99
-                $eolChar = "\n";
100
-                break;
101
-            case '\r':
102
-                $eolChar = "\r";
103
-                break;
104
-            case '\r\n':
105
-                $eolChar = "\r\n";
106
-                break;
107
-            default:
108
-                $eolChar = $this->eolChar;
109
-                break;
98
+            	case '\n':
99
+                	$eolChar = "\n";
100
+                	break;
101
+            	case '\r':
102
+                	$eolChar = "\r";
103
+                	break;
104
+            	case '\r\n':
105
+                	$eolChar = "\r\n";
106
+                	break;
107
+            	default:
108
+                	$eolChar = $this->eolChar;
109
+                	break;
110 110
             }
111 111
 
112 112
             for ($i = 0; $i < $phpcsFile->numTokens; $i++) {
Please login to merge, or discard this patch.
Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -15,134 +15,134 @@
 block discarded – undo
15 15
 class LineEndingsSniff implements Sniff
16 16
 {
17 17
 
18
-    /**
19
-     * A list of tokenizers this sniff supports.
20
-     *
21
-     * @var array
22
-     */
23
-    public $supportedTokenizers = [
24
-        'PHP',
25
-        'JS',
26
-        'CSS',
27
-    ];
28
-
29
-    /**
30
-     * The valid EOL character.
31
-     *
32
-     * @var string
33
-     */
34
-    public $eolChar = '\n';
35
-
36
-
37
-    /**
38
-     * Returns an array of tokens this test wants to listen for.
39
-     *
40
-     * @return array
41
-     */
42
-    public function register()
43
-    {
44
-        return [
45
-            T_OPEN_TAG,
46
-            T_OPEN_TAG_WITH_ECHO,
47
-        ];
48
-
49
-    }//end register()
50
-
51
-
52
-    /**
53
-     * Processes this sniff, when one of its tokens is encountered.
54
-     *
55
-     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
56
-     * @param int                         $stackPtr  The position of the current token in
57
-     *                                               the stack passed in $tokens.
58
-     *
59
-     * @return int
60
-     */
61
-    public function process(File $phpcsFile, $stackPtr)
62
-    {
63
-        $found = $phpcsFile->eolChar;
64
-        $found = str_replace("\n", '\n', $found);
65
-        $found = str_replace("\r", '\r', $found);
66
-
67
-        $phpcsFile->recordMetric($stackPtr, 'EOL char', $found);
68
-
69
-        if ($found === $this->eolChar) {
70
-            // Ignore the rest of the file.
71
-            return ($phpcsFile->numTokens + 1);
72
-        }
73
-
74
-        // Check for single line files without an EOL. This is a very special
75
-        // case and the EOL char is set to \n when this happens.
76
-        if ($found === '\n') {
77
-            $tokens    = $phpcsFile->getTokens();
78
-            $lastToken = ($phpcsFile->numTokens - 1);
79
-            if ($tokens[$lastToken]['line'] === 1
80
-                && $tokens[$lastToken]['content'] !== "\n"
81
-            ) {
82
-                return;
83
-            }
84
-        }
85
-
86
-        $error    = 'End of line character is invalid; expected "%s" but found "%s"';
87
-        $expected = $this->eolChar;
88
-        $expected = str_replace("\n", '\n', $expected);
89
-        $expected = str_replace("\r", '\r', $expected);
90
-        $data     = [
91
-            $expected,
92
-            $found,
93
-        ];
94
-
95
-        // Errors are always reported on line 1, no matter where the first PHP tag is.
96
-        $fix = $phpcsFile->addFixableError($error, 0, 'InvalidEOLChar', $data);
97
-
98
-        if ($fix === true) {
99
-            $tokens = $phpcsFile->getTokens();
100
-            switch ($this->eolChar) {
101
-            case '\n':
102
-                $eolChar = "\n";
103
-                break;
104
-            case '\r':
105
-                $eolChar = "\r";
106
-                break;
107
-            case '\r\n':
108
-                $eolChar = "\r\n";
109
-                break;
110
-            default:
111
-                $eolChar = $this->eolChar;
112
-                break;
113
-            }
114
-
115
-            for ($i = 0; $i < $phpcsFile->numTokens; $i++) {
116
-                if (isset($tokens[($i + 1)]) === true
117
-                    && $tokens[($i + 1)]['line'] <= $tokens[$i]['line']
118
-                ) {
119
-                    continue;
120
-                }
121
-
122
-                // Token is the last on a line.
123
-                if (isset($tokens[$i]['orig_content']) === true) {
124
-                    $tokenContent = $tokens[$i]['orig_content'];
125
-                } else {
126
-                    $tokenContent = $tokens[$i]['content'];
127
-                }
128
-
129
-                if ($tokenContent === '') {
130
-                    // Special case for JS/CSS close tag.
131
-                    continue;
132
-                }
133
-
134
-                $newContent  = rtrim($tokenContent, "\r\n");
135
-                $newContent .= $eolChar;
136
-                if ($tokenContent !== $newContent) {
137
-                    $phpcsFile->fixer->replaceToken($i, $newContent);
138
-                }
139
-            }//end for
140
-        }//end if
141
-
142
-        // Ignore the rest of the file.
143
-        return ($phpcsFile->numTokens + 1);
144
-
145
-    }//end process()
18
+	/**
19
+	 * A list of tokenizers this sniff supports.
20
+	 *
21
+	 * @var array
22
+	 */
23
+	public $supportedTokenizers = [
24
+		'PHP',
25
+		'JS',
26
+		'CSS',
27
+	];
28
+
29
+	/**
30
+	 * The valid EOL character.
31
+	 *
32
+	 * @var string
33
+	 */
34
+	public $eolChar = '\n';
35
+
36
+
37
+	/**
38
+	 * Returns an array of tokens this test wants to listen for.
39
+	 *
40
+	 * @return array
41
+	 */
42
+	public function register()
43
+	{
44
+		return [
45
+			T_OPEN_TAG,
46
+			T_OPEN_TAG_WITH_ECHO,
47
+		];
48
+
49
+	}//end register()
50
+
51
+
52
+	/**
53
+	 * Processes this sniff, when one of its tokens is encountered.
54
+	 *
55
+	 * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
56
+	 * @param int                         $stackPtr  The position of the current token in
57
+	 *                                               the stack passed in $tokens.
58
+	 *
59
+	 * @return int
60
+	 */
61
+	public function process(File $phpcsFile, $stackPtr)
62
+	{
63
+		$found = $phpcsFile->eolChar;
64
+		$found = str_replace("\n", '\n', $found);
65
+		$found = str_replace("\r", '\r', $found);
66
+
67
+		$phpcsFile->recordMetric($stackPtr, 'EOL char', $found);
68
+
69
+		if ($found === $this->eolChar) {
70
+			// Ignore the rest of the file.
71
+			return ($phpcsFile->numTokens + 1);
72
+		}
73
+
74
+		// Check for single line files without an EOL. This is a very special
75
+		// case and the EOL char is set to \n when this happens.
76
+		if ($found === '\n') {
77
+			$tokens    = $phpcsFile->getTokens();
78
+			$lastToken = ($phpcsFile->numTokens - 1);
79
+			if ($tokens[$lastToken]['line'] === 1
80
+				&& $tokens[$lastToken]['content'] !== "\n"
81
+			) {
82
+				return;
83
+			}
84
+		}
85
+
86
+		$error    = 'End of line character is invalid; expected "%s" but found "%s"';
87
+		$expected = $this->eolChar;
88
+		$expected = str_replace("\n", '\n', $expected);
89
+		$expected = str_replace("\r", '\r', $expected);
90
+		$data     = [
91
+			$expected,
92
+			$found,
93
+		];
94
+
95
+		// Errors are always reported on line 1, no matter where the first PHP tag is.
96
+		$fix = $phpcsFile->addFixableError($error, 0, 'InvalidEOLChar', $data);
97
+
98
+		if ($fix === true) {
99
+			$tokens = $phpcsFile->getTokens();
100
+			switch ($this->eolChar) {
101
+			case '\n':
102
+				$eolChar = "\n";
103
+				break;
104
+			case '\r':
105
+				$eolChar = "\r";
106
+				break;
107
+			case '\r\n':
108
+				$eolChar = "\r\n";
109
+				break;
110
+			default:
111
+				$eolChar = $this->eolChar;
112
+				break;
113
+			}
114
+
115
+			for ($i = 0; $i < $phpcsFile->numTokens; $i++) {
116
+				if (isset($tokens[($i + 1)]) === true
117
+					&& $tokens[($i + 1)]['line'] <= $tokens[$i]['line']
118
+				) {
119
+					continue;
120
+				}
121
+
122
+				// Token is the last on a line.
123
+				if (isset($tokens[$i]['orig_content']) === true) {
124
+					$tokenContent = $tokens[$i]['orig_content'];
125
+				} else {
126
+					$tokenContent = $tokens[$i]['content'];
127
+				}
128
+
129
+				if ($tokenContent === '') {
130
+					// Special case for JS/CSS close tag.
131
+					continue;
132
+				}
133
+
134
+				$newContent  = rtrim($tokenContent, "\r\n");
135
+				$newContent .= $eolChar;
136
+				if ($tokenContent !== $newContent) {
137
+					$phpcsFile->fixer->replaceToken($i, $newContent);
138
+				}
139
+			}//end for
140
+		}//end if
141
+
142
+		// Ignore the rest of the file.
143
+		return ($phpcsFile->numTokens + 1);
144
+
145
+	}//end process()
146 146
 
147 147
 
148 148
 }//end class
Please login to merge, or discard this patch.
src/Standards/Generic/Sniffs/Files/OneObjectStructurePerFileSniff.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -16,40 +16,40 @@
 block discarded – undo
16 16
 {
17 17
 
18 18
 
19
-    /**
20
-     * Returns an array of tokens this test wants to listen for.
21
-     *
22
-     * @return array
23
-     */
24
-    public function register()
25
-    {
26
-        return [
27
-            T_CLASS,
28
-            T_INTERFACE,
29
-            T_TRAIT,
30
-        ];
31
-
32
-    }//end register()
33
-
34
-
35
-    /**
36
-     * Processes this sniff, when one of its tokens is encountered.
37
-     *
38
-     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
39
-     * @param int                         $stackPtr  The position of the current token in
40
-     *                                               the stack passed in $tokens.
41
-     *
42
-     * @return void
43
-     */
44
-    public function process(File $phpcsFile, $stackPtr)
45
-    {
46
-        $nextClass = $phpcsFile->findNext($this->register(), ($stackPtr + 1));
47
-        if ($nextClass !== false) {
48
-            $error = 'Only one object structure is allowed in a file';
49
-            $phpcsFile->addError($error, $nextClass, 'MultipleFound');
50
-        }
51
-
52
-    }//end process()
19
+	/**
20
+	 * Returns an array of tokens this test wants to listen for.
21
+	 *
22
+	 * @return array
23
+	 */
24
+	public function register()
25
+	{
26
+		return [
27
+			T_CLASS,
28
+			T_INTERFACE,
29
+			T_TRAIT,
30
+		];
31
+
32
+	}//end register()
33
+
34
+
35
+	/**
36
+	 * Processes this sniff, when one of its tokens is encountered.
37
+	 *
38
+	 * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
39
+	 * @param int                         $stackPtr  The position of the current token in
40
+	 *                                               the stack passed in $tokens.
41
+	 *
42
+	 * @return void
43
+	 */
44
+	public function process(File $phpcsFile, $stackPtr)
45
+	{
46
+		$nextClass = $phpcsFile->findNext($this->register(), ($stackPtr + 1));
47
+		if ($nextClass !== false) {
48
+			$error = 'Only one object structure is allowed in a file';
49
+			$phpcsFile->addError($error, $nextClass, 'MultipleFound');
50
+		}
51
+
52
+	}//end process()
53 53
 
54 54
 
55 55
 }//end class
Please login to merge, or discard this patch.
php_codesniffer/src/Standards/Generic/Sniffs/Files/OneTraitPerFileSniff.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -16,36 +16,36 @@
 block discarded – undo
16 16
 {
17 17
 
18 18
 
19
-    /**
20
-     * Returns an array of tokens this test wants to listen for.
21
-     *
22
-     * @return array
23
-     */
24
-    public function register()
25
-    {
26
-        return [T_TRAIT];
27
-
28
-    }//end register()
29
-
30
-
31
-    /**
32
-     * Processes this sniff, when one of its tokens is encountered.
33
-     *
34
-     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
35
-     * @param int                         $stackPtr  The position of the current token in
36
-     *                                               the stack passed in $tokens.
37
-     *
38
-     * @return void
39
-     */
40
-    public function process(File $phpcsFile, $stackPtr)
41
-    {
42
-        $nextClass = $phpcsFile->findNext($this->register(), ($stackPtr + 1));
43
-        if ($nextClass !== false) {
44
-            $error = 'Only one trait is allowed in a file';
45
-            $phpcsFile->addError($error, $nextClass, 'MultipleFound');
46
-        }
47
-
48
-    }//end process()
19
+	/**
20
+	 * Returns an array of tokens this test wants to listen for.
21
+	 *
22
+	 * @return array
23
+	 */
24
+	public function register()
25
+	{
26
+		return [T_TRAIT];
27
+
28
+	}//end register()
29
+
30
+
31
+	/**
32
+	 * Processes this sniff, when one of its tokens is encountered.
33
+	 *
34
+	 * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
35
+	 * @param int                         $stackPtr  The position of the current token in
36
+	 *                                               the stack passed in $tokens.
37
+	 *
38
+	 * @return void
39
+	 */
40
+	public function process(File $phpcsFile, $stackPtr)
41
+	{
42
+		$nextClass = $phpcsFile->findNext($this->register(), ($stackPtr + 1));
43
+		if ($nextClass !== false) {
44
+			$error = 'Only one trait is allowed in a file';
45
+			$phpcsFile->addError($error, $nextClass, 'MultipleFound');
46
+		}
47
+
48
+	}//end process()
49 49
 
50 50
 
51 51
 }//end class
Please login to merge, or discard this patch.
php_codesniffer/src/Standards/Generic/Sniffs/Files/OneClassPerFileSniff.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -16,36 +16,36 @@
 block discarded – undo
16 16
 {
17 17
 
18 18
 
19
-    /**
20
-     * Returns an array of tokens this test wants to listen for.
21
-     *
22
-     * @return array
23
-     */
24
-    public function register()
25
-    {
26
-        return [T_CLASS];
27
-
28
-    }//end register()
29
-
30
-
31
-    /**
32
-     * Processes this sniff, when one of its tokens is encountered.
33
-     *
34
-     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
35
-     * @param int                         $stackPtr  The position of the current token in
36
-     *                                               the stack passed in $tokens.
37
-     *
38
-     * @return void
39
-     */
40
-    public function process(File $phpcsFile, $stackPtr)
41
-    {
42
-        $nextClass = $phpcsFile->findNext($this->register(), ($stackPtr + 1));
43
-        if ($nextClass !== false) {
44
-            $error = 'Only one class is allowed in a file';
45
-            $phpcsFile->addError($error, $nextClass, 'MultipleFound');
46
-        }
47
-
48
-    }//end process()
19
+	/**
20
+	 * Returns an array of tokens this test wants to listen for.
21
+	 *
22
+	 * @return array
23
+	 */
24
+	public function register()
25
+	{
26
+		return [T_CLASS];
27
+
28
+	}//end register()
29
+
30
+
31
+	/**
32
+	 * Processes this sniff, when one of its tokens is encountered.
33
+	 *
34
+	 * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
35
+	 * @param int                         $stackPtr  The position of the current token in
36
+	 *                                               the stack passed in $tokens.
37
+	 *
38
+	 * @return void
39
+	 */
40
+	public function process(File $phpcsFile, $stackPtr)
41
+	{
42
+		$nextClass = $phpcsFile->findNext($this->register(), ($stackPtr + 1));
43
+		if ($nextClass !== false) {
44
+			$error = 'Only one class is allowed in a file';
45
+			$phpcsFile->addError($error, $nextClass, 'MultipleFound');
46
+		}
47
+
48
+	}//end process()
49 49
 
50 50
 
51 51
 }//end class
Please login to merge, or discard this patch.
src/Standards/Generic/Sniffs/Files/LowercasedFilenameSniff.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
         $filename          = basename($filename);
48 48
         $lowercaseFilename = strtolower($filename);
49 49
         if ($filename !== $lowercaseFilename) {
50
-            $data  = [
50
+            $data = [
51 51
                 $filename,
52 52
                 $lowercaseFilename,
53 53
             ];
Please login to merge, or discard this patch.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -16,55 +16,55 @@
 block discarded – undo
16 16
 {
17 17
 
18 18
 
19
-    /**
20
-     * Returns an array of tokens this test wants to listen for.
21
-     *
22
-     * @return array
23
-     */
24
-    public function register()
25
-    {
26
-        return [
27
-            T_OPEN_TAG,
28
-            T_OPEN_TAG_WITH_ECHO,
29
-        ];
19
+	/**
20
+	 * Returns an array of tokens this test wants to listen for.
21
+	 *
22
+	 * @return array
23
+	 */
24
+	public function register()
25
+	{
26
+		return [
27
+			T_OPEN_TAG,
28
+			T_OPEN_TAG_WITH_ECHO,
29
+		];
30 30
 
31
-    }//end register()
31
+	}//end register()
32 32
 
33 33
 
34
-    /**
35
-     * Processes this sniff, when one of its tokens is encountered.
36
-     *
37
-     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
38
-     * @param int                         $stackPtr  The position of the current token in
39
-     *                                               the stack passed in $tokens.
40
-     *
41
-     * @return int
42
-     */
43
-    public function process(File $phpcsFile, $stackPtr)
44
-    {
45
-        $filename = $phpcsFile->getFilename();
46
-        if ($filename === 'STDIN') {
47
-            return;
48
-        }
34
+	/**
35
+	 * Processes this sniff, when one of its tokens is encountered.
36
+	 *
37
+	 * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
38
+	 * @param int                         $stackPtr  The position of the current token in
39
+	 *                                               the stack passed in $tokens.
40
+	 *
41
+	 * @return int
42
+	 */
43
+	public function process(File $phpcsFile, $stackPtr)
44
+	{
45
+		$filename = $phpcsFile->getFilename();
46
+		if ($filename === 'STDIN') {
47
+			return;
48
+		}
49 49
 
50
-        $filename          = basename($filename);
51
-        $lowercaseFilename = strtolower($filename);
52
-        if ($filename !== $lowercaseFilename) {
53
-            $data  = [
54
-                $filename,
55
-                $lowercaseFilename,
56
-            ];
57
-            $error = 'Filename "%s" doesn\'t match the expected filename "%s"';
58
-            $phpcsFile->addError($error, $stackPtr, 'NotFound', $data);
59
-            $phpcsFile->recordMetric($stackPtr, 'Lowercase filename', 'no');
60
-        } else {
61
-            $phpcsFile->recordMetric($stackPtr, 'Lowercase filename', 'yes');
62
-        }
50
+		$filename          = basename($filename);
51
+		$lowercaseFilename = strtolower($filename);
52
+		if ($filename !== $lowercaseFilename) {
53
+			$data  = [
54
+				$filename,
55
+				$lowercaseFilename,
56
+			];
57
+			$error = 'Filename "%s" doesn\'t match the expected filename "%s"';
58
+			$phpcsFile->addError($error, $stackPtr, 'NotFound', $data);
59
+			$phpcsFile->recordMetric($stackPtr, 'Lowercase filename', 'no');
60
+		} else {
61
+			$phpcsFile->recordMetric($stackPtr, 'Lowercase filename', 'yes');
62
+		}
63 63
 
64
-        // Ignore the rest of the file.
65
-        return ($phpcsFile->numTokens + 1);
64
+		// Ignore the rest of the file.
65
+		return ($phpcsFile->numTokens + 1);
66 66
 
67
-    }//end process()
67
+	}//end process()
68 68
 
69 69
 
70 70
 }//end class
Please login to merge, or discard this patch.
php_codesniffer/src/Standards/Generic/Sniffs/Commenting/FixmeSniff.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -17,62 +17,62 @@
 block discarded – undo
17 17
 class FixmeSniff implements Sniff
18 18
 {
19 19
 
20
-    /**
21
-     * A list of tokenizers this sniff supports.
22
-     *
23
-     * @var array
24
-     */
25
-    public $supportedTokenizers = [
26
-        'PHP',
27
-        'JS',
28
-    ];
20
+	/**
21
+	 * A list of tokenizers this sniff supports.
22
+	 *
23
+	 * @var array
24
+	 */
25
+	public $supportedTokenizers = [
26
+		'PHP',
27
+		'JS',
28
+	];
29 29
 
30 30
 
31
-    /**
32
-     * Returns an array of tokens this test wants to listen for.
33
-     *
34
-     * @return array
35
-     */
36
-    public function register()
37
-    {
38
-        return array_diff(Tokens::$commentTokens, Tokens::$phpcsCommentTokens);
31
+	/**
32
+	 * Returns an array of tokens this test wants to listen for.
33
+	 *
34
+	 * @return array
35
+	 */
36
+	public function register()
37
+	{
38
+		return array_diff(Tokens::$commentTokens, Tokens::$phpcsCommentTokens);
39 39
 
40
-    }//end register()
40
+	}//end register()
41 41
 
42 42
 
43
-    /**
44
-     * Processes this sniff, when one of its tokens is encountered.
45
-     *
46
-     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
47
-     * @param int                         $stackPtr  The position of the current token
48
-     *                                               in the stack passed in $tokens.
49
-     *
50
-     * @return void
51
-     */
52
-    public function process(File $phpcsFile, $stackPtr)
53
-    {
54
-        $tokens = $phpcsFile->getTokens();
43
+	/**
44
+	 * Processes this sniff, when one of its tokens is encountered.
45
+	 *
46
+	 * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
47
+	 * @param int                         $stackPtr  The position of the current token
48
+	 *                                               in the stack passed in $tokens.
49
+	 *
50
+	 * @return void
51
+	 */
52
+	public function process(File $phpcsFile, $stackPtr)
53
+	{
54
+		$tokens = $phpcsFile->getTokens();
55 55
 
56
-        $content = $tokens[$stackPtr]['content'];
57
-        $matches = [];
58
-        preg_match('/(?:\A|[^\p{L}]+)fixme([^\p{L}]+(.*)|\Z)/ui', $content, $matches);
59
-        if (empty($matches) === false) {
60
-            // Clear whitespace and some common characters not required at
61
-            // the end of a fixme message to make the error more informative.
62
-            $type         = 'CommentFound';
63
-            $fixmeMessage = trim($matches[1]);
64
-            $fixmeMessage = trim($fixmeMessage, '-:[](). ');
65
-            $error        = 'Comment refers to a FIXME task';
66
-            $data         = [$fixmeMessage];
67
-            if ($fixmeMessage !== '') {
68
-                $type   = 'TaskFound';
69
-                $error .= ' "%s"';
70
-            }
56
+		$content = $tokens[$stackPtr]['content'];
57
+		$matches = [];
58
+		preg_match('/(?:\A|[^\p{L}]+)fixme([^\p{L}]+(.*)|\Z)/ui', $content, $matches);
59
+		if (empty($matches) === false) {
60
+			// Clear whitespace and some common characters not required at
61
+			// the end of a fixme message to make the error more informative.
62
+			$type         = 'CommentFound';
63
+			$fixmeMessage = trim($matches[1]);
64
+			$fixmeMessage = trim($fixmeMessage, '-:[](). ');
65
+			$error        = 'Comment refers to a FIXME task';
66
+			$data         = [$fixmeMessage];
67
+			if ($fixmeMessage !== '') {
68
+				$type   = 'TaskFound';
69
+				$error .= ' "%s"';
70
+			}
71 71
 
72
-            $phpcsFile->addError($error, $stackPtr, $type, $data);
73
-        }
72
+			$phpcsFile->addError($error, $stackPtr, $type, $data);
73
+		}
74 74
 
75
-    }//end process()
75
+	}//end process()
76 76
 
77 77
 
78 78
 }//end class
Please login to merge, or discard this patch.
php_codesniffer/src/Standards/Generic/Sniffs/Commenting/TodoSniff.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -16,62 +16,62 @@
 block discarded – undo
16 16
 class TodoSniff implements Sniff
17 17
 {
18 18
 
19
-    /**
20
-     * A list of tokenizers this sniff supports.
21
-     *
22
-     * @var array
23
-     */
24
-    public $supportedTokenizers = [
25
-        'PHP',
26
-        'JS',
27
-    ];
19
+	/**
20
+	 * A list of tokenizers this sniff supports.
21
+	 *
22
+	 * @var array
23
+	 */
24
+	public $supportedTokenizers = [
25
+		'PHP',
26
+		'JS',
27
+	];
28 28
 
29 29
 
30
-    /**
31
-     * Returns an array of tokens this test wants to listen for.
32
-     *
33
-     * @return array
34
-     */
35
-    public function register()
36
-    {
37
-        return array_diff(Tokens::$commentTokens, Tokens::$phpcsCommentTokens);
30
+	/**
31
+	 * Returns an array of tokens this test wants to listen for.
32
+	 *
33
+	 * @return array
34
+	 */
35
+	public function register()
36
+	{
37
+		return array_diff(Tokens::$commentTokens, Tokens::$phpcsCommentTokens);
38 38
 
39
-    }//end register()
39
+	}//end register()
40 40
 
41 41
 
42
-    /**
43
-     * Processes this sniff, when one of its tokens is encountered.
44
-     *
45
-     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
46
-     * @param int                         $stackPtr  The position of the current token
47
-     *                                               in the stack passed in $tokens.
48
-     *
49
-     * @return void
50
-     */
51
-    public function process(File $phpcsFile, $stackPtr)
52
-    {
53
-        $tokens = $phpcsFile->getTokens();
42
+	/**
43
+	 * Processes this sniff, when one of its tokens is encountered.
44
+	 *
45
+	 * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
46
+	 * @param int                         $stackPtr  The position of the current token
47
+	 *                                               in the stack passed in $tokens.
48
+	 *
49
+	 * @return void
50
+	 */
51
+	public function process(File $phpcsFile, $stackPtr)
52
+	{
53
+		$tokens = $phpcsFile->getTokens();
54 54
 
55
-        $content = $tokens[$stackPtr]['content'];
56
-        $matches = [];
57
-        preg_match('/(?:\A|[^\p{L}]+)todo([^\p{L}]+(.*)|\Z)/ui', $content, $matches);
58
-        if (empty($matches) === false) {
59
-            // Clear whitespace and some common characters not required at
60
-            // the end of a to-do message to make the warning more informative.
61
-            $type        = 'CommentFound';
62
-            $todoMessage = trim($matches[1]);
63
-            $todoMessage = trim($todoMessage, '-:[](). ');
64
-            $error       = 'Comment refers to a TODO task';
65
-            $data        = [$todoMessage];
66
-            if ($todoMessage !== '') {
67
-                $type   = 'TaskFound';
68
-                $error .= ' "%s"';
69
-            }
55
+		$content = $tokens[$stackPtr]['content'];
56
+		$matches = [];
57
+		preg_match('/(?:\A|[^\p{L}]+)todo([^\p{L}]+(.*)|\Z)/ui', $content, $matches);
58
+		if (empty($matches) === false) {
59
+			// Clear whitespace and some common characters not required at
60
+			// the end of a to-do message to make the warning more informative.
61
+			$type        = 'CommentFound';
62
+			$todoMessage = trim($matches[1]);
63
+			$todoMessage = trim($todoMessage, '-:[](). ');
64
+			$error       = 'Comment refers to a TODO task';
65
+			$data        = [$todoMessage];
66
+			if ($todoMessage !== '') {
67
+				$type   = 'TaskFound';
68
+				$error .= ' "%s"';
69
+			}
70 70
 
71
-            $phpcsFile->addWarning($error, $stackPtr, $type, $data);
72
-        }
71
+			$phpcsFile->addWarning($error, $stackPtr, $type, $data);
72
+		}
73 73
 
74
-    }//end process()
74
+	}//end process()
75 75
 
76 76
 
77 77
 }//end class
Please login to merge, or discard this patch.