-
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.
Add realodix style specification (#17)
- Loading branch information
Showing
4 changed files
with
257 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 |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<?php | ||
|
||
use PhpCsFixer\Fixer\Basic\{EncodingFixer, BracesFixer, unused_import}; | ||
use PhpCsFixer\Fixer\PhpTag\NoClosingTagFixer; | ||
|
||
use function is_array; | ||
use function is_int; | ||
|
||
/** | ||
* @property int $a | ||
* @property-read null|int $b | ||
* @property-write string $c | ||
*/ | ||
class RealodixSpec | ||
{ | ||
use Trait2, Trait3; | ||
use Trait1; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
const C2 = 2; | ||
|
||
/** @var int */ | ||
const C1 = 1; | ||
|
||
/** @var int */ | ||
protected static $protStatProp; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
public static $pubStatProp1; | ||
|
||
public $pubProp1; | ||
|
||
protected $protProp; | ||
|
||
public $pubProp2; | ||
|
||
private static $privStatProp; | ||
|
||
private $privProp; | ||
|
||
public static $pubStatProp2; | ||
|
||
public $pubProp3; | ||
|
||
public function __construct( | ||
public int $a, | ||
public ?int $b, | ||
public string $c | ||
) {} | ||
|
||
/** | ||
* Lorem Ipsum | ||
* | ||
* Lorem Ipsum is simply dummy text of the printing and typesetting industry. | ||
*/ | ||
public function comment() | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* @param null|string|boll $a comment | ||
* @return null|string|boll comment | ||
* | ||
* @throws \Exception | ||
*/ | ||
public function exampleMethod(null|string|boll $a = null): null|string|boll | ||
{ | ||
$a = null; | ||
if ($a === null || ! $a === true) { | ||
echo 'null'; | ||
} | ||
|
||
for ($i = 0; $i < 100; $i++) { | ||
if (true) { | ||
continue; | ||
} | ||
} | ||
|
||
$c = collect(\Illuminate\Support\Facades\Route::getRoutes()->get()) | ||
->map(fn(\Illuminate\Routing\Route $route) => $route->uri) | ||
->reject(fn($value) => ! preg_match('/^[a-zA-Z\-]+$/', $value)) | ||
->unique()->sort() | ||
->toArray(); | ||
|
||
return null; | ||
} | ||
|
||
public function array() | ||
{ | ||
return [ | ||
'@PER-CS' => true, | ||
'@PER-CS2.0' => true, | ||
'@DoctrineAnnotation' => true, | ||
'@PHP84Migration' => true, | ||
'@PhpCsFixer' => true, | ||
'@Symfony' => true, | ||
'@Symfony:risky' => true, | ||
]; | ||
} | ||
|
||
/** @test */ | ||
public function test_a(): void {} | ||
|
||
/** | ||
* @test | ||
* | ||
* @dataProvider validTypesProvider | ||
*/ | ||
public function test_b(?int $a): void {} | ||
|
||
public function realodixSpec() | ||
{ | ||
$func = [is_array(null), is_int(null)]; | ||
$class = [new EncodingFixer, new BracesFixer, new NoClosingTagFixer]; | ||
} | ||
} |
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,120 @@ | ||
<?php | ||
|
||
use PhpCsFixer\Fixer\Basic\{BracesFixer, EncodingFixer}; | ||
use PhpCsFixer\Fixer\PhpTag\NoClosingTagFixer; | ||
|
||
use function is_array; | ||
use function is_int; | ||
|
||
/** | ||
* @property int $a | ||
* @property-read null|int $b | ||
* @property-write string $c | ||
*/ | ||
class RealodixSpec | ||
{ | ||
use Trait1; | ||
use Trait2, Trait3; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
const C2 = 2; | ||
|
||
/** @var int */ | ||
const C1 = 1; | ||
|
||
/** @var int */ | ||
protected static $protStatProp; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
public static $pubStatProp1; | ||
|
||
public $pubProp1; | ||
|
||
protected $protProp; | ||
|
||
public $pubProp2; | ||
|
||
private static $privStatProp; | ||
|
||
private $privProp; | ||
|
||
public static $pubStatProp2; | ||
|
||
public $pubProp3; | ||
|
||
public function __construct( | ||
public int $a, | ||
public ?int $b, | ||
public string $c | ||
) {} | ||
|
||
/** | ||
* Lorem Ipsum | ||
* | ||
* Lorem Ipsum is simply dummy text of the printing and typesetting industry. | ||
*/ | ||
public function comment() | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* @param null|string|boll $a comment | ||
* @return null|string|boll comment | ||
* | ||
* @throws \Exception | ||
*/ | ||
public function exampleMethod(null|string|boll $a = null): null|string|boll | ||
{ | ||
$a = null; | ||
if ($a === null || ! $a === true) { | ||
echo 'null'; | ||
} | ||
|
||
for ($i = 0; $i < 100; $i++) { | ||
if (true) { | ||
continue; | ||
} | ||
} | ||
|
||
$c = collect(\Illuminate\Support\Facades\Route::getRoutes()->get()) | ||
->map(fn(\Illuminate\Routing\Route $route) => $route->uri) | ||
->reject(fn($value) => ! preg_match('/^[a-zA-Z\-]+$/', $value)) | ||
->unique()->sort() | ||
->toArray(); | ||
|
||
return null; | ||
} | ||
|
||
public function array() | ||
{ | ||
return [ | ||
'@PER-CS' => true, | ||
'@PER-CS2.0' => true, | ||
'@DoctrineAnnotation' => true, | ||
'@PHP84Migration' => true, | ||
'@PhpCsFixer' => true, | ||
'@Symfony' => true, | ||
'@Symfony:risky' => true, | ||
]; | ||
} | ||
|
||
/** @test */ | ||
public function test_a(): void {} | ||
|
||
/** | ||
* @test | ||
* @dataProvider validTypesProvider | ||
*/ | ||
public function test_b(?int $a): void {} | ||
|
||
public function realodixSpec() | ||
{ | ||
$func = [is_array(null), is_int(null)]; | ||
$class = [new EncodingFixer, new BracesFixer, new NoClosingTagFixer]; | ||
} | ||
} |
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,11 @@ | ||
<?php | ||
|
||
use PhpCsFixer\Finder; | ||
use Realodix\Relax\Config; | ||
use Realodix\Relax\RuleSet\Sets\RelaxPlus; | ||
|
||
$finder = (new Finder)->in('./tests/Integration/tmp'); | ||
|
||
return Config::create(new RelaxPlus) | ||
->setFinder($finder) | ||
->setUsingCache(false); |
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