Skip to content

Commit 41ace00

Browse files
cs fixes
1 parent d154369 commit 41ace00

File tree

2 files changed

+69
-66
lines changed

2 files changed

+69
-66
lines changed

tests/Php85/DelayedTargetValidationTest.php

Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -11,78 +11,76 @@
1111

1212
namespace Symfony\Polyfill\Tests\Php85;
1313

14-
use Attribute;
15-
use DelayedTargetValidation;
1614
use PHPUnit\Framework\TestCase;
17-
use ReflectionClass;
18-
use ReflectionClassConstant;
19-
use ReflectionFunction;
20-
use ReflectionMethod;
21-
use ReflectionParameter;
22-
use ReflectionProperty;
2315

24-
#[DelayedTargetValidation]
25-
class HasAttribute {
26-
#[DelayedTargetValidation]
27-
private $prop;
16+
#[\DelayedTargetValidation]
17+
class HasAttribute
18+
{
19+
#[\DelayedTargetValidation]
20+
private $prop;
2821

29-
#[DelayedTargetValidation]
30-
public const FOO = 'BAR';
22+
#[\DelayedTargetValidation]
23+
public const FOO = 'BAR';
3124

32-
#[DelayedTargetValidation]
33-
public function __construct(
34-
#[DelayedTargetValidation] $param
35-
) {}
25+
#[\DelayedTargetValidation]
26+
public function __construct(
27+
#[\DelayedTargetValidation] $param,
28+
) {
29+
}
3630
}
3731

38-
#[DelayedTargetValidation]
39-
function globalFunc() {}
32+
#[\DelayedTargetValidation]
33+
function globalFunc()
34+
{
35+
}
4036

4137
/**
4238
* @author Daniel Scherzer <[email protected]>
39+
*
4340
* @requires PHP >= 8.0
4441
*/
4542
class DelayedTargetValidationTest extends TestCase
4643
{
4744
public function testAttributeAttribute()
4845
{
49-
$ref = new ReflectionClass(\DelayedTargetValidation::class);
50-
$attributes = $ref->getAttributes();
51-
$this->assertCount(1, $attributes);
52-
$attribute = $attributes[0];
53-
$this->assertSame('Attribute', $attribute->getName());
54-
$args = $attribute->getArguments();
55-
$this->assertCount(1, $args);
56-
$this->assertSame(Attribute::TARGET_ALL, $args[0]);
46+
$ref = new \ReflectionClass(\DelayedTargetValidation::class);
47+
$attributes = $ref->getAttributes();
48+
$this->assertCount(1, $attributes);
49+
$attribute = $attributes[0];
50+
$this->assertSame('Attribute', $attribute->getName());
51+
$args = $attribute->getArguments();
52+
$this->assertCount(1, $args);
53+
$this->assertSame(\Attribute::TARGET_ALL, $args[0]);
5754
$this->expectException(\ReflectionException::class);
5855
$this->expectExceptionMessage('Constant "missing" does not exist');
5956
new \ReflectionConstant('missing');
6057
}
6158

62-
/**
63-
* @dataProvider provideReflectionInstances
64-
*/
65-
public function testTargetValidation($reflectionSource)
66-
{
67-
$attributes = $reflectionSource->getAttributes();
68-
$this->assertCount(1, $attributes);
69-
$attrib = $attributes[0];
70-
$this->assertSame('DelayedTargetValidation', $attrib->getName());
71-
$this->assertSame([], $attrib->getArguments());
72-
$this->assertInstanceOf(
73-
DelayedTargetValidation::class,
74-
$attrib->newInstance()
75-
);
76-
}
59+
/**
60+
* @dataProvider provideReflectionInstances
61+
*/
62+
public function testTargetValidation($reflectionSource)
63+
{
64+
$attributes = $reflectionSource->getAttributes();
65+
$this->assertCount(1, $attributes);
66+
$attrib = $attributes[0];
67+
$this->assertSame('DelayedTargetValidation', $attrib->getName());
68+
$this->assertSame([], $attrib->getArguments());
69+
$this->assertInstanceOf(
70+
\DelayedTargetValidation::class,
71+
$attrib->newInstance()
72+
);
73+
}
7774

78-
public static function provideReflectionInstances() {
79-
yield 'Class' => [ new ReflectionClass(HasAttribute::class) ];
80-
yield 'Property' => [ new ReflectionProperty(HasAttribute::class, 'prop')];
81-
yield 'Class constant' => [ new ReflectionClassConstant(HasAttribute::class, 'FOO')];
82-
yield 'Method' => [ new ReflectionMethod(HasAttribute::class, '__construct')];
83-
yield 'Parameter' => [
84-
new ReflectionParameter([HasAttribute::class, '__construct'], 'param')
85-
];
86-
yield 'Function' => [ new ReflectionFunction(__NAMESPACE__ . '\\globalFunc') ];
87-
}
75+
public static function provideReflectionInstances()
76+
{
77+
yield 'Class' => [new \ReflectionClass(HasAttribute::class)];
78+
yield 'Property' => [new \ReflectionProperty(HasAttribute::class, 'prop')];
79+
yield 'Class constant' => [new \ReflectionClassConstant(HasAttribute::class, 'FOO')];
80+
yield 'Method' => [new \ReflectionMethod(HasAttribute::class, '__construct')];
81+
yield 'Parameter' => [
82+
new \ReflectionParameter([HasAttribute::class, '__construct'], 'param'),
83+
];
84+
yield 'Function' => [new \ReflectionFunction(__NAMESPACE__.'\\globalFunc')];
85+
}
8886
}

tests/Php85/Php85Test.php

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
class Php85Test extends TestCase
1717
{
1818
/**
19-
* @dataProvider provideHandler
20-
*/
19+
* @dataProvider provideHandler
20+
*/
2121
public function testGetErrorHandler($expected, $handler): void
2222
{
2323
set_error_handler($handler);
@@ -36,8 +36,8 @@ public function testErrorStableReturnValue(): void
3636
}
3737

3838
/**
39-
* @dataProvider provideHandler
40-
*/
39+
* @dataProvider provideHandler
40+
*/
4141
public function testGetExceptionHandler($expected, $handler): void
4242
{
4343
set_exception_handler($handler);
@@ -53,7 +53,6 @@ public function testGetExceptionHandler($expected, $handler): void
5353
public function testExceptionStableReturnValue(): void
5454
{
5555
$this->assertSame(get_exception_handler(), get_exception_handler());
56-
5756
}
5857

5958
public static function provideHandler()
@@ -90,7 +89,6 @@ public function testArrayFirstArrayLast()
9089
$this->assertNull(array_first([]));
9190
$this->assertNull(array_last([]));
9291

93-
9492
$this->assertSame('single element', array_first(['single element']));
9593
$this->assertSame('single element', array_last(['single element']));
9694

@@ -110,21 +108,28 @@ public function testArrayFirstArrayLast()
110108
$this->assertSame([], array_first([100 => []]));
111109
$this->assertSame([], array_last([100 => []]));
112110

113-
$this->assertEquals(new \stdClass(), array_first([new \stdClass, false]));
114-
$this->assertFalse(array_last([new \stdClass, false]));
111+
$this->assertEquals(new \stdClass(), array_first([new \stdClass(), false]));
112+
$this->assertFalse(array_last([new \stdClass(), false]));
115113

116-
$this->assertTrue(array_first([true, new \stdClass]));
117-
$this->assertEquals(new \stdClass(), array_last([true, new \stdClass]));
114+
$this->assertTrue(array_first([true, new \stdClass()]));
115+
$this->assertEquals(new \stdClass(), array_last([true, new \stdClass()]));
118116
}
119117
}
120118

121119
class TestHandler
122120
{
123-
public static function handleStatic() {}
124-
public function handle() {}
121+
public static function handleStatic()
122+
{
123+
}
124+
125+
public function handle()
126+
{
127+
}
125128
}
126129

127130
class TestHandlerInvokable
128131
{
129-
public function __invoke() {}
132+
public function __invoke()
133+
{
134+
}
130135
}

0 commit comments

Comments
 (0)