-
Notifications
You must be signed in to change notification settings - Fork 0
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
652 changed files
with
19,345 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ | |
|
||
# Ignore files for distribution archives. | ||
/.* export-ignore | ||
/tests export-ignore |
19 changes: 19 additions & 0 deletions
19
tests/fixed/php-7.4/Fox91CodingStandard/ClassPropertySpacing.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,19 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Spacing; | ||
|
||
final class ClassPropertySpacing | ||
{ | ||
public bool $foo; | ||
|
||
/** @var array<string> */ | ||
public array $bar; | ||
|
||
/** @var array<string> */ | ||
public array $baz; | ||
|
||
public int $qux; | ||
|
||
public int $fred; | ||
} |
130 changes: 130 additions & 0 deletions
130
tests/fixed/php-7.4/Fox91CodingStandard/ControlStructures.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,130 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace ControlStructures; | ||
|
||
use InvalidArgumentException; | ||
use Throwable; | ||
|
||
use const PHP_VERSION; | ||
|
||
class ControlStructures | ||
{ | ||
private const VERSION = PHP_VERSION; | ||
|
||
/** @return iterable<int> */ | ||
public function varAndIfNoSpaceBetween(): iterable | ||
{ | ||
$var = 1; | ||
if (self::VERSION === 0) { | ||
yield 0; | ||
} | ||
} | ||
|
||
/** @return iterable<int> */ | ||
public function ifAndYieldSpaceBetween(): iterable | ||
{ | ||
if (self::VERSION === 0) { | ||
yield 0; | ||
} | ||
yield 1; | ||
} | ||
|
||
/** @return iterable<int> */ | ||
public function ifAndYieldFromSpaceBetween(): iterable | ||
{ | ||
if (self::VERSION === 0) { | ||
yield 0; | ||
} | ||
yield from []; | ||
} | ||
|
||
public function ifAndThrowSpaceBetween(): void | ||
{ | ||
if (self::VERSION === 0) { | ||
return; | ||
} | ||
throw new InvalidArgumentException(); | ||
} | ||
|
||
public function ifAndReturnSpaceBetween(): int | ||
{ | ||
if (self::VERSION === 0) { | ||
return 0; | ||
} | ||
|
||
return 1; | ||
} | ||
|
||
public function noSpaceAroundCase(): void | ||
{ | ||
switch (self::VERSION) { | ||
case 1: | ||
case 2: | ||
// do something | ||
break; | ||
case 3: | ||
// do something else | ||
break; | ||
default: | ||
} | ||
} | ||
|
||
public function spaceBelowBlocks(): void | ||
{ | ||
if (true) { | ||
echo 1; | ||
} | ||
do { | ||
echo 2; | ||
} while (true); | ||
while (true) { | ||
echo 3; | ||
} | ||
for ($i = 0; $i < 1; $i++) { | ||
echo $i; | ||
} | ||
foreach ([] as $item) { | ||
echo $item; | ||
} | ||
switch (true) { | ||
default: | ||
} | ||
try { | ||
echo 4; | ||
} catch (Throwable) { | ||
} | ||
echo 5; | ||
} | ||
|
||
public function spaceAroundMultilineIfs(): void | ||
{ | ||
if (true | ||
&& false | ||
) { | ||
echo 1; | ||
} elseif (false | ||
|| true | ||
) { | ||
echo 2; | ||
} | ||
} | ||
|
||
public function spacingAroundCasesWithBreakAndReturn(): void | ||
{ | ||
switch (true) { | ||
case 1: | ||
throw new InvalidArgumentException(); | ||
|
||
case 2: | ||
return; | ||
|
||
case 3: | ||
break; | ||
|
||
case 4: | ||
echo 1; | ||
|
||
} | ||
} | ||
} |
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,51 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Example; | ||
|
||
class EarlyReturn | ||
{ | ||
public function bar(): bool | ||
{ | ||
if ($bar === 'bar') { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
public function foo(): ?string | ||
{ | ||
foreach ($items as $item) { | ||
if (!($item->isItem())) { | ||
return 'There is an item that is not an item'; | ||
} else { | ||
continue; | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
|
||
public function baz(): string | ||
{ | ||
if ($number > 0) { | ||
return 'Number is grater then 0'; | ||
} else { | ||
exit; | ||
} | ||
} | ||
|
||
public function quoox(): bool | ||
{ | ||
if (true === 'true') { | ||
if (false === false) { | ||
return true; | ||
} | ||
} else { | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
tests/fixed/php-7.4/Fox91CodingStandard/ExampleBackedEnum.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,8 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace ExampleBackedEnum; | ||
|
||
enum ExampleBackedEnum : int | ||
{ | ||
} |
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,12 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Exceptions; | ||
|
||
use Exception; | ||
use Throwable; | ||
|
||
try { | ||
throw new Exception(); | ||
} catch (Throwable $throwable) { | ||
} |
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,17 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Types; | ||
|
||
class LowCaseTypes | ||
{ | ||
public function stringToInt(String $string): int | ||
{ | ||
return (int) $string; | ||
} | ||
|
||
public function returnString(): String | ||
{ | ||
return 'foo'; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
tests/fixed/php-7.4/Fox91CodingStandard/NamingCamelCase.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,21 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Example; | ||
|
||
class NamingCamelCase | ||
{ | ||
/** @var mixed */ | ||
public $A; | ||
|
||
/** @var mixed */ | ||
protected $B; | ||
|
||
/** @var mixed */ | ||
private $C; | ||
|
||
public function fcn(string $A): void | ||
{ | ||
$Test = $A; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
tests/fixed/php-7.4/Fox91CodingStandard/PropertyDeclaration.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,20 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Spacing; | ||
|
||
final class PropertyDeclaration | ||
{ | ||
public bool $boolPropertyWithDefaultValue = false; | ||
|
||
public string $stringProperty; | ||
|
||
public int $intProperty; | ||
|
||
public ? string $nullableString = null; | ||
|
||
public function __construct( | ||
public readonly Foo $foo, | ||
) { | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
tests/fixed/php-7.4/Fox91CodingStandard/TrailingCommaOnFunctions.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,42 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Doctrine; | ||
|
||
use function var_dump; | ||
|
||
// phpcs:disable PSR1.Files.SideEffects | ||
|
||
class TrailingCommaOnFunctions | ||
{ | ||
public function a(int $arg,): void | ||
{ | ||
} | ||
|
||
public function b( | ||
int $arg | ||
): void { | ||
} | ||
|
||
public function uses(): void | ||
{ | ||
$var = null; | ||
|
||
$singleLine = static function (int $arg) use ($var,): void { | ||
var_dump($var); | ||
}; | ||
|
||
$multiLine = static function (int $arg) use ( | ||
$var | ||
): void { | ||
var_dump($var); | ||
}; | ||
} | ||
} | ||
|
||
$class = new TrailingCommaOnFunctions(); | ||
|
||
// phpcs:ignore Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma | ||
$class->a(1,); | ||
|
||
$class->a(1); |
16 changes: 16 additions & 0 deletions
16
tests/fixed/php-7.4/Fox91CodingStandard/UnusedVariables.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,16 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Example; | ||
|
||
class UnusedVariables | ||
{ | ||
public function unusedInheritedVariablePassedToClosure(): void | ||
{ | ||
$foo = 'foo'; | ||
|
||
$bar = static function () use ($foo): int { | ||
return 1; | ||
}; | ||
} | ||
} |
Oops, something went wrong.