Skip to content

Commit 121d1cf

Browse files
committed
Apply fixes from StyleCI
1 parent 25ab13a commit 121d1cf

File tree

3 files changed

+42
-28
lines changed

3 files changed

+42
-28
lines changed

tests/ReflectionClosurePhp80Test.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
});
7070

7171
test('trailing comma', function () {
72-
$f1 = function (string $param, ) {
72+
$f1 = function (string $param) {
7373
};
7474
$e1 = 'function (string $param, ) {
7575
}';
@@ -190,7 +190,7 @@ function reflection_closure_php_80_switch_statement_test_is_two($a)
190190

191191
class ReflectionClosurePhp80InstanceOfTest
192192
{
193-
};
193+
}
194194

195195
class ReflectionClosurePhp80SwitchStatementTest
196196
{
@@ -202,7 +202,7 @@ class ReflectionClosurePhp80SwitchStatementTest
202202

203203
return [
204204
$b,
205-
($a instanceof DateTime || $a instanceof ReflectionClosurePhp80InstanceOfTest || $a instanceof RegularClass),
205+
$a instanceof DateTime || $a instanceof ReflectionClosurePhp80InstanceOfTest || $a instanceof RegularClass,
206206
(function (object $a): bool {
207207
return ($a instanceof DateTime || $a instanceof ReflectionClosurePhp80InstanceOfTest || $a instanceof RegularClass) === true;
208208
})(a: $a),
@@ -235,11 +235,11 @@ class ReflectionClosurePhp80SwitchStatementTest
235235
return 'three';
236236
case (new ReflectionClosurePhp80SwitchStatementTest)->isFour(a: $a):
237237
return 'four';
238-
case ($a instanceof ReflectionClosurePhp80SwitchStatementTest):
238+
case $a instanceof ReflectionClosurePhp80SwitchStatementTest:
239239
return 'five';
240-
case ($a instanceof DateTime):
240+
case $a instanceof DateTime:
241241
return 'six';
242-
case ($a instanceof RegularClass):
242+
case $a instanceof RegularClass:
243243
return 'seven';
244244
default:
245245
return 'other';

tests/ReflectionClosurePhp81Test.php

+14-10
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
use Some\ClassName as ClassAlias;
55
use Tests\Fixtures\Model;
66
use Tests\Fixtures\RegularClass;
7+
78
use function Tests\Fixtures\{makeModel};
89

9-
enum GlobalEnum {
10+
enum GlobalEnum
11+
{
1012
case Admin;
1113
case Guest;
1214
case Moderator;
@@ -15,7 +17,7 @@ enum GlobalEnum {
1517
test('named arguments', function () {
1618
$variable = new RegularClass();
1719

18-
$f1 = function (string $a1) use ($variable) {
20+
$f1 = function (string $a1) {
1921
return new RegularClass(
2022
a1: $a1,
2123
a2: 'string',
@@ -108,7 +110,7 @@ enum GlobalEnum {
108110
a13: RegularClass::staticMethod(),
109111
a14: (new RegularClass())->instanceMethod(),
110112
),
111-
a17: function () use ($variable) {
113+
a17: function () {
112114
return new RegularClass(
113115
a1: $a1,
114116
a2: 'string',
@@ -303,7 +305,8 @@ enum GlobalEnum {
303305

304306
expect($f)->toBeCode($e);
305307

306-
enum ScopedEnum {
308+
enum ScopedEnum
309+
{
307310
case Admin;
308311
case Guest;
309312
case Moderator;
@@ -320,15 +323,14 @@ enum ScopedEnum {
320323
expect($f)->toBeCode($e);
321324
});
322325

323-
324-
enum GlobalBackedEnum: string {
326+
enum GlobalBackedEnum: string
327+
{
325328
case Admin = 'Administrator';
326329
case Guest = 'Guest';
327330
case Moderator = 'Moderator';
328331
}
329332

330333
test('backed enums', function () {
331-
332334
$f = function (GlobalBackedEnum $role) {
333335
return $role;
334336
};
@@ -339,7 +341,8 @@ enum GlobalBackedEnum: string {
339341

340342
expect($f)->toBeCode($e);
341343

342-
enum ScopedBackedEnum: string {
344+
enum ScopedBackedEnum: string
345+
{
343346
case Admin = 'Administrator';
344347
case Guest = 'Guest';
345348
case Moderator = 'Moderator';
@@ -572,7 +575,7 @@ enum ScopedBackedEnum: string {
572575
return true;
573576
};
574577

575-
$e = <<<EOF
578+
$e = <<<'EOF'
576579
#[MyAttribute()]
577580
function () {
578581
return true;
@@ -701,7 +704,8 @@ public function getSelf(self $instance): self
701704
}
702705
}
703706

704-
enum ReflectionClosureGlobalEnum {
707+
enum ReflectionClosureGlobalEnum
708+
{
705709
case Admin;
706710
case Guest;
707711
case Moderator;

tests/SerializerPhp81Test.php

+22-12
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
expect($f())->toBe(SerializerGlobalEnum::Admin);
2828

2929
if (! enum_exists(SerializerScopedEnum::class)) {
30-
enum SerializerScopedEnum {
30+
enum SerializerScopedEnum
31+
{
3132
case Admin;
3233
case Guest;
3334
case Moderator;
@@ -86,7 +87,8 @@ enum SerializerScopedEnum {
8687
expect($f())->toBe(SerializerGlobalBackedEnum::Admin);
8788

8889
if (! enum_exists(SerializerScopedBackedEnum::class)) {
89-
enum SerializerScopedBackedEnum: string {
90+
enum SerializerScopedBackedEnum: string
91+
{
9092
case Admin = 'Administrator';
9193
case Guest = 'Guest';
9294
case Moderator = 'Moderator';
@@ -396,7 +398,7 @@ enum SerializerScopedBackedEnum: string {
396398
test('named arguments', function () {
397399
$variable = 'variableValue';
398400

399-
$f = function (string $a1) use ($variable) {
401+
$f = function (string $a1) {
400402
return new RegularClass(
401403
a1: $a1,
402404
a2: 'string',
@@ -489,7 +491,7 @@ enum SerializerScopedBackedEnum: string {
489491
a13: RegularClass::staticMethod(),
490492
a14: (new RegularClass())->instanceMethod(),
491493
),
492-
a17: function () use ($variable) {
494+
a17: function () {
493495
return new RegularClass(
494496
a1: $a1,
495497
a2: 'string',
@@ -566,7 +568,6 @@ enum SerializerScopedBackedEnum: string {
566568
$reflector = new ReflectionFunction($f);
567569

568570
expect($reflector->getAttributes())->sequence(function ($attribute) {
569-
570571
$attribute
571572
->getName()->toBe(MyAttribute::class)
572573
->getArguments()->toBe([
@@ -603,16 +604,23 @@ enum SerializerScopedBackedEnum: string {
603604
expect($f())->toBeInstanceOf(SerializerPhp81Service::class);
604605
})->with('serializers');
605606

606-
interface SerializerPhp81HasId {}
607-
interface SerializerPhp81HasName {}
607+
interface SerializerPhp81HasId
608+
{
609+
}
610+
interface SerializerPhp81HasName
611+
{
612+
}
608613

609-
class SerializerPhp81Child extends SerializerPhp81Parent {}
614+
class SerializerPhp81Child extends SerializerPhp81Parent
615+
{
616+
}
610617

611618
class SerializerPhp81Parent
612619
{
613620
public function __construct(
614621
public readonly int $property = 1,
615-
) {}
622+
) {
623+
}
616624
}
617625

618626
class SerializerPhp81Service implements SerializerPhp81HasId, SerializerPhp81HasName
@@ -686,19 +694,21 @@ public function getSelf(self $instance): self
686694
}
687695
}
688696

689-
enum SerializerGlobalEnum {
697+
enum SerializerGlobalEnum
698+
{
690699
case Admin;
691700
case Guest;
692701
case Moderator;
693702
}
694703

695-
enum SerializerGlobalBackedEnum: string {
704+
enum SerializerGlobalBackedEnum: string
705+
{
696706
case Admin = 'Administrator';
697707
case Guest = 'Guest';
698708
case Moderator = 'Moderator';
699709
}
700710

701-
#[Attribute(Attribute::TARGET_METHOD|Attribute::TARGET_FUNCTION)]
711+
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_FUNCTION)]
702712
class MyAttribute
703713
{
704714
public function __construct(public $string, public $model)

0 commit comments

Comments
 (0)