Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
58 changed files
with
762 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
[1, 2, 3]; | ||
|
||
[ | ||
1, | ||
2, | ||
[ | ||
3, | ||
5, | ||
], | ||
5, | ||
]; | ||
|
||
[ | ||
1, | ||
2, | ||
3, | ||
]; | ||
|
||
[ | ||
1, | ||
2, | ||
[ | ||
3, | ||
5, | ||
], | ||
5, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
[1, 2, 3]; | ||
|
||
[ | ||
1, | ||
2, | ||
[ | ||
3, | ||
5, | ||
], | ||
5 | ||
]; | ||
|
||
[ | ||
1, | ||
2, | ||
3 | ||
]; | ||
|
||
[ | ||
1, | ||
2, | ||
[ | ||
3, | ||
5 | ||
], | ||
5, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
class ClassWithOnlyPublicElements | ||
{ | ||
|
||
public $publicProperty; | ||
|
||
public function foo() | ||
{ | ||
$this->usedProperty->foo(); | ||
$this->usedPrivateMethod(); | ||
} | ||
|
||
public function publicMethod() | ||
{ | ||
|
||
} | ||
|
||
public static function staticPublicMethod() | ||
{ | ||
self::usedStaticPrivateMethod(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
class ClassWithSpecialSelf | ||
{ | ||
|
||
const CONSTANT = 0; | ||
|
||
const CONSTANT2 = 0; | ||
|
||
private $property; | ||
|
||
public function specialSelf() | ||
{ | ||
self::${'CONSTANT'} = self::CONSTANT2; | ||
$this->property = self::CONSTANT; | ||
} | ||
|
||
public function returnProperty() | ||
{ | ||
return $this->property; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
class ClassWithSpecialThis | ||
{ | ||
|
||
public $publicProperty; | ||
|
||
public $publicProperty2; | ||
|
||
private $property; | ||
|
||
public function specialThis() | ||
{ | ||
$this->{'publicProperty'} = $this->publicProperty2; | ||
$this->property = $this; | ||
} | ||
|
||
public function returnProperty() | ||
{ | ||
return $this->property; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
tests/Sniffs/ControlStructures/data/fixableYodaComparisons.fixed.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
$foo === 123; | ||
$foo === true; | ||
$foo === false; | ||
$foo === null; | ||
$foo === []; | ||
BAR === 123; | ||
Foo::BAR === 123; | ||
Foo::BAR === 123.0; | ||
$e === \Foo\Bar::BAR; | ||
foo() === Foo::BAR; | ||
foo() + 2 === Foo::BAR; | ||
$foo === Foo::BAR; | ||
$foo + 2 === Foo::BAR; | ||
$this->foo() === Foo::BAR; | ||
$foo === -1; | ||
$foo === +1; | ||
(foo() === BAR|| ( | ||
Foo::BAR === ['test'])) ? Foo::BAR === 123.0: $foo === null; | ||
|
||
if ( | ||
$foo($bar) === [Foo::BAR, Foo::BAZ] && ( | ||
$bar === true || | ||
$bar === null | ||
) | ||
) { | ||
} |
Oops, something went wrong.