99
1010class UselessConditions
1111{
12- public function uselessCondition () : bool
12+ public function uselessCondition (): bool
1313 {
1414 return $ foo === 'foo ' ;
1515 }
1616
17- public function uselessIfCondition () : bool
17+ public function uselessIfCondition (): bool
1818 {
1919 return $ bar === 'bar ' ;
2020 }
2121
22- public function uselessNegativeCondition () : bool
22+ public function uselessNegativeCondition (): bool
2323 {
2424 return $ foo === 'foo ' ;
2525 }
2626
27- public function uselessIfNegativeCondition () : bool
27+ public function uselessIfNegativeCondition (): bool
2828 {
2929 return $ bar !== 'bar ' ;
3030 }
3131
32- public function unecessaryIfMethodForEarlyReturn () : bool
32+ public function unecessaryIfMethodForEarlyReturn (): bool
3333 {
3434 if ($ bar === 'bar ' ) {
3535 return false ;
@@ -42,7 +42,7 @@ public function unecessaryIfMethodForEarlyReturn() : bool
4242 return $ baz !== 'baz ' ;
4343 }
4444
45- public function uselessIfConditionWithParameter (bool $ bool ) : bool
45+ public function uselessIfConditionWithParameter (bool $ bool ): bool
4646 {
4747 if ($ bool ) {
4848 return false ;
@@ -51,7 +51,7 @@ public function uselessIfConditionWithParameter(bool $bool) : bool
5151 return true ;
5252 }
5353
54- public function uselessIfConditionWithBoolMethod () : bool
54+ public function uselessIfConditionWithBoolMethod (): bool
5555 {
5656 if ($ this ->isTrue ()) {
5757 return false ;
@@ -60,22 +60,22 @@ public function uselessIfConditionWithBoolMethod() : bool
6060 return true ;
6161 }
6262
63- public function uselessIfConditionWithComplexIf () : bool
63+ public function uselessIfConditionWithComplexIf (): bool
6464 {
6565 return $ bar === 'bar ' && $ foo === 'foo ' && $ baz !== 'quox ' ;
6666 }
6767
68- public function uselessIfConditionWithEvenMoreComplexIf () : bool
68+ public function uselessIfConditionWithEvenMoreComplexIf (): bool
6969 {
7070 return $ bar === 'bar ' || $ foo === 'foo ' || $ baz !== 'quox ' ;
7171 }
7272
73- public function uselessIfConditionWithComplexCondition () : bool
73+ public function uselessIfConditionWithComplexCondition (): bool
7474 {
7575 return $ bar !== 'bar ' && $ foo !== 'foo ' && $ baz === 'quox ' ;
7676 }
7777
78- public function uselessIfConditionWithTernary () : bool
78+ public function uselessIfConditionWithTernary (): bool
7979 {
8080 if ($ this ->isTrue ()) {
8181 return $ this ->isTrulyTrue () ? true : false ;
@@ -84,7 +84,7 @@ public function uselessIfConditionWithTernary() : bool
8484 return false ;
8585 }
8686
87- public function necessaryIfConditionWithMethodCall () : bool
87+ public function necessaryIfConditionWithMethodCall (): bool
8888 {
8989 if ($ this ->shouldBeQueued ()) {
9090 $ this ->queue ();
@@ -95,7 +95,7 @@ public function necessaryIfConditionWithMethodCall() : bool
9595 return false ;
9696 }
9797
98- public function nullShouldNotBeTreatedAsFalse () : ?bool
98+ public function nullShouldNotBeTreatedAsFalse (): ?bool
9999 {
100100 if (! $ this ->isAdmin ) {
101101 return null ;
@@ -104,30 +104,30 @@ public function nullShouldNotBeTreatedAsFalse() : ?bool
104104 return true ;
105105 }
106106
107- public function uselessTernary () : bool
107+ public function uselessTernary (): bool
108108 {
109109 return $ foo !== 'bar ' ;
110110 }
111111
112- public function uselessTernaryWithParameter (bool $ condition ) : bool
112+ public function uselessTernaryWithParameter (bool $ condition ): bool
113113 {
114114 return $ condition ? true : false ;
115115 }
116116
117- public function uselessTernaryWithMethod () : bool
117+ public function uselessTernaryWithMethod (): bool
118118 {
119119 return $ this ->isFalse () ? true : false ;
120120 }
121121
122122 /**
123123 * @param string[] $words
124124 */
125- public function uselessTernaryCheck (array $ words ) : bool
125+ public function uselessTernaryCheck (array $ words ): bool
126126 {
127127 return count ($ words ) < 1 ;
128128 }
129129
130- public function necessaryTernary () : int
130+ public function necessaryTernary (): int
131131 {
132132 return strpos ('foo ' , 'This is foo and bar ' ) !== false ? 1 : 0 ;
133133 }
0 commit comments