Skip to content

Commit

Permalink
Added arrays to test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
gmponos committed Oct 15, 2018
1 parent bb4a456 commit 093ec1b
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function process(File $phpcsFile, $stackPtr)
if (in_array(
$tokens[$nextIndex]['code'],
[
T_CLOSE_SHORT_ARRAY,
T_OPEN_SHORT_ARRAY,
T_TRUE,
T_FALSE,
T_NULL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,33 @@ if($value == null){}
if(null === $value){}
if(null == $value){}

if(
$value
===
null
){}
if(
null
===
$value
){}

// check string comparison
if($value === 'string'){}
if($value == 'string'){}
if('string' === $value){}
if('string' == $value){}

if([] === $value){}
if($value === [] ){}
if([] == $value){}
if($value == [] ){}

if($value === array()){}
if($value == array()){}
if(array() === $value){}
if(array() == $value){}

// check string comparison
$assigned = $value === 'string';
$assigned = 'string' == $value;
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ public function getErrorList()
19 => 1,
30 => 1,
31 => 1,
36 => 1,
37 => 1,
41 => 1,
40 => 1,
47 => 1,
48 => 1,
50 => 1,
52 => 1,
57 => 1,
58 => 1,
62 => 1,
];

}//end getErrorList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,33 @@ if($value == null){}
if(null === $value){}
if(null == $value){}

if(
$value
===
null
){}
if(
null
===
$value
){}

// check string comparison
if($value === 'string'){}
if($value == 'string'){}
if('string' === $value){}
if('string' == $value){}

if([] === $value){}
if($value === [] ){}
if([] == $value){}
if($value == [] ){}

if($value === array()){}
if($value == array()){}
if(array() === $value){}
if(array() == $value){}

// check string comparison
$assigned = $value === 'string';
$assigned = 'string' == $value;
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ public function getErrorList()
17 => 1,
28 => 1,
29 => 1,
34 => 1,
35 => 1,
40 => 1,
45 => 1,
46 => 1,
51 => 1,
53 => 1,
55 => 1,
56 => 1,
61 => 1,
];

}//end getErrorList()
Expand Down

0 comments on commit 093ec1b

Please sign in to comment.