@@ -26,15 +26,13 @@ discard block |
||
26 | 26 | * @package PHPCompatibility |
27 | 27 | * @author Juliette Reinders Folmer <[email protected]> |
28 | 28 | */ |
29 | -class NewConstVisibilitySniff extends Sniff |
|
30 | -{ |
|
29 | +class NewConstVisibilitySniff extends Sniff { |
|
31 | 30 | /** |
32 | 31 | * Returns an array of tokens this test wants to listen for. |
33 | 32 | * |
34 | 33 | * @return array |
35 | 34 | */ |
36 | - public function register() |
|
37 | - { |
|
35 | + public function register() { |
|
38 | 36 | return array(\T_CONST); |
39 | 37 | } |
40 | 38 | |
@@ -47,8 +45,7 @@ discard block |
||
47 | 45 | * |
48 | 46 | * @return void |
49 | 47 | */ |
50 | - public function process(File $phpcsFile, $stackPtr) |
|
51 | - { |
|
48 | + public function process(File $phpcsFile, $stackPtr) { |
|
52 | 49 | if ($this->supportsBelow('7.0') === false) { |
53 | 50 | return; |
54 | 51 | } |
@@ -21,8 +21,7 @@ discard block |
||
21 | 21 | * @author Wim Godden <[email protected]> |
22 | 22 | * @copyright 2013 Cu.be Solutions bvba |
23 | 23 | */ |
24 | -class NewClassesSniff extends AbstractNewFeatureSniff |
|
25 | -{ |
|
24 | +class NewClassesSniff extends AbstractNewFeatureSniff { |
|
26 | 25 | |
27 | 26 | /** |
28 | 27 | * A list of new classes, not present in older versions. |
@@ -578,8 +577,7 @@ discard block |
||
578 | 577 | * |
579 | 578 | * @return array |
580 | 579 | */ |
581 | - public function register() |
|
582 | - { |
|
580 | + public function register() { |
|
583 | 581 | // Handle case-insensitivity of class names. |
584 | 582 | $this->newClasses = $this->arrayKeysToLowercase($this->newClasses); |
585 | 583 | $this->newExceptions = $this->arrayKeysToLowercase($this->newExceptions); |
@@ -617,8 +615,7 @@ discard block |
||
617 | 615 | * |
618 | 616 | * @return void |
619 | 617 | */ |
620 | - public function process(File $phpcsFile, $stackPtr) |
|
621 | - { |
|
618 | + public function process(File $phpcsFile, $stackPtr) { |
|
622 | 619 | $tokens = $phpcsFile->getTokens(); |
623 | 620 | |
624 | 621 | switch ($tokens[$stackPtr]['type']) { |
@@ -658,8 +655,7 @@ discard block |
||
658 | 655 | * |
659 | 656 | * @return void |
660 | 657 | */ |
661 | - private function processSingularToken(File $phpcsFile, $stackPtr) |
|
662 | - { |
|
658 | + private function processSingularToken(File $phpcsFile, $stackPtr) { |
|
663 | 659 | $tokens = $phpcsFile->getTokens(); |
664 | 660 | $FQClassName = ''; |
665 | 661 | |
@@ -703,8 +699,7 @@ discard block |
||
703 | 699 | * |
704 | 700 | * @return void |
705 | 701 | */ |
706 | - private function processFunctionToken(File $phpcsFile, $stackPtr) |
|
707 | - { |
|
702 | + private function processFunctionToken(File $phpcsFile, $stackPtr) { |
|
708 | 703 | // Retrieve typehints stripped of global NS indicator and/or nullable indicator. |
709 | 704 | $typeHints = $this->getTypeHintsFromFunctionDeclaration($phpcsFile, $stackPtr); |
710 | 705 | if (empty($typeHints) || \is_array($typeHints) === false) { |
@@ -737,8 +732,7 @@ discard block |
||
737 | 732 | * |
738 | 733 | * @return void |
739 | 734 | */ |
740 | - private function processCatchToken(File $phpcsFile, $stackPtr) |
|
741 | - { |
|
735 | + private function processCatchToken(File $phpcsFile, $stackPtr) { |
|
742 | 736 | $tokens = $phpcsFile->getTokens(); |
743 | 737 | |
744 | 738 | // Bow out during live coding. |
@@ -803,8 +797,7 @@ discard block |
||
803 | 797 | * |
804 | 798 | * @return void |
805 | 799 | */ |
806 | - private function processReturnTypeToken(File $phpcsFile, $stackPtr) |
|
807 | - { |
|
800 | + private function processReturnTypeToken(File $phpcsFile, $stackPtr) { |
|
808 | 801 | $returnTypeHint = $this->getReturnTypeHintName($phpcsFile, $stackPtr); |
809 | 802 | $returnTypeHint = ltrim($returnTypeHint, '\\'); |
810 | 803 | $returnTypeHintLc = strtolower($returnTypeHint); |
@@ -829,8 +822,7 @@ discard block |
||
829 | 822 | * |
830 | 823 | * @return array Version and other information about the item. |
831 | 824 | */ |
832 | - public function getItemArray(array $itemInfo) |
|
833 | - { |
|
825 | + public function getItemArray(array $itemInfo) { |
|
834 | 826 | return $this->newClasses[$itemInfo['nameLc']]; |
835 | 827 | } |
836 | 828 | |
@@ -840,8 +832,7 @@ discard block |
||
840 | 832 | * |
841 | 833 | * @return string |
842 | 834 | */ |
843 | - protected function getErrorMsgTemplate() |
|
844 | - { |
|
835 | + protected function getErrorMsgTemplate() { |
|
845 | 836 | return 'The built-in class ' . parent::getErrorMsgTemplate(); |
846 | 837 | } |
847 | 838 | } |
@@ -23,8 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @since 9.2.0 |
25 | 25 | */ |
26 | -class NewTypedPropertiesSniff extends Sniff |
|
27 | -{ |
|
26 | +class NewTypedPropertiesSniff extends Sniff { |
|
28 | 27 | |
29 | 28 | /** |
30 | 29 | * Valid property modifier keywords. |
@@ -45,8 +44,7 @@ discard block |
||
45 | 44 | * |
46 | 45 | * @return array |
47 | 46 | */ |
48 | - public function register() |
|
49 | - { |
|
47 | + public function register() { |
|
50 | 48 | return array(\T_VARIABLE); |
51 | 49 | } |
52 | 50 | |
@@ -60,8 +58,7 @@ discard block |
||
60 | 58 | * @return int|void Integer stack pointer to skip forward or void to continue |
61 | 59 | * normal file processing. |
62 | 60 | */ |
63 | - public function process(File $phpcsFile, $stackPtr) |
|
64 | - { |
|
61 | + public function process(File $phpcsFile, $stackPtr) { |
|
65 | 62 | if ($this->isClassProperty($phpcsFile, $stackPtr) === false) { |
66 | 63 | return; |
67 | 64 | } |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @since 9.2.0 |
28 | 28 | */ |
29 | -class ForbiddenAbstractPrivateMethodsSniff extends Sniff |
|
30 | -{ |
|
29 | +class ForbiddenAbstractPrivateMethodsSniff extends Sniff { |
|
31 | 30 | |
32 | 31 | /** |
33 | 32 | * Valid scopes to check for abstract private methods. |
@@ -49,8 +48,7 @@ discard block |
||
49 | 48 | * |
50 | 49 | * @return array |
51 | 50 | */ |
52 | - public function register() |
|
53 | - { |
|
51 | + public function register() { |
|
54 | 52 | return array(\T_FUNCTION); |
55 | 53 | } |
56 | 54 | |
@@ -65,8 +63,7 @@ discard block |
||
65 | 63 | * |
66 | 64 | * @return void |
67 | 65 | */ |
68 | - public function process(File $phpcsFile, $stackPtr) |
|
69 | - { |
|
66 | + public function process(File $phpcsFile, $stackPtr) { |
|
70 | 67 | if ($this->supportsAbove('5.1') === false) { |
71 | 68 | return; |
72 | 69 | } |
@@ -24,15 +24,13 @@ discard block |
||
24 | 24 | * @package PHPCompatibility |
25 | 25 | * @author Juliette Reinders Folmer <[email protected]> |
26 | 26 | */ |
27 | -class NewLateStaticBindingSniff extends Sniff |
|
28 | -{ |
|
27 | +class NewLateStaticBindingSniff extends Sniff { |
|
29 | 28 | /** |
30 | 29 | * Returns an array of tokens this test wants to listen for. |
31 | 30 | * |
32 | 31 | * @return array |
33 | 32 | */ |
34 | - public function register() |
|
35 | - { |
|
33 | + public function register() { |
|
36 | 34 | return array(\T_STATIC); |
37 | 35 | } |
38 | 36 | |
@@ -46,8 +44,7 @@ discard block |
||
46 | 44 | * |
47 | 45 | * @return void |
48 | 46 | */ |
49 | - public function process(File $phpcsFile, $stackPtr) |
|
50 | - { |
|
47 | + public function process(File $phpcsFile, $stackPtr) { |
|
51 | 48 | $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true); |
52 | 49 | if ($nextNonEmpty === false) { |
53 | 50 | return; |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | * @package PHPCompatibility |
27 | 27 | * @author Wim Godden <[email protected]> |
28 | 28 | */ |
29 | -class ForbiddenEmptyListAssignmentSniff extends Sniff |
|
30 | -{ |
|
29 | +class ForbiddenEmptyListAssignmentSniff extends Sniff { |
|
31 | 30 | |
32 | 31 | /** |
33 | 32 | * List of tokens to disregard when determining whether the list() is empty. |
@@ -41,8 +40,7 @@ discard block |
||
41 | 40 | * |
42 | 41 | * @return array |
43 | 42 | */ |
44 | - public function register() |
|
45 | - { |
|
43 | + public function register() { |
|
46 | 44 | // Set up a list of tokens to disregard when determining whether the list() is empty. |
47 | 45 | // Only needs to be set up once. |
48 | 46 | $this->ignoreTokens = Tokens::$emptyTokens; |
@@ -65,8 +63,7 @@ discard block |
||
65 | 63 | * |
66 | 64 | * @return void |
67 | 65 | */ |
68 | - public function process(File $phpcsFile, $stackPtr) |
|
69 | - { |
|
66 | + public function process(File $phpcsFile, $stackPtr) { |
|
70 | 67 | if ($this->supportsAbove('7.0') === false) { |
71 | 68 | return; |
72 | 69 | } |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | * @package PHPCompatibility |
27 | 27 | * @author Juliette Reinders Folmer <[email protected]> |
28 | 28 | */ |
29 | -class NewKeyedListSniff extends Sniff |
|
30 | -{ |
|
29 | +class NewKeyedListSniff extends Sniff { |
|
31 | 30 | /** |
32 | 31 | * Tokens which represent the start of a list construct. |
33 | 32 | * |
@@ -63,8 +62,7 @@ discard block |
||
63 | 62 | * |
64 | 63 | * @return array |
65 | 64 | */ |
66 | - public function register() |
|
67 | - { |
|
65 | + public function register() { |
|
68 | 66 | $this->setUpAllTargets(); |
69 | 67 | |
70 | 68 | return $this->sniffTargets; |
@@ -75,8 +73,7 @@ discard block |
||
75 | 73 | * |
76 | 74 | * @return array |
77 | 75 | */ |
78 | - public function setUpAllTargets() |
|
79 | - { |
|
76 | + public function setUpAllTargets() { |
|
80 | 77 | $this->allTargets = $this->sniffTargets + $this->targetsInList; |
81 | 78 | } |
82 | 79 | |
@@ -85,8 +82,7 @@ discard block |
||
85 | 82 | * |
86 | 83 | * @return bool |
87 | 84 | */ |
88 | - protected function bowOutEarly() |
|
89 | - { |
|
85 | + protected function bowOutEarly() { |
|
90 | 86 | return ($this->supportsBelow('7.0') === false); |
91 | 87 | } |
92 | 88 | |
@@ -99,8 +95,7 @@ discard block |
||
99 | 95 | * |
100 | 96 | * @return void |
101 | 97 | */ |
102 | - public function process(File $phpcsFile, $stackPtr) |
|
103 | - { |
|
98 | + public function process(File $phpcsFile, $stackPtr) { |
|
104 | 99 | if ($this->bowOutEarly() === true) { |
105 | 100 | return; |
106 | 101 | } |
@@ -152,8 +147,7 @@ discard block |
||
152 | 147 | * |
153 | 148 | * @return void |
154 | 149 | */ |
155 | - protected function examineList(File $phpcsFile, $opener, $closer) |
|
156 | - { |
|
150 | + protected function examineList(File $phpcsFile, $opener, $closer) { |
|
157 | 151 | $start = $opener; |
158 | 152 | while (($start = $this->hasTargetInList($phpcsFile, $start, $closer)) !== false) { |
159 | 153 | $phpcsFile->addError( |
@@ -177,8 +171,7 @@ discard block |
||
177 | 171 | * |
178 | 172 | * @return int|bool Stack pointer to the target token if encountered. False otherwise. |
179 | 173 | */ |
180 | - protected function hasTargetInList(File $phpcsFile, $start, $closer) |
|
181 | - { |
|
174 | + protected function hasTargetInList(File $phpcsFile, $start, $closer) { |
|
182 | 175 | $tokens = $phpcsFile->getTokens(); |
183 | 176 | |
184 | 177 | for ($i = ($start + 1); $i < $closer; $i++) { |
@@ -27,16 +27,14 @@ discard block |
||
27 | 27 | * @package PHPCompatibility |
28 | 28 | * @author Juliette Reinders Folmer <[email protected]> |
29 | 29 | */ |
30 | -class NewShortListSniff extends Sniff |
|
31 | -{ |
|
30 | +class NewShortListSniff extends Sniff { |
|
32 | 31 | |
33 | 32 | /** |
34 | 33 | * Returns an array of tokens this test wants to listen for. |
35 | 34 | * |
36 | 35 | * @return array |
37 | 36 | */ |
38 | - public function register() |
|
39 | - { |
|
37 | + public function register() { |
|
40 | 38 | return array(\T_OPEN_SHORT_ARRAY); |
41 | 39 | } |
42 | 40 | |
@@ -50,8 +48,7 @@ discard block |
||
50 | 48 | * @return int|void Integer stack pointer to skip forward or void to continue |
51 | 49 | * normal file processing. |
52 | 50 | */ |
53 | - public function process(File $phpcsFile, $stackPtr) |
|
54 | - { |
|
51 | + public function process(File $phpcsFile, $stackPtr) { |
|
55 | 52 | if ($this->supportsBelow('7.0') === false) { |
56 | 53 | return; |
57 | 54 | } |
@@ -23,8 +23,7 @@ discard block |
||
23 | 23 | * @package PHPCompatibility |
24 | 24 | * @author Juliette Reinders Folmer <[email protected]> |
25 | 25 | */ |
26 | -class NewListReferenceAssignmentSniff extends NewKeyedListSniff |
|
27 | -{ |
|
26 | +class NewListReferenceAssignmentSniff extends NewKeyedListSniff { |
|
28 | 27 | /** |
29 | 28 | * The token(s) within the list construct which is being targeted. |
30 | 29 | * |
@@ -39,8 +38,7 @@ discard block |
||
39 | 38 | * |
40 | 39 | * @return bool |
41 | 40 | */ |
42 | - protected function bowOutEarly() |
|
43 | - { |
|
41 | + protected function bowOutEarly() { |
|
44 | 42 | return ($this->supportsBelow('7.2') === false); |
45 | 43 | } |
46 | 44 | |
@@ -53,8 +51,7 @@ discard block |
||
53 | 51 | * |
54 | 52 | * @return void |
55 | 53 | */ |
56 | - protected function examineList(File $phpcsFile, $opener, $closer) |
|
57 | - { |
|
54 | + protected function examineList(File $phpcsFile, $opener, $closer) { |
|
58 | 55 | $start = $opener; |
59 | 56 | while (($start = $this->hasTargetInList($phpcsFile, $start, $closer)) !== false) { |
60 | 57 | $phpcsFile->addError( |