Skip to content

Commit 6fdd67c

Browse files
MoiraeKondukterCRO
authored andcommitted
refactor: update stan to lvl6
1 parent 4aa004b commit 6fdd67c

File tree

47 files changed

+211
-54
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+211
-54
lines changed

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
parameters:
22
paths:
33
- src/
4-
level: 5
4+
level: 6

src/Definition/Encoding/AttributeCollectionToPhpArrayEncoderInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88

99
interface AttributeCollectionToPhpArrayEncoderInterface
1010
{
11-
public function encode(AttributeCollectionInterface $attributeCollection);
11+
/** @return array<string,mixed> */
12+
public function encode(AttributeCollectionInterface $attributeCollection): array;
1213
}

src/Definition/Encoding/DocumentDataToPhpArrayEncoderInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88

99
interface DocumentDataToPhpArrayEncoderInterface
1010
{
11-
public function encode(DocumentDataInterface $documentData);
11+
public function encode(DocumentDataInterface $documentData): ?array;
1212
}

src/Definition/Encoding/DocumentToPhpArrayEncoderInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88

99
interface DocumentToPhpArrayEncoderInterface
1010
{
11+
/** @return array<string,mixed> */
1112
public function encode(DocumentInterface $document);
1213
}

src/Definition/Encoding/ErrorCollectionToPhpArrayEncoderInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88

99
interface ErrorCollectionToPhpArrayEncoderInterface
1010
{
11+
/** @return array<string,mixed> */
1112
public function encode(ErrorCollectionInterface $errorCollection);
1213
}

src/Definition/Encoding/ErrorToPhpArrayEncoderInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88

99
interface ErrorToPhpArrayEncoderInterface
1010
{
11+
/** @return array<string,mixed> */
1112
public function encode(ErrorInterface $error): array;
1213
}

src/Definition/Encoding/LinkToPhpArrayEncoderInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@
88

99
interface LinkToPhpArrayEncoderInterface
1010
{
11+
/**
12+
* @return null|array<string,mixed>|string
13+
*/
1114
public function encode(LinkInterface $link);
1215
}

src/Definition/Encoding/RelationshipCollectionToPhpArrayEncoderInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@
88

99
interface RelationshipCollectionToPhpArrayEncoderInterface
1010
{
11+
/**
12+
* @return array<string,mixed>
13+
*/
1114
public function encode(RelationshipCollectionInterface $relationship);
1215
}

src/Definition/Encoding/RelationshipToPhpArrayEncoderInterface.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@
88

99
interface RelationshipToPhpArrayEncoderInterface
1010
{
11-
public function encode(RelationshipInterface $relationship);
11+
/**
12+
* @return array<string,mixed>
13+
*/
14+
public function encode(RelationshipInterface $relationship): array;
1215
}

src/Definition/Encoding/ResourceToPhpArrayEncoderInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88

99
interface ResourceToPhpArrayEncoderInterface
1010
{
11+
/** @return array<string,mixed> */
1112
public function encode(ResourceInterface $resource);
1213
}

src/Definition/Encoding/SourceToPhpArrayEncoderInterface.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@
88

99
interface SourceToPhpArrayEncoderInterface
1010
{
11-
public function encode(SourceInterface $source);
11+
/**
12+
* @return array<string,null|string>
13+
*/
14+
public function encode(SourceInterface $source): array;
1215
}

src/Definition/Exception/Request/UnsupportedFilterAttributeGivenException.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88

