-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extra test scenarios #208
base: 8.2.x
Are you sure you want to change the base?
Extra test scenarios #208
Changes from all commits
ee60899
20a0567
9f66c9f
768a777
11c71d8
3d5a35d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
declare(strict_types=1); | ||
|
||
$array = [ | ||
0, | ||
0, // this is the first index | ||
1, | ||
2, | ||
3, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
namespace Test; | ||
|
||
use function array_map; | ||
use function chop; | ||
use function compact; | ||
use function extract; | ||
|
@@ -28,3 +29,5 @@ | |
extract($bar); | ||
|
||
compact('foo', 'bar'); | ||
|
||
array_map('is_null', ['1', '2', null]); // forbidden function will not be detected | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI codesniffer can not detect these.. is this fine? |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
|
||
$args = [123, [123], true]; | ||
in_array(...$args); | ||
in_array(...$args); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,6 @@ | |
$qb->select() | ||
->from() | ||
->where(); | ||
|
||
$qb->select() | ||
->from('mytable'); // we select from my table |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,10 @@ class FooException extends RuntimeException | |
{ | ||
} | ||
|
||
class FooError extends Error | ||
{ | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is superfluous but not reported.. i guess there is no existing rule for this |
||
interface FooInterface | ||
{ | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,17 @@ | |
for (;;) { | ||
echo 'To infity and beyond'; | ||
} | ||
|
||
for ( | ||
$i = 0; $i < 10; | ||
$i++ | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
{ | ||
echo 'This will not be executed inside the for-loop'; | ||
} | ||
|
||
{ | ||
$var = 'This is useless'; | ||
}; | ||
|
||
$myvar = 3; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,17 @@ public function uselessIfCondition(): bool | |
return false; | ||
} | ||
|
||
public function uselessIfConditionWithComment(): bool | ||
{ | ||
if ($bar === 'bar') { | ||
// Return true here in case $bar is bar | ||
return true; | ||
} | ||
|
||
// Return true here in case $bar is bar | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
return false; | ||
} | ||
|
||
public function uselessNegativeCondition(): bool | ||
{ | ||
if ($foo !== 'foo') { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
declare(strict_types=1); | ||
|
||
$array = [ | ||
0, | ||
0, // this is the first index | ||
1, | ||
2, | ||
3, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ class Example implements \IteratorAggregate | |
{ | ||
private const VERSION = \PHP_VERSION - (PHP_MINOR_VERSION * 100) - PHP_PATCH_VERSION; | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI currently there is no sniff included that fixes the extra lines inside a class.. it does fix the extra lines between functions but it does not look inside the whole class. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SlevomatCodingStandard.Classes.ClassMemberSpacing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great.. will create a new PR with that.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are also:
|
||
/** @var null|int */ | ||
private $foo; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
|
||
$args = [123, [123], true]; | ||
in_array(...$args); | ||
\in_array(...$args); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,7 @@ | |
->from() | ||
->where() | ||
; | ||
|
||
$qb->select() | ||
->from('mytable') // we select from my table | ||
; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,8 @@ | |
'key1' => 'value', | ||
'key2' => 'value' | ||
]; | ||
|
||
$arrayWithComment = [ | ||
'key1' => 'value', | ||
'key2' => 'value' // comment | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to handle these?