Skip to content

Commit 0f9c3bf

Browse files
Nielsvanpachgithub-actions[bot]
authored andcommitted
Fix styling
1 parent 69f7019 commit 0f9c3bf

14 files changed

+42
-47
lines changed

example/tests/OrderSerializerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class OrderSerializerTest extends TestCase
1313
/** @test */
1414
public function it_can_serialize_an_order()
1515
{
16-
$orderSerializer = new OrderSerializer();
16+
$orderSerializer = new OrderSerializer;
1717

1818
$order = new Order(1, '[email protected]', true, [
1919
new OrderLine(1, 'Sublime Text License', 70, 3),

src/Drivers/ImageDriver.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ class ImageDriver implements Driver
1414
public function __construct(
1515
protected float $threshold = 0.1,
1616
protected bool $includeAa = true,
17-
) {
18-
}
17+
) {}
1918

2019
public function serialize($data): string
2120
{

src/Drivers/ObjectDriver.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ class ObjectDriver implements Driver
1515
public function serialize($data): string
1616
{
1717
$normalizers = [
18-
new DateTimeNormalizer(),
19-
new ObjectNormalizer(),
18+
new DateTimeNormalizer,
19+
new ObjectNormalizer,
2020
];
2121

2222
$encoders = [
23-
new YamlEncoder(),
23+
new YamlEncoder,
2424
];
2525

2626
$serializer = new Serializer($normalizers, $encoders);

src/Exceptions/CantBeSerialized.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44

55
use Exception;
66

7-
class CantBeSerialized extends Exception
8-
{
9-
}
7+
class CantBeSerialized extends Exception {}

src/Filesystem.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
class Filesystem
66
{
7-
public function __construct(private string $basePath)
8-
{
9-
}
7+
public function __construct(private string $basePath) {}
108

119
public static function inDirectory(string $path): self
1210
{

src/MatchesSnapshots.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ public function assertMatchesSnapshot($actual, ?Driver $driver = null): void
6060
}
6161

6262
if (is_string($actual) || is_int($actual) || is_float($actual)) {
63-
$this->doSnapshotAssertion($actual, new TextDriver());
63+
$this->doSnapshotAssertion($actual, new TextDriver);
6464

6565
return;
6666
}
6767

68-
$this->doSnapshotAssertion($actual, new ObjectDriver());
68+
$this->doSnapshotAssertion($actual, new ObjectDriver);
6969
}
7070

7171
public function assertMatchesFileHashSnapshot(string $filePath): void
@@ -86,32 +86,32 @@ public function assertMatchesFileSnapshot(string $file): void
8686

8787
public function assertMatchesHtmlSnapshot(string $actual): void
8888
{
89-
$this->assertMatchesSnapshot($actual, new HtmlDriver());
89+
$this->assertMatchesSnapshot($actual, new HtmlDriver);
9090
}
9191

9292
public function assertMatchesJsonSnapshot(array|string|null|int|float|bool $actual): void
9393
{
94-
$this->assertMatchesSnapshot($actual, new JsonDriver());
94+
$this->assertMatchesSnapshot($actual, new JsonDriver);
9595
}
9696

9797
public function assertMatchesObjectSnapshot($actual): void
9898
{
99-
$this->assertMatchesSnapshot($actual, new ObjectDriver());
99+
$this->assertMatchesSnapshot($actual, new ObjectDriver);
100100
}
101101

102102
public function assertMatchesTextSnapshot($actual): void
103103
{
104-
$this->assertMatchesSnapshot($actual, new TextDriver());
104+
$this->assertMatchesSnapshot($actual, new TextDriver);
105105
}
106106

107107
public function assertMatchesXmlSnapshot($actual): void
108108
{
109-
$this->assertMatchesSnapshot($actual, new XmlDriver());
109+
$this->assertMatchesSnapshot($actual, new XmlDriver);
110110
}
111111

112112
public function assertMatchesYamlSnapshot($actual): void
113113
{
114-
$this->assertMatchesSnapshot($actual, new YamlDriver());
114+
$this->assertMatchesSnapshot($actual, new YamlDriver);
115115
}
116116

117117
public function assertMatchesImageSnapshot(

tests/Integration/MatchesSnapshotTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ private function expectFail(MockObject $matchesSnapshotMock, string $message)
454454
->expects($this->once())
455455
->method('fail')
456456
->with($message)
457-
->willThrowException(new AssertionFailedError());
457+
->willThrowException(new AssertionFailedError);
458458
}
459459

460460
private function expectFailedMatchesSnapshotTest()

tests/Unit/Drivers/HtmlDriverTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class HtmlDriverTest extends TestCase
1212
#[Test]
1313
public function it_can_serialize_a_html_string_to_pretty_html()
1414
{
15-
$driver = new HtmlDriver();
15+
$driver = new HtmlDriver;
1616

1717
$expected = implode("\n", [
1818
'<!DOCTYPE html>',
@@ -29,7 +29,7 @@ public function it_can_serialize_a_html_string_to_pretty_html()
2929
#[Test]
3030
public function test_for_issue_140()
3131
{
32-
$driver = new HtmlDriver();
32+
$driver = new HtmlDriver;
3333

3434
$expected = implode("\n", [
3535
'<!DOCTYPE html>',
@@ -50,7 +50,7 @@ public function test_for_issue_140()
5050
#[Test]
5151
public function it_can_serialize_a_html_string_without_a_doctype()
5252
{
53-
$driver = new HtmlDriver();
53+
$driver = new HtmlDriver;
5454

5555
$expected = implode("\n", [
5656
'<html lang="en">',
@@ -66,7 +66,7 @@ public function it_can_serialize_a_html_string_without_a_doctype()
6666
#[Test]
6767
public function it_can_only_serialize_strings()
6868
{
69-
$driver = new HtmlDriver();
69+
$driver = new HtmlDriver;
7070

7171
$this->expectException(CantBeSerialized::class);
7272

@@ -76,7 +76,7 @@ public function it_can_only_serialize_strings()
7676
#[Test]
7777
public function it_can_serialize_an_empty_string()
7878
{
79-
$driver = new HtmlDriver();
79+
$driver = new HtmlDriver;
8080

8181
$this->assertEquals("\n", $driver->serialize(''));
8282
}

tests/Unit/Drivers/ImageDriverTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function setUp(): void
1313
{
1414
parent::setUp();
1515

16-
$this->driver = new ImageDriver();
16+
$this->driver = new ImageDriver;
1717

1818
$this->pathToImageA = __DIR__.'/../test_files/testA.png';
1919
$this->pathToImageB = __DIR__.'/../test_files/testB.png';

tests/Unit/Drivers/JsonDriverTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class JsonDriverTest extends TestCase
1414
#[Test]
1515
public function it_can_serialize_a_json_string_to_pretty_json()
1616
{
17-
$driver = new JsonDriver();
17+
$driver = new JsonDriver;
1818

1919
$expected = implode("\n", [
2020
'{',
@@ -29,7 +29,7 @@ public function it_can_serialize_a_json_string_to_pretty_json()
2929
#[Test]
3030
public function it_can_serialize_a_json_hash_to_pretty_json()
3131
{
32-
$driver = new JsonDriver();
32+
$driver = new JsonDriver;
3333

3434
$expected = implode("\n", [
3535
'{',
@@ -75,7 +75,7 @@ public function it_can_serialize_a_json_hash_to_pretty_json()
7575
#[Test]
7676
public function it_can_serialize_a_json_array_to_pretty_json()
7777
{
78-
$driver = new JsonDriver();
78+
$driver = new JsonDriver;
7979

8080
$expected = implode("\n", [
8181
'[',
@@ -92,7 +92,7 @@ public function it_can_serialize_a_json_array_to_pretty_json()
9292
#[Test]
9393
public function it_can_serialize_a_empty_json_object_to_pretty_json()
9494
{
95-
$driver = new JsonDriver();
95+
$driver = new JsonDriver;
9696

9797
$expected = implode("\n", [
9898
'{',
@@ -115,7 +115,7 @@ public function it_can_serialize_a_empty_json_object_to_pretty_json()
115115
#[Test]
116116
public function it_can_not_serialize_resources()
117117
{
118-
$driver = new JsonDriver();
118+
$driver = new JsonDriver;
119119

120120
$this->expectException(CantBeSerialized::class);
121121

@@ -137,7 +137,7 @@ public function it_can_not_serialize_resources()
137137
#[TestWith(['{"empty": []}', '{"empty":{}}', false])]
138138
public function it_can_match_json_strings(string $expected, string $actual, bool $assertion)
139139
{
140-
$driver = new JsonDriver();
140+
$driver = new JsonDriver;
141141

142142
try {
143143
$driver->match($expected, $actual);

tests/Unit/Drivers/ObjectDriverTest.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,31 @@ class ObjectDriverTest extends TestCase
1111
#[Test]
1212
public function it_can_serialize_a_string()
1313
{
14-
$driver = new ObjectDriver();
14+
$driver = new ObjectDriver;
1515

1616
$this->assertEquals('foo', $driver->serialize('foo'));
1717
}
1818

1919
#[Test]
2020
public function it_can_serialize_an_integer()
2121
{
22-
$driver = new ObjectDriver();
22+
$driver = new ObjectDriver;
2323

2424
$this->assertEquals('1', $driver->serialize(1));
2525
}
2626

2727
#[Test]
2828
public function it_can_serialize_a_float()
2929
{
30-
$driver = new ObjectDriver();
30+
$driver = new ObjectDriver;
3131

3232
$this->assertEquals('1.5', $driver->serialize(1.5));
3333
}
3434

3535
#[Test]
3636
public function it_can_serialize_an_associative_array()
3737
{
38-
$driver = new ObjectDriver();
38+
$driver = new ObjectDriver;
3939

4040
$expected = implode("\n", [
4141
'foo:',
@@ -49,7 +49,7 @@ public function it_can_serialize_an_associative_array()
4949
#[Test]
5050
public function it_can_serialize_an_indexed_array_without_keys()
5151
{
52-
$driver = new ObjectDriver();
52+
$driver = new ObjectDriver;
5353

5454
$expected = implode("\n", [
5555
'- foo',
@@ -63,7 +63,7 @@ public function it_can_serialize_an_indexed_array_without_keys()
6363
#[Test]
6464
public function it_can_serialize_a_simple_object()
6565
{
66-
$driver = new ObjectDriver();
66+
$driver = new ObjectDriver;
6767

6868
$expected = implode("\n", [
6969
'foo: bar',
@@ -76,7 +76,7 @@ public function it_can_serialize_a_simple_object()
7676
#[Test]
7777
public function it_can_serialize_a_class_instance()
7878
{
79-
$driver = new ObjectDriver();
79+
$driver = new ObjectDriver;
8080

8181
$expected = implode("\n", [
8282
'name: \'My name\'',
@@ -86,7 +86,7 @@ public function it_can_serialize_a_class_instance()
8686
'',
8787
]);
8888

89-
$this->assertEquals($expected, $driver->serialize(new Obj()));
89+
$this->assertEquals($expected, $driver->serialize(new Obj));
9090
}
9191
}
9292

tests/Unit/Drivers/TextDriverTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class TextDriverTest extends TestCase
1111
#[Test]
1212
public function it_can_serialize_laravel_route_list()
1313
{
14-
$driver = new TextDriver();
14+
$driver = new TextDriver;
1515

1616
$expected = implode("\n", [
1717
'',
@@ -31,7 +31,7 @@ public function it_can_serialize_laravel_route_list()
3131
#[Test]
3232
public function it_can_serialize_when_given_OS_dependant_line_endings()
3333
{
34-
$driver = new TextDriver();
34+
$driver = new TextDriver;
3535

3636
$expected = implode("\n", [
3737
'',

tests/Unit/Drivers/XmlDriverTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class XmlDriverTest extends TestCase
1212
#[Test]
1313
public function it_can_serialize_a_xml_string_to_pretty_xml()
1414
{
15-
$driver = new XmlDriver();
15+
$driver = new XmlDriver;
1616

1717
$expected = implode("\n", [
1818
'<?xml version="1.0"?>',
@@ -28,7 +28,7 @@ public function it_can_serialize_a_xml_string_to_pretty_xml()
2828
#[Test]
2929
public function it_can_only_serialize_strings()
3030
{
31-
$driver = new XmlDriver();
31+
$driver = new XmlDriver;
3232

3333
$this->expectException(CantBeSerialized::class);
3434

tests/Unit/Drivers/YamlDriverTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class YamlDriverTest extends TestCase
1111
#[Test]
1212
public function it_can_serialize_a_yaml_string()
1313
{
14-
$driver = new YamlDriver();
14+
$driver = new YamlDriver;
1515

1616
$yamlString = implode("\n", [
1717
'foo: bar',
@@ -25,7 +25,7 @@ public function it_can_serialize_a_yaml_string()
2525
#[Test]
2626
public function it_can_serialize_a_yaml_array()
2727
{
28-
$driver = new YamlDriver();
28+
$driver = new YamlDriver;
2929

3030
$expected = implode("\n", [
3131
'foo: bar',

0 commit comments

Comments
 (0)