Skip to content

Commit b058e8c

Browse files
committed
qa: apply suggestions from Psalm and establish a baseline
Signed-off-by: Matthew Weier O'Phinney <[email protected]>
1 parent c7630a7 commit b058e8c

File tree

16 files changed

+1369
-89
lines changed

16 files changed

+1369
-89
lines changed

psalm-baseline.xml

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

src/Filter/Service/ODMFilterManager.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class ODMFilterManager extends AbstractPluginManager
3131

3232
/**
3333
* @param iterable $filters
34+
* @return void
3435
*/
3536
public function filter(QueryBuilder $queryBuilder, Metadata $metadata, $filters)
3637
{

src/Filter/Service/ORMFilterManager.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class ORMFilterManager extends AbstractPluginManager
3131
/**
3232
* @param object $metadata
3333
* @param iterable $filters
34+
* @return void
3435
*/
3536
public function filter(QueryBuilder $queryBuilder, $metadata, $filters)
3637
{

src/Module.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public function getConfig()
2323
return include __DIR__ . '/../config/module.config.php';
2424
}
2525

26+
/** @return void */
2627
public function init(ModuleManager $moduleManager)
2728
{
2829
$serviceManager = $moduleManager->getEvent()->getParam('ServiceManager');

test/Filter/ODMFilterTest.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function setUp(): void
8181
$objectManager->flush();
8282
}
8383

84-
public function testEquals()
84+
public function testEquals(): void
8585
{
8686
$filters = [
8787
['field' => 'name', 'type' => 'eq', 'value' => 'MetaOne'],
@@ -121,7 +121,7 @@ public function testEquals()
121121
$this->assertEquals(2, $this->countResult($filters));
122122
}
123123

124-
public function testNotEquals()
124+
public function testNotEquals(): void
125125
{
126126
$filters = [
127127
['field' => 'name', 'type' => 'neq', 'value' => 'MetaOne'],
@@ -161,7 +161,7 @@ public function testNotEquals()
161161
$this->assertEquals(3, $this->countResult($filters));
162162
}
163163

164-
public function testLessThan()
164+
public function testLessThan(): void
165165
{
166166
$filters = [
167167
[
@@ -203,7 +203,7 @@ public function testLessThan()
203203
$this->assertEquals(3, $this->countResult($filters));
204204
}
205205

206-
public function testLessThanOrEquals()
206+
public function testLessThanOrEquals(): void
207207
{
208208
$filters = [
209209
[
@@ -255,7 +255,7 @@ public function testLessThanOrEquals()
255255
$this->assertEquals(4, $this->countResult($filters));
256256
}
257257

258-
public function testGreaterThan()
258+
public function testGreaterThan(): void
259259
{
260260
$filters = [
261261
[
@@ -300,7 +300,7 @@ public function testGreaterThan()
300300
$this->assertEquals(1, $this->countResult($filters));
301301
}
302302

303-
public function testGreaterThanOrEquals()
303+
public function testGreaterThanOrEquals(): void
304304
{
305305
$filters = [
306306
[
@@ -354,7 +354,7 @@ public function testGreaterThanOrEquals()
354354
$this->assertEquals(3, $this->countResult($filters));
355355
}
356356

357-
public function testIsNull()
357+
public function testIsNull(): void
358358
{
359359
$filters = [
360360
[
@@ -425,7 +425,7 @@ public function testIsNull()
425425
$this->assertEquals(5, $this->countResult($filters));
426426
}
427427

428-
public function testIsNotNull()
428+
public function testIsNotNull(): void
429429
{
430430
$filters = [
431431
[
@@ -496,7 +496,7 @@ public function testIsNotNull()
496496
$this->assertEquals(0, $this->countResult($filters));
497497
}
498498

499-
public function testIn()
499+
public function testIn(): void
500500
{
501501
// Date handling in IN and NOTIN doesn't seem to work at all, so just test with strings
502502

@@ -541,7 +541,7 @@ public function testIn()
541541
$this->assertEquals(1, $this->countResult($filters));
542542
}
543543

544-
public function testNotIn()
544+
public function testNotIn(): void
545545
{
546546
$filters = [
547547
[
@@ -585,7 +585,7 @@ public function testNotIn()
585585
$this->assertEquals(4, $this->countResult($filters));
586586
}
587587

588-
public function testBetween()
588+
public function testBetween(): void
589589
{
590590
$filters = [
591591
[
@@ -626,7 +626,7 @@ public function testBetween()
626626
$this->assertEquals(2, $this->countResult($filters));
627627
}
628628

629-
public function testLike()
629+
public function testLike(): void
630630
{
631631
$filters = [
632632
[
@@ -677,7 +677,7 @@ public function testLike()
677677
$this->assertEquals(4, $this->countResult($filters));
678678
}
679679

680-
public function testRegex()
680+
public function testRegex(): void
681681
{
682682
$filters = [
683683
[

test/Filter/ODMTypeCasterTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function setUp(): void
2424
$this->typeCaster = new TypeCaster();
2525
}
2626

27-
public function testTypeCastingToInteger()
27+
public function testTypeCastingToInteger(): void
2828
{
2929
$metadata = new stdClass();
3030
$metadata->fieldMappings = [
@@ -42,7 +42,7 @@ public function testTypeCastingToInteger()
4242
$this->assertSame(2144211244, $result);
4343
}
4444

45-
public function testTypeCastingToBoolean()
45+
public function testTypeCastingToBoolean(): void
4646
{
4747
$metadata = new stdClass();
4848
$metadata->fieldMappings = [
@@ -64,7 +64,7 @@ public function testTypeCastingToBoolean()
6464
$this->assertSame(false, $result);
6565
}
6666

67-
public function testTypeCastingToFloat()
67+
public function testTypeCastingToFloat(): void
6868
{
6969
$metadata = new stdClass();
7070
$metadata->fieldMappings = [
@@ -82,7 +82,7 @@ public function testTypeCastingToFloat()
8282
$this->assertSame(1.242, $result);
8383
}
8484

85-
public function testTypeCastingToString()
85+
public function testTypeCastingToString(): void
8686
{
8787
$metadata = new stdClass();
8888
$metadata->fieldMappings = [
@@ -101,7 +101,7 @@ public function testTypeCastingToString()
101101
$this->assertSame('1', $result);
102102
}
103103

104-
public function testTypeCastingToDate()
104+
public function testTypeCastingToDate(): void
105105
{
106106
$metadata = new stdClass();
107107
$metadata->fieldMappings = [
@@ -120,7 +120,7 @@ public function testTypeCastingToDate()
120120
$this->assertEquals($result->format('Y-m-d H:i:s'), '2019-09-01 12:19:01');
121121
}
122122

123-
public function testNoTypeCastingToDateWhenFlaggedSo()
123+
public function testNoTypeCastingToDateWhenFlaggedSo(): void
124124
{
125125
$metadata = new stdClass();
126126
$metadata->fieldMappings = [
@@ -138,7 +138,7 @@ public function testNoTypeCastingToDateWhenFlaggedSo()
138138
$this->assertSame($result, $value);
139139
}
140140

141-
public function testTypeCastingToDateImmutable()
141+
public function testTypeCastingToDateImmutable(): void
142142
{
143143
$metadata = new stdClass();
144144
$metadata->fieldMappings = [
@@ -157,7 +157,7 @@ public function testTypeCastingToDateImmutable()
157157
$this->assertEquals($result->format('Y-m-d H:i:s'), '2019-09-01 12:19:01');
158158
}
159159

160-
public function testNoTypeCastingToDateImmutableWhenFlaggedSo()
160+
public function testNoTypeCastingToDateImmutableWhenFlaggedSo(): void
161161
{
162162
$metadata = new stdClass();
163163
$metadata->fieldMappings = [

test/Filter/ORMFilterTest.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function setUp(): void
101101
$objectManager->flush();
102102
}
103103

104-
public function testOrX()
104+
public function testOrX(): void
105105
{
106106
$filters = [
107107
[
@@ -149,7 +149,7 @@ public function testOrX()
149149
self::assertEquals(1, $this->countResult($filters));
150150
}
151151

152-
public function testAndX()
152+
public function testAndX(): void
153153
{
154154
$filters = [
155155
[
@@ -198,7 +198,7 @@ public function testAndX()
198198
self::assertEquals(2, $this->countResult($filters));
199199
}
200200

201-
public function testEquals()
201+
public function testEquals(): void
202202
{
203203
$filters = [
204204
[
@@ -242,7 +242,7 @@ public function testEquals()
242242
self::assertEquals(2, $this->countResult($filters));
243243
}
244244

245-
public function testNotEquals()
245+
public function testNotEquals(): void
246246
{
247247
$filters = [
248248
[
@@ -286,7 +286,7 @@ public function testNotEquals()
286286
self::assertEquals(2, $this->countResult($filters));
287287
}
288288

289-
public function testLessThan()
289+
public function testLessThan(): void
290290
{
291291
$filters = [
292292
[
@@ -328,7 +328,7 @@ public function testLessThan()
328328
self::assertEquals(3, $this->countResult($filters));
329329
}
330330

331-
public function testLessThanOrEquals()
331+
public function testLessThanOrEquals(): void
332332
{
333333
$filters = [
334334
[
@@ -380,7 +380,7 @@ public function testLessThanOrEquals()
380380
self::assertEquals(4, $this->countResult($filters));
381381
}
382382

383-
public function testGreaterThan()
383+
public function testGreaterThan(): void
384384
{
385385
$filters = [
386386
[
@@ -425,7 +425,7 @@ public function testGreaterThan()
425425
self::assertEquals(1, $this->countResult($filters));
426426
}
427427

428-
public function testGreaterThanOrEquals()
428+
public function testGreaterThanOrEquals(): void
429429
{
430430
$filters = [
431431
[
@@ -479,10 +479,10 @@ public function testGreaterThanOrEquals()
479479
self::assertEquals(3, $this->countResult($filters));
480480
}
481481

482-
public function testIsNull()
482+
public function testIsNull(): void
483483
{
484484
$serviceManager = $this->getApplication()->getServiceManager();
485-
$objectManager = $serviceManager->get('doctrine.entitymanager.orm_default');
485+
$serviceManager->get('doctrine.entitymanager.orm_default');
486486

487487
$filters = [
488488
[
@@ -520,7 +520,7 @@ public function testIsNull()
520520
self::assertEquals(2, $this->countResult($filters));
521521
}
522522

523-
public function testIsNotNull()
523+
public function testIsNotNull(): void
524524
{
525525
$filters = [
526526
[
@@ -558,7 +558,7 @@ public function testIsNotNull()
558558
self::assertEquals(5, $this->countResult($filters));
559559
}
560560

561-
public function testIn()
561+
public function testIn(): void
562562
{
563563
$filters = [
564564
[
@@ -597,7 +597,7 @@ public function testIn()
597597
self::assertEquals(1, $this->countResult($filters));
598598
}
599599

600-
public function testNotIn()
600+
public function testNotIn(): void
601601
{
602602
$filters = [
603603
[
@@ -638,7 +638,7 @@ public function testNotIn()
638638
self::assertEquals(3, $this->countResult($filters));
639639
}
640640

641-
public function testBetween()
641+
public function testBetween(): void
642642
{
643643
$filters = [
644644
[
@@ -771,7 +771,7 @@ public function testNotLike(): void
771771
self::assertEquals(1, $this->countResult($filters));
772772
}
773773

774-
public function testIsMemberOf()
774+
public function testIsMemberOf(): void
775775
{
776776
$albumOneId = $this->objectManager
777777
->getRepository('Db\Entity\Album')
@@ -803,7 +803,7 @@ public function testIsMemberOf()
803803
self::assertEquals(0, $this->countResult($filters));
804804
}
805805

806-
public function testInnerJoin()
806+
public function testInnerJoin(): void
807807
{
808808
$filters = [
809809
[
@@ -852,7 +852,7 @@ public function testInnerJoin()
852852
self::assertEquals(2, $this->countResult($filters, Album::class));
853853
}
854854

855-
public function testLeftJoin()
855+
public function testLeftJoin(): void
856856
{
857857
$filters = [
858858
[

0 commit comments

Comments
 (0)