Skip to content

Commit 6602a47

Browse files
committed
qa: apply automated fixes suggested by Psalm and establish baseline
Signed-off-by: Matthew Weier O'Phinney <[email protected]>
1 parent a35ba2c commit 6602a47

9 files changed

+665
-26
lines changed

psalm-baseline.xml

Lines changed: 638 additions & 0 deletions
Large diffs are not rendered by default.

src/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function run()
4141
$event = $this->event;
4242

4343
// Define callback used to determine whether or not to short-circuit
44-
$shortCircuit = function ($r) use ($event) {
44+
$shortCircuit = function ($r) use ($event): bool {
4545
if ($r instanceof ResponseInterface) {
4646
return true;
4747
}

test/ApplicationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function setUpMvcEvent(Application $app, $request, $response): Applicatio
105105
return $app;
106106
}
107107

108-
public function testRouteListenerRaisingExceptionTriggersDispatchErrorAndSkipsDispatch()
108+
public function testRouteListenerRaisingExceptionTriggersDispatchErrorAndSkipsDispatch(): void
109109
{
110110
$events = $this->app->getEventManager();
111111
$response = $this->prophesize(PhpEnvironment\Response::class)->reveal();
@@ -137,7 +137,7 @@ public function testRouteListenerRaisingExceptionTriggersDispatchErrorAndSkipsDi
137137
$this->assertSame($response, $this->app->getResponse());
138138
}
139139

140-
public function testStopPropagationFromPrevEventShouldBeCleared()
140+
public function testStopPropagationFromPrevEventShouldBeCleared(): void
141141
{
142142
$events = $this->app->getEventManager();
143143
$response = $this->prophesize(PhpEnvironment\Response::class)->reveal();

test/AutoloaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function classesToAutoload(): array
2525
/**
2626
* @dataProvider classesToAutoload
2727
*/
28-
public function testAutoloaderDoesNotTransformUnderscoresToDirectorySeparators(string $className)
28+
public function testAutoloaderDoesNotTransformUnderscoresToDirectorySeparators(string $className): void
2929
{
3030
$autoloader = new Autoloader([
3131
'namespaces' => [

test/DbConnectedResourceAbstractFactoryTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,34 @@ protected function setUp(): void
2121
$this->factory = new DbConnectedResourceAbstractFactory();
2222
}
2323

24-
public function testWillNotCreateServiceIfConfigServiceMissing()
24+
public function testWillNotCreateServiceIfConfigServiceMissing(): void
2525
{
2626
$this->services->has('config')->willReturn(false);
2727
$this->assertFalse($this->factory->canCreate($this->services->reveal(), 'Foo'));
2828
}
2929

30-
public function testWillNotCreateServiceIfApiToolsConfigMissing()
30+
public function testWillNotCreateServiceIfApiToolsConfigMissing(): void
3131
{
3232
$this->services->has('config')->willReturn(true);
3333
$this->services->get('config')->willReturn([]);
3434
$this->assertFalse($this->factory->canCreate($this->services->reveal(), 'Foo'));
3535
}
3636

37-
public function testWillNotCreateServiceIfApiToolsConfigIsNotAnArray()
37+
public function testWillNotCreateServiceIfApiToolsConfigIsNotAnArray(): void
3838
{
3939
$this->services->has('config')->willReturn(true);
4040
$this->services->get('config')->willReturn(['api-tools' => 'invalid']);
4141
$this->assertFalse($this->factory->canCreate($this->services->reveal(), 'Foo'));
4242
}
4343

44-
public function testWillNotCreateServiceIfApiToolsConfigDoesNotHaveDbConnectedSegment()
44+
public function testWillNotCreateServiceIfApiToolsConfigDoesNotHaveDbConnectedSegment(): void
4545
{
4646
$this->services->has('config')->willReturn(true);
4747
$this->services->get('config')->willReturn(['api-tools' => ['foo' => 'bar']]);
4848
$this->assertFalse($this->factory->canCreate($this->services->reveal(), 'Foo'));
4949
}
5050

51-
public function testWillNotCreateServiceIfDbConnectedSegmentDoesNotHaveRequestedName()
51+
public function testWillNotCreateServiceIfDbConnectedSegmentDoesNotHaveRequestedName(): void
5252
{
5353
$this->services->has('config')->willReturn(true);
5454
$this->services->get('config')

test/DbConnectedResourceTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function setInputFilter(
3737
$p->setValue($resource, $inputFilter);
3838
}
3939

40-
public function testCreatePullsDataFromComposedInputFilterWhenPresent()
40+
public function testCreatePullsDataFromComposedInputFilterWhenPresent(): void
4141
{
4242
$filtered = [
4343
'foo' => 'BAR',
@@ -60,7 +60,7 @@ public function testCreatePullsDataFromComposedInputFilterWhenPresent()
6060
$this->assertEquals($filtered, $this->resource->create(['foo' => 'bar']));
6161
}
6262

63-
public function testUpdatePullsDataFromComposedInputFilterWhenPresent()
63+
public function testUpdatePullsDataFromComposedInputFilterWhenPresent(): void
6464
{
6565
$filtered = [
6666
'foo' => 'BAR',
@@ -82,7 +82,7 @@ public function testUpdatePullsDataFromComposedInputFilterWhenPresent()
8282
$this->assertEquals($filtered, $this->resource->update('foo', ['foo' => 'bar']));
8383
}
8484

85-
public function testPatchPullsDataFromComposedInputFilterWhenPresent()
85+
public function testPatchPullsDataFromComposedInputFilterWhenPresent(): void
8686
{
8787
$filtered = [
8888
'foo' => 'BAR',

test/Model/MongoConnectedListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function testDelete(string $lastId): void
109109
$this->assertTrue($result);
110110
}
111111

112-
public function testFetchAll()
112+
public function testFetchAll(): void
113113
{
114114
$num = 3;
115115
for ($i = 0; $i < $num; $i++) {

test/MvcAuth/UnauthorizedListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class UnauthorizedListenerTest extends TestCase
1616
/**
1717
* @covers \Laminas\ApiTools\MvcAuth\UnauthorizedListener::__invoke
1818
*/
19-
public function testInvokePropagates403ResponseWhenAuthenticationHasFailed()
19+
public function testInvokePropagates403ResponseWhenAuthenticationHasFailed(): void
2020
{
2121
$unauthorizedListener = new UnauthorizedListener();
2222

test/TableGatewayAbstractFactoryTest.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,55 +33,55 @@ protected function setUp(): void
3333
$this->factory = new TableGatewayAbstractFactory();
3434
}
3535

36-
public function testWillNotCreateServiceWithoutAppropriateSuffix()
36+
public function testWillNotCreateServiceWithoutAppropriateSuffix(): void
3737
{
3838
$this->services->has('config')->shouldNotBeCalled();
3939
$this->assertFalse($this->factory->canCreate($this->services->reveal(), 'Foo'));
4040
}
4141

42-
public function testWillNotCreateServiceIfConfigServiceIsMissing()
42+
public function testWillNotCreateServiceIfConfigServiceIsMissing(): void
4343
{
4444
$this->services->has('config')->willReturn(false);
4545
$this->services->get('config')->shouldNotBeCalled();
4646
$this->assertFalse($this->factory->canCreate($this->services->reveal(), 'Foo\Table'));
4747
}
4848

49-
public function testWillNotCreateServiceIfMissingApiToolsConfig()
49+
public function testWillNotCreateServiceIfMissingApiToolsConfig(): void
5050
{
5151
$this->services->has('config')->willReturn(true);
5252
$this->services->get('config')->willReturn([]);
5353
$this->assertFalse($this->factory->canCreate($this->services->reveal(), 'Foo\Table'));
5454
}
5555

56-
public function testWillNotCreateServiceIfMissingDbConnectedConfigSegment()
56+
public function testWillNotCreateServiceIfMissingDbConnectedConfigSegment(): void
5757
{
5858
$this->services->has('config')->willReturn(true);
5959
$this->services->get('config')->willReturn(['api-tools' => []]);
6060
$this->assertFalse($this->factory->canCreate($this->services->reveal(), 'Foo\Table'));
6161
}
6262

63-
public function testWillNotCreateServiceIfMissingServiceSubSegment()
63+
public function testWillNotCreateServiceIfMissingServiceSubSegment(): void
6464
{
6565
$this->services->has('config')->willReturn(true);
6666
$this->services->get('config')->willReturn(['api-tools' => ['db-connected' => []]]);
6767
$this->assertFalse($this->factory->canCreate($this->services->reveal(), 'Foo\Table'));
6868
}
6969

70-
public function testWillNotCreateServiceIfServiceSubSegmentIsInvalid()
70+
public function testWillNotCreateServiceIfServiceSubSegmentIsInvalid(): void
7171
{
7272
$this->services->has('config')->willReturn(true);
7373
$this->services->get('config')->willReturn(['api-tools' => ['db-connected' => ['Foo' => 'invalid']]]);
7474
$this->assertFalse($this->factory->canCreate($this->services->reveal(), 'Foo\Table'));
7575
}
7676

77-
public function testWillNotCreateServiceIfServiceSubSegmentDoesNotContainTableName()
77+
public function testWillNotCreateServiceIfServiceSubSegmentDoesNotContainTableName(): void
7878
{
7979
$this->services->has('config')->willReturn(true);
8080
$this->services->get('config')->willReturn(['api-tools' => ['db-connected' => ['Foo' => []]]]);
8181
$this->assertFalse($this->factory->canCreate($this->services->reveal(), 'Foo\Table'));
8282
}
8383

84-
public function testWillNotCreateServiceIfServiceSubSegmentDoesNotContainAdapterInformation()
84+
public function testWillNotCreateServiceIfServiceSubSegmentDoesNotContainAdapterInformation(): void
8585
{
8686
$this->services->has('config')->willReturn(true);
8787
$this->services->get('config')
@@ -102,7 +102,7 @@ public function testWillNotCreateServiceIfServiceSubSegmentDoesNotContainAdapter
102102
$this->assertFalse($this->factory->canCreate($this->services->reveal(), 'Foo\Table'));
103103
}
104104

105-
public function testWillCreateServiceIfConfigContainsValidTableNameAndAdapterName()
105+
public function testWillCreateServiceIfConfigContainsValidTableNameAndAdapterName(): void
106106
{
107107
$this->services->has('config')->willReturn(true);
108108
$this->services->get('config')
@@ -121,7 +121,8 @@ public function testWillCreateServiceIfConfigContainsValidTableNameAndAdapterNam
121121
$this->assertTrue($this->factory->canCreate($this->services->reveal(), 'Foo\Table'));
122122
}
123123

124-
public function testWillCreateServiceIfConfigContainsValidTableNameNoAdapterNameAndServicesContainDefaultAdapter()
124+
// phpcs:ignore Generic.Files.LineLength.TooLong
125+
public function testWillCreateServiceIfConfigContainsValidTableNameNoAdapterNameAndServicesContainDefaultAdapter(): void
125126
{
126127
$this->services->has('config')->willReturn(true);
127128
$this->services->get('config')
@@ -154,7 +155,7 @@ public function validConfig(): array
154155
/**
155156
* @dataProvider validConfig
156157
*/
157-
public function testFactoryReturnsTableGatewayInstanceBasedOnConfiguration(string $adapterServiceName)
158+
public function testFactoryReturnsTableGatewayInstanceBasedOnConfiguration(string $adapterServiceName): void
158159
{
159160
$hydrator = $this->prophesize($this->getClassMethodsHydratorClassName())->reveal();
160161

@@ -208,7 +209,7 @@ public function testFactoryReturnsTableGatewayInstanceBasedOnConfiguration(strin
208209
*/
209210
public function testFactoryReturnsTableGatewayInstanceBasedOnConfigurationWithoutLaminasRest(
210211
string $adapterServiceName
211-
) {
212+
): void {
212213
$hydrator = $this->prophesize($this->getClassMethodsHydratorClassName())->reveal();
213214

214215
$hydrators = $this->prophesize(HydratorPluginManager::class);

0 commit comments

Comments
 (0)