Skip to content

Commit 6307d34

Browse files
Fix type errors in db tests (#38696)
* Fix type errors in db tests * Apply fixes from StyleCI Co-authored-by: Taylor Otwell <taylorotwell@users.noreply.github.com>
1 parent 67928ec commit 6307d34

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

src/Illuminate/Console/Scheduling/Event.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ protected function pingCallback($url)
579579
return function (Container $container, HttpClient $http) use ($url) {
580580
try {
581581
$http->request('GET', $url);
582-
} catch (ClientExceptionInterface | TransferException $e) {
582+
} catch (ClientExceptionInterface|TransferException $e) {
583583
$container->make(ExceptionHandler::class)->report($e);
584584
}
585585
};

src/Illuminate/Routing/CompiledRouteCollection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function match(Request $request)
121121
if ($result = $matcher->matchRequest($trimmedRequest)) {
122122
$route = $this->getByName($result['_route']);
123123
}
124-
} catch (ResourceNotFoundException | MethodNotAllowedException $e) {
124+
} catch (ResourceNotFoundException|MethodNotAllowedException $e) {
125125
try {
126126
return $this->routes->match($request);
127127
} catch (NotFoundHttpException $e) {
@@ -136,7 +136,7 @@ public function match(Request $request)
136136
if (! $dynamicRoute->isFallback) {
137137
$route = $dynamicRoute;
138138
}
139-
} catch (NotFoundHttpException | MethodNotAllowedHttpException $e) {
139+
} catch (NotFoundHttpException|MethodNotAllowedHttpException $e) {
140140
//
141141
}
142142
}

src/Illuminate/Support/Traits/ForwardsCalls.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ protected function forwardCallTo($object, $method, $parameters)
2121
{
2222
try {
2323
return $object->{$method}(...$parameters);
24-
} catch (Error | BadMethodCallException $e) {
24+
} catch (Error|BadMethodCallException $e) {
2525
$pattern = '~^Call to undefined method (?P<class>[^:]+)::(?P<method>[^\(]+)\(\)$~';
2626

2727
if (! preg_match($pattern, $e->getMessage(), $matches)) {

tests/Database/DatabaseConnectionTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,22 @@ public function testUpdateCallsTheAffectingStatementMethod()
9999
public function testDeleteCallsTheAffectingStatementMethod()
100100
{
101101
$connection = $this->getMockConnection(['affectingStatement']);
102-
$connection->expects($this->once())->method('affectingStatement')->with($this->equalTo('foo'), $this->equalTo(['bar']))->willReturn('baz');
102+
$connection->expects($this->once())->method('affectingStatement')->with($this->equalTo('foo'), $this->equalTo(['bar']))->willReturn(true);
103103
$results = $connection->delete('foo', ['bar']);
104-
$this->assertSame('baz', $results);
104+
$this->assertTrue($results);
105105
}
106106

107107
public function testStatementProperlyCallsPDO()
108108
{
109109
$pdo = $this->getMockBuilder(DatabaseConnectionTestMockPDO::class)->onlyMethods(['prepare'])->getMock();
110110
$statement = $this->getMockBuilder('PDOStatement')->onlyMethods(['execute', 'bindValue'])->getMock();
111111
$statement->expects($this->once())->method('bindValue')->with(1, 'bar', 2);
112-
$statement->expects($this->once())->method('execute')->willReturn('foo');
112+
$statement->expects($this->once())->method('execute')->willReturn(true);
113113
$pdo->expects($this->once())->method('prepare')->with($this->equalTo('foo'))->willReturn($statement);
114114
$mock = $this->getMockConnection(['prepareBindings'], $pdo);
115115
$mock->expects($this->once())->method('prepareBindings')->with($this->equalTo(['bar']))->willReturn(['bar']);
116116
$results = $mock->statement('foo', ['bar']);
117-
$this->assertSame('foo', $results);
117+
$this->assertTrue($results);
118118
$log = $mock->getQueryLog();
119119
$this->assertSame('foo', $log[0]['query']);
120120
$this->assertEquals(['bar'], $log[0]['bindings']);
@@ -127,12 +127,12 @@ public function testAffectingStatementProperlyCallsPDO()
127127
$statement = $this->getMockBuilder('PDOStatement')->onlyMethods(['execute', 'rowCount', 'bindValue'])->getMock();
128128
$statement->expects($this->once())->method('bindValue')->with('foo', 'bar', 2);
129129
$statement->expects($this->once())->method('execute');
130-
$statement->expects($this->once())->method('rowCount')->willReturn(['boom']);
130+
$statement->expects($this->once())->method('rowCount')->willReturn(42);
131131
$pdo->expects($this->once())->method('prepare')->with('foo')->willReturn($statement);
132132
$mock = $this->getMockConnection(['prepareBindings'], $pdo);
133133
$mock->expects($this->once())->method('prepareBindings')->with($this->equalTo(['foo' => 'bar']))->willReturn(['foo' => 'bar']);
134134
$results = $mock->update('foo', ['foo' => 'bar']);
135-
$this->assertEquals(['boom'], $results);
135+
$this->assertSame(42, $results);
136136
$log = $mock->getQueryLog();
137137
$this->assertSame('foo', $log[0]['query']);
138138
$this->assertEquals(['foo' => 'bar'], $log[0]['bindings']);

tests/Integration/Foundation/Fixtures/EventDiscovery/UnionListeners/UnionListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class UnionListener
99
{
10-
public function handle(EventOne | EventTwo $event)
10+
public function handle(EventOne|EventTwo $event)
1111
{
1212
//
1313
}

tests/Support/Fixtures/UnionTypesClosure.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
use Illuminate\Tests\Support\AnotherExampleParameter;
44
use Illuminate\Tests\Support\ExampleParameter;
55

6-
return function (ExampleParameter | AnotherExampleParameter $a, $b) {
6+
return function (ExampleParameter|AnotherExampleParameter $a, $b) {
77
//
88
};

0 commit comments

Comments
 (0)