Skip to content

Commit 43446d5

Browse files
committed
ignore missing parameter and return types in tests
1 parent cfcaaa0 commit 43446d5

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

.phpstan.neon

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,17 @@ parameters:
99
- vendor
1010

1111
treatPhpDocTypesAsCertain: false
12+
13+
ignoreErrors:
14+
-
15+
# Ignore missing or imprecise parameter types for methods in tests
16+
message: '(^Method .+ has parameter .+ with no.* type specified.*\.$)'
17+
path: tests
18+
-
19+
# Ignore imprecise return types for methods in tests
20+
message: '(^Method .+ return type has no.* type specified.+\.$)'
21+
path: tests
22+
-
23+
# Ignore missing return types for methods in tests
24+
message: '(^Method .+ has no return type specified\.$)'
25+
path: tests

tests/Unit/Serializer/JsonSerializerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static function getEncodedToNormalizedData(): array
6363
* @dataProvider getEncodedToNormalizedData
6464
*/
6565
#[DataProvider('getEncodedToNormalizedData')]
66-
public function testCreateFromStringDecodesToExpectedNormalizedData(string $data, $expected): void
66+
public function testCreateFromStringDecodesToExpectedNormalizedData(string $data, string $expected): void
6767
{
6868
$serializer = JsonSerializer::createFromString($data);
6969

@@ -184,7 +184,7 @@ public static function getNormalizedToEncodedData(): array
184184
* @dataProvider getNormalizedToEncodedData
185185
*/
186186
#[DataProvider('getNormalizedToEncodedData')]
187-
public function testCreateFromArrayEncodesToExpectedString(array $data, $expected): void
187+
public function testCreateFromArrayEncodesToExpectedString(array $data, string $expected): void
188188
{
189189
$serializer = JsonSerializer::createFromArray($data);
190190

tests/Unit/Serializer/XmlSerializerTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,6 @@ public function testCreateFromArrayEncodesToExpectedString(array $data, $expecte
122122
$this->assertXmlStringEqualsXmlString($expected, $serializer->__toString());
123123
}
124124

125-
/**
126-
* @return array<string,mixed>
127-
*/
128125
public static function getNormalizedToEncodedData(): array
129126
{
130127
return [
@@ -301,8 +298,6 @@ public static function getNormalizedToEncodedData(): array
301298

302299
/**
303300
* @dataProvider getInvalidSerializedData
304-
*
305-
* @param array<int,mixed> $data
306301
*/
307302
#[DataProvider('getInvalidSerializedData')]
308303
public function testCreateFromArrayWithInvalidDataThrowsException(string $message, array $data): void
@@ -313,9 +308,6 @@ public function testCreateFromArrayWithInvalidDataThrowsException(string $messag
313308
XmlSerializer::createFromArray($data);
314309
}
315310

316-
/**
317-
* @return array<string,mixed>
318-
*/
319311
public static function getInvalidSerializedData(): array
320312
{
321313
return [

0 commit comments

Comments
 (0)