99
class UnsupportedFilterAttributeGivenException extends RequestException
1010
{
11+
/**
12+
* @param string[] $unsupportedFilters
13+
*/
1114
public function __construct(
1215
array $unsupportedFilters,
1316
?string $message = null,
14-
$code = 0,
17+
int $code = 0,
1518
Throwable $previous = null
1619
) {
1720
if (null === $message) {

src/Definition/Exception/Request/UnsupportedIncludeValuesGivenException.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88

99
class UnsupportedIncludeValuesGivenException extends RequestException
1010
{
11+
/**
12+
* @param string[] $unsupportedIncludes
13+
*/
1114
public function __construct(
1215
array $unsupportedIncludes,
1316
?string $message = null,
14-
$code = 0,
17+
int $code = 0,
1518
Throwable $previous = null
1619
) {
1720
if (null === $message) {

src/Definition/Exception/Request/UnsupportedSortRequestedException.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@
88

99
class UnsupportedSortRequestedException extends RequestException
1010
{
11-
public function __construct(array $unsupportedSorts, ?string $message = null, $code = 0, Throwable $previous = null)
12-
{
11+
/**
12+
* @param string[] $unsupportedSorts
13+
*/
14+
public function __construct(
15+
array $unsupportedSorts,
16+
?string $message = null,
17+
int $code = 0,
18+
Throwable $previous = null
19+
) {
1320
if (null === $message) {
1421
$message = sprintf(
1522
'Unsupported sort query params given: `%s`',

src/Definition/Exception/Request/UnsupportedSparseFieldsetRequestedException.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88

99
class UnsupportedSparseFieldsetRequestedException extends RequestException
1010
{
11+
/**
12+
* @param string[] $unsupportedIncludes
13+
*/
1114
public function __construct(
1215
array $unsupportedIncludes,
1316
?string $message = null,
14-
$code = 0,
17+
int $code = 0,
1518
Throwable $previous = null
1619
) {
1720
if (null === $message) {

src/Definition/Model/Error/ErrorCollectionInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66

77
use IteratorAggregate;
88

9+
/**
10+
* @extends IteratorAggregate<int,ErrorInterface>
11+
*/
912
interface ErrorCollectionInterface extends IteratorAggregate
1013
{
14+
/** @return ErrorInterface[] */
1115
public function getErrors(): array;
1216
}

src/Definition/Model/Link/LinkCollectionInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@
66

77
use IteratorAggregate;
88

9+
/**
10+
* @extends IteratorAggregate<int,LinkInterface>
11+
*/
912
interface LinkCollectionInterface extends IteratorAggregate
1013
{
1114
public function hasLink(string $linkName): bool;
1215

1316
public function getLink(string $linkName): ?LinkInterface;
1417

18+
/** @return string[] */
1519
public function getLinkNames(): array;
1620

21+
/** @return LinkInterface[] */
1722
public function getLinks(): array;
1823
}

src/Definition/Model/Link/LinkNamesEnum.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ abstract class LinkNamesEnum
1717
public const LINK_NAME_PAGINATION_PREV = 'prev';
1818
public const LINK_NAME_PAGINATION_NEXT = 'next';
1919

20+
/** @return array<string,mixed> */
2021
public static function getValues(): array
2122
{
2223
$oClass = new ReflectionClass(__CLASS__);

src/Definition/Model/Resource/Attribute/AttributeCollectionInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66

77
use IteratorAggregate;
88

9+
/**
10+
* @extends IteratorAggregate<int,AttributeInterface>
11+
*/
912
interface AttributeCollectionInterface extends IteratorAggregate
1013
{
14+
/** @return AttributeInterface[] */
1115
public function getAttributes(): array;
1216

1317
public function getAttributeByName(string $name): ?AttributeInterface;

src/Definition/Model/Resource/Relationship/RelationshipCollectionInterface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@
66

77
use IteratorAggregate;
88

9+
/**
10+
* @extends IteratorAggregate<int,RelationshipInterface>
11+
*/
912
interface RelationshipCollectionInterface extends IteratorAggregate
1013
{
14+
/**
15+
* @return RelationshipInterface[]
16+
*/
1117
public function getRelationships(): array;
1218

1319
public function getRelationshipByName(string $name): ?RelationshipInterface;

src/Definition/Model/Resource/ResourceCollectionInterface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66

77
use IteratorAggregate;
88

9+
/**
10+
* @extends IteratorAggregate<int,ResourceInterface>
11+
*/
912
interface ResourceCollectionInterface extends IteratorAggregate
1013
{
14+
/**
15+
* @return ResourceInterface[] $resources
16+
*/
1117
public function getResources(): array;
1218
}

src/Definition/Model/Resource/ResourceIdentifierCollectionInterface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66

77
use IteratorAggregate;
88

9+
/**
10+
* @extends IteratorAggregate<int,ResourceIdentifierInterface>
11+
*/
912
interface ResourceIdentifierCollectionInterface extends IteratorAggregate
1013
{
14+
/**
15+
* @return ResourceIdentifierInterface[]
16+
*/
1117
public function getResourceIdentifiers(): array;
1218
}

src/Implementation/Encoding/DocumentToPhpArrayEncoder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function __construct(
4343
$this->resourceCollectionEncoder = $resourceCollectionEncoder;
4444
}
4545

46+
/** @return array<string,mixed> */
4647
public function encode(DocumentInterface $document): array
4748
{
4849
$serializedDocument = [];

src/Implementation/Encoding/ErrorCollectionToPhpArrayEncoder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public function __construct(ErrorToPhpArrayEncoderInterface $errorEncoder)
1919
$this->errorEncoder = $errorEncoder;
2020
}
2121

22+
/** @return array<string,mixed> */
2223
public function encode(ErrorCollectionInterface $errorCollection): array
2324
{
2425
$serializedErrors = [];

src/Implementation/Encoding/ErrorToPhpArrayEncoder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function __construct(
3131
$this->metaEncoder = $metaEncoder;
3232
}
3333

34+
/** @return array<string,mixed> */
3435
public function encode(ErrorInterface $error): array
3536
{
3637
$serializedError = [];

src/Implementation/Encoding/LinkToPhpArrayEncoder.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@
1111

1212
class LinkToPhpArrayEncoder implements LinkToPhpArrayEncoderInterface
1313
{
14-
/** @var MetaToPhpArrayEncoder */
15-
private $metaToPhpArrayEncoder;
14+
private MetaToPhpArrayEncoder $metaToPhpArrayEncoder;
1615

1716
public function __construct(MetaToPhpArrayEncoder $metaToPhpArrayEncoder)
1817
{
1918
$this->metaToPhpArrayEncoder = $metaToPhpArrayEncoder;
2019
}
2120

2221
/**
23-
* @return null|array|string
22+
* @return null|array<string,mixed>|string
2423
*/
2524
public function encode(LinkInterface $link)
2625
{
@@ -40,6 +39,9 @@ public function encode(LinkInterface $link)
4039
return null;
4140
}
4241

42+
/**
43+
* @return array<string,mixed>
44+
*/
4345
private function encodeLinkObject(LinkObject $linkObject): array
4446
{
4547
$serializedLinkObject = [];

src/Implementation/Encoding/RelationshipCollectionToPhpArrayEncoder.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public function __construct(RelationshipToPhpArrayEncoderInterface $relationship
1919
$this->relationshipToPhpArrayEncoder = $relationshipToPhpArrayEncoder;
2020
}
2121

22+
/**
23+
* @return array<string,mixed>
24+
*/
2225
public function encode(RelationshipCollectionInterface $relationshipCollection): array
2326
{
2427
$relationships = [];

src/Implementation/Encoding/RelationshipToPhpArrayEncoder.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ public function __construct(
3535
$this->resourceIdentifierToPhpArrayEncoder = $resourceIdentifierToPhpArrayEncoder;
3636
}
3737

38+
/**
39+
* @return array<string,mixed>
40+
*/
3841
public function encode(RelationshipInterface $relationship): array
3942
{
4043
$serializedRelationship = [];

src/Implementation/Encoding/ResourceToPhpArrayEncoder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function __construct(
3737
$this->attributeCollectionEncoder = $attributeCollectionEncoder;
3838
}
3939

40+
/** @return array<string,mixed> */
4041
public function encode(ResourceInterface $resource): array
4142
{
4243
$serializedResource = [

src/Implementation/Encoding/SourceToPhpArrayEncoder.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
class SourceToPhpArrayEncoder implements SourceToPhpArrayEncoderInterface
1111
{
12+
/**
13+
* @return array<string,null|string>
14+
*/
1215
public function encode(SourceInterface $source): array
1316
{
1417
$serializedSource = [];

src/Implementation/Factory/RelationshipDataFactory.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@
1313

1414
class RelationshipDataFactory
1515
{
16-
public function make(string $type, bool $toMany, $data): ?RelationshipDataInterface
17-
{
16+
/**
17+
* @param null|string|string[] $data
18+
*/
19+
public function make(
20+
string $type,
21+
bool $toMany,
22+
$data
23+
): ?RelationshipDataInterface {
1824
if (null === $data && true === $toMany) {
1925
return ToManyRelationshipData::makeEmpty();
2026
}

src/Implementation/Model/Document/Document.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,17 @@
1616

1717
class Document implements DocumentInterface
1818
{
19-
/** @var null|DocumentDataInterface */
20-
private $data;
19+
private ?DocumentDataInterface $data;
2120

22-
/** @var null|ErrorCollectionInterface */
23-
private $errors;
21+
private ?ErrorCollectionInterface $errors;
2422

25-
/** @var null|MetaInterface */
26-
private $meta;
23+
private ?MetaInterface $meta;
2724

28-
/** @var null|MetaInterface */
29-
private $jsonApiMeta;
25+
private ?MetaInterface $jsonApiMeta;
3026

31-
/** @var null|LinkCollectionInterface */
32-
private $links;
27+
private ?LinkCollectionInterface $links;
3328

34-
/** @var null|ResourceCollectionInterface */
35-
private $included;
29+
private ?ResourceCollectionInterface $included;
3630

3731
public function __construct(
3832
?DocumentDataInterface $data,

0 commit comments

Comments
 (0)