Skip to content

Commit 73fcb54

Browse files
authored
Merge pull request #331 from W0rma/update-coding-standard
doctrine/coding-standard v12
2 parents b302c0b + 0812530 commit 73fcb54

22 files changed

+17
-52
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
},
2626
"require-dev": {
2727
"phpunit/phpunit": "^7 | ^9.5.10",
28-
"doctrine/coding-standard": "^5.0 | ^8.0",
28+
"doctrine/coding-standard": "^12.0",
2929
"doctrine/persistence": "^1.3.4 | ^2.0 | ^3.0",
3030
"pagerfanta/core": "^2.4 || ^3.0",
3131
"phpdocumentor/type-resolver": "^1.5.1",

phpcs.xml.dist

+5-4
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,17 @@
3131
<exclude name="SlevomatCodingStandard.ControlStructures.AssignmentInCondition.AssignmentInCondition"/>
3232
<exclude name="SlevomatCodingStandard.ControlStructures.EarlyExit"/>
3333

34+
<exclude name="SlevomatCodingStandard.Commenting.RequireOneLineDocComment.MultiLineDocComment"/>
3435
<exclude name="SlevomatCodingStandard.Commenting.RequireOneLinePropertyDocComment"/>
3536

3637
<exclude name="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator.RequiredNullCoalesceEqualOperator"/>
3738

3839
<exclude name="SlevomatCodingStandard.Classes.SuperfluousTraitNaming.SuperfluousSuffix"/>
3940

41+
<exclude name="SlevomatCodingStandard.Functions.RequireTrailingCommaInCall.MissingTrailingComma"/>
42+
43+
<exclude name="SlevomatCodingStandard.PHP.RequireNowdoc.RequiredNowdoc"/>
44+
4045
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint"/>
4146
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint"/>
4247

@@ -99,10 +104,6 @@
99104
<exclude-pattern>tests/*</exclude-pattern>
100105
</rule>
101106

102-
<rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements">
103-
<exclude-pattern>tests/*</exclude-pattern>
104-
</rule>
105-
106107
<rule ref="SlevomatCodingStandard.Commenting.DocCommentSpacing">
107108
<properties>
108109
<property name="annotationsGroups" type="array">

src/Configuration/Metadata/Driver/AnnotationDriver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(
2828
}
2929

3030
/**
31-
* {@inheritdoc}
31+
* {@inheritDoc}
3232
*/
3333
protected function getClassAnnotations(\ReflectionClass $class): array
3434
{

src/Configuration/Metadata/Driver/AttributeDriver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class AttributeDriver extends AnnotationOrAttributeDriver
88
{
99
/**
10-
* {@inheritdoc}
10+
* {@inheritDoc}
1111
*/
1212
protected function getClassAnnotations(\ReflectionClass $class): array
1313
{

src/Configuration/Metadata/Driver/CheckExpressionTrait.php

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ trait CheckExpressionTrait
1616

1717
/**
1818
* @param mixed $exp
19-
* @param array $names
2019
*
2120
* @return Expression|mixed
2221
*/

src/Configuration/Metadata/Driver/XmlDriver.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function __construct(
4141
ParserInterface $typeParser
4242
) {
4343
parent::__construct($locator);
44+
4445
$this->relationProvider = $relationProvider;
4546
$this->expressionLanguage = $expressionLanguage;
4647
$this->typeParser = $typeParser;
@@ -177,7 +178,7 @@ private function createEmbedded($embedded): Embedded
177178
{
178179
$embeddedExclusion = isset($embedded->exclusion) ? $this->parseExclusion($embedded->exclusion) : null;
179180
$xmlElementName = isset($embedded->attributes('')->{'xml-element-name'}) ? $this->checkExpression((string) $embedded->attributes('')->{'xml-element-name'}) : null;
180-
$type = isset($embedded->attributes('')->{'type'}) ? $this->typeParser->parse((string) $embedded->attributes('')->{'type'}) : null;
181+
$type = isset($embedded->attributes('')->type) ? $this->typeParser->parse((string) $embedded->attributes('')->type) : null;
181182

182183
return new Embedded(
183184
$this->checkExpression((string) $embedded->content),

src/Configuration/Metadata/Driver/YamlDriver.php

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function __construct(
4040
ParserInterface $typeParser
4141
) {
4242
parent::__construct($locator);
43+
4344
$this->relationProvider = $relationProvider;
4445
$this->expressionLanguage = $expressionLanguage;
4546
$this->typeParser = $typeParser;

src/Configuration/Provider/ChainProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function addProvider(RelationProviderInterface $resolver): void
2424
}
2525

2626
/**
27-
* {@inheritdoc}
27+
* {@inheritDoc}
2828
*/
2929
public function getRelations(RelationProvider $configuration, string $class): array
3030
{

src/Configuration/Provider/ExpressionEvaluatorProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct(ExpressionEvaluatorInterface $expressionEvaluator)
2020
}
2121

2222
/**
23-
* {@inheritdoc}
23+
* {@inheritDoc}
2424
*/
2525
public function getRelations(RelationProvider $configuration, string $class): array
2626
{

src/Configuration/Provider/FunctionProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class FunctionProvider implements RelationProviderInterface
1010
{
1111
/**
12-
* {@inheritdoc}
12+
* {@inheritDoc}
1313
*/
1414
public function getRelations(RelationProvider $configuration, string $class): array
1515
{

src/Configuration/Provider/StaticMethodProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class StaticMethodProvider implements RelationProviderInterface
1010
{
1111
/**
12-
* {@inheritdoc}
12+
* {@inheritDoc}
1313
*/
1414
public function getRelations(RelationProvider $configuration, string $class): array
1515
{

src/Configuration/Relation.php

-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class Relation
3939
* @param string|Expression $name
4040
* @param string|Route $href
4141
* @param Embedded|string|mixed $embedded
42-
* @param array $attributes
4342
*/
4443
public function __construct(string $name, $href = null, $embedded = null, array $attributes = [], ?Exclusion $exclusion = null)
4544
{
@@ -71,9 +70,6 @@ public function getHref()
7170
return $this->href;
7271
}
7372

74-
/**
75-
* @return array
76-
*/
7773
public function getAttributes(): array
7874
{
7975
return $this->attributes;

src/Expression/LinkExpressionFunction.php

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ class LinkExpressionFunction implements ExpressionFunctionProviderInterface
1111
{
1212
/**
1313
* @return ExpressionFunction[]
14-
*
15-
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint
1614
*/
1715
public function getFunctions(): array
1816
{

src/Factory/EmbeddedsFactory.php

-4
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ public function create(object $object, SerializationContext $context): array
4848

4949
if (null !== ($classMetadata = $this->metadataFactory->getMetadataForClass(get_class($object)))) {
5050
$langugeData = ['object' => $object, 'context' => $context];
51-
/**
52-
* @var $relation Relation
53-
*/
5451
foreach ($classMetadata->getRelations() as $relation) {
5552
if ($this->exclusionManager->shouldSkipEmbedded($object, $relation, $context)) {
5653
continue;
@@ -71,7 +68,6 @@ public function create(object $object, SerializationContext $context): array
7168

7269
/**
7370
* @param mixed $exp
74-
* @param array $data
7571
*
7672
* @return mixed
7773
*/

src/Factory/LinkFactory.php

-7
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ public function createLink(object $object, Relation $relation, SerializationCont
7575

7676
/**
7777
* @param mixed $exp
78-
* @param array $data
7978
*
8079
* @return mixed
8180
*/
@@ -88,12 +87,6 @@ private function checkExpression($exp, array $data)
8887
}
8988
}
9089

91-
/**
92-
* @param array $array
93-
* @param array $data
94-
*
95-
* @return array
96-
*/
9790
private function evaluateArray(array $array, array $data): array
9891
{
9992
$newArray = [];

src/Hateoas.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ public function __construct(SerializerInterface $serializer, LinkHelper $linkHel
2828
}
2929

3030
/**
31-
* {@inheritdoc}
31+
* {@inheritDoc}
3232
*/
3333
public function serialize($data, string $format, ?SerializationContext $context = null, ?string $type = null): string
3434
{
3535
return $this->serializer->serialize($data, $format, $context, $type);
3636
}
3737

3838
/**
39-
* {@inheritdoc}
39+
* {@inheritDoc}
4040
*/
4141
public function deserialize(string $data, string $type, string $format, ?DeserializationContext $context = null)
4242
{

src/HateoasBuilder.php

-4
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,6 @@ public function includeInterfaceMetadata(bool $include): HateoasBuilder
303303
* Set a map of namespace prefixes to directories.
304304
*
305305
* This method overrides any previously defined directories.
306-
*
307-
* @param array $namespacePrefixToDirMap
308306
*/
309307
public function setMetadataDirs(array $namespacePrefixToDirMap): HateoasBuilder
310308
{
@@ -357,8 +355,6 @@ public function addMetadataDir(string $dir, string $namespacePrefix = ''): Hateo
357355

358356
/**
359357
* Add a map of namespace prefixes to directories.
360-
*
361-
* @param array $namespacePrefixToDirMap
362358
*/
363359
public function addMetadataDirs(array $namespacePrefixToDirMap): HateoasBuilder
364360
{

src/Model/Link.php

-6
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,13 @@ class Link
2121
*/
2222
private $attributes;
2323

24-
/**
25-
* @param array $attributes
26-
*/
2724
public function __construct(string $rel, string $href, array $attributes = [])
2825
{
2926
$this->rel = $rel;
3027
$this->href = $href;
3128
$this->attributes = $attributes;
3229
}
3330

34-
/**
35-
* @return array
36-
*/
3731
public function getAttributes(): array
3832
{
3933
return $this->attributes;

src/Representation/AbstractSegmentedRepresentation.php

-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ public function getLimit(): int
6060

6161
/**
6262
* @param null $limit
63-
*
64-
* @return array
6563
*/
6664
public function getParameters(?int $limit = null): array
6765
{

src/Representation/OffsetRepresentation.php

-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ public function getOffset(): ?int
9494
/**
9595
* @param null $offset
9696
* @param null $limit
97-
*
98-
* @return array
9997
*/
10098
public function getParameters(?int $offset = null, ?int $limit = null): array
10199
{

src/Representation/PaginatedRepresentation.php

-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ public function getPage(): int
109109
/**
110110
* @param null $page
111111
* @param null $limit
112-
*
113-
* @return array
114112
*/
115113
public function getParameters($page = null, $limit = null): array
116114
{

src/Representation/RouteAwareRepresentation.php

-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class RouteAwareRepresentation
4646

4747
/**
4848
* @param mixed $inline
49-
* @param array $parameters
5049
*/
5150
public function __construct($inline, string $route, array $parameters = [], bool $absolute = false)
5251
{
@@ -69,9 +68,6 @@ public function getRoute(): string
6968
return $this->route;
7069
}
7170

72-
/**
73-
* @return array
74-
*/
7571
public function getParameters(): array
7672
{
7773
return $this->parameters;

0 commit comments

Comments
 (0)