Skip to content

Commit

Permalink
Merge pull request #331 from W0rma/update-coding-standard
Browse files Browse the repository at this point in the history
doctrine/coding-standard v12
  • Loading branch information
goetas authored Oct 15, 2024
2 parents b302c0b + 0812530 commit 73fcb54
Show file tree
Hide file tree
Showing 22 changed files with 17 additions and 52 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"require-dev": {
"phpunit/phpunit": "^7 | ^9.5.10",
"doctrine/coding-standard": "^5.0 | ^8.0",
"doctrine/coding-standard": "^12.0",
"doctrine/persistence": "^1.3.4 | ^2.0 | ^3.0",
"pagerfanta/core": "^2.4 || ^3.0",
"phpdocumentor/type-resolver": "^1.5.1",
Expand Down
9 changes: 5 additions & 4 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@
<exclude name="SlevomatCodingStandard.ControlStructures.AssignmentInCondition.AssignmentInCondition"/>
<exclude name="SlevomatCodingStandard.ControlStructures.EarlyExit"/>

<exclude name="SlevomatCodingStandard.Commenting.RequireOneLineDocComment.MultiLineDocComment"/>
<exclude name="SlevomatCodingStandard.Commenting.RequireOneLinePropertyDocComment"/>

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

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

<exclude name="SlevomatCodingStandard.Functions.RequireTrailingCommaInCall.MissingTrailingComma"/>

<exclude name="SlevomatCodingStandard.PHP.RequireNowdoc.RequiredNowdoc"/>

<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint"/>
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint"/>

Expand Down Expand Up @@ -99,10 +104,6 @@
<exclude-pattern>tests/*</exclude-pattern>
</rule>

<rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements">
<exclude-pattern>tests/*</exclude-pattern>
</rule>

<rule ref="SlevomatCodingStandard.Commenting.DocCommentSpacing">
<properties>
<property name="annotationsGroups" type="array">
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration/Metadata/Driver/AnnotationDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* {@inheritDoc}
*/
protected function getClassAnnotations(\ReflectionClass $class): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration/Metadata/Driver/AttributeDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class AttributeDriver extends AnnotationOrAttributeDriver
{
/**
* {@inheritdoc}
* {@inheritDoc}
*/
protected function getClassAnnotations(\ReflectionClass $class): array
{
Expand Down
1 change: 0 additions & 1 deletion src/Configuration/Metadata/Driver/CheckExpressionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ trait CheckExpressionTrait

/**
* @param mixed $exp
* @param array $names
*
* @return Expression|mixed
*/
Expand Down
3 changes: 2 additions & 1 deletion src/Configuration/Metadata/Driver/XmlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public function __construct(
ParserInterface $typeParser
) {
parent::__construct($locator);

$this->relationProvider = $relationProvider;
$this->expressionLanguage = $expressionLanguage;
$this->typeParser = $typeParser;
Expand Down Expand Up @@ -177,7 +178,7 @@ private function createEmbedded($embedded): Embedded
{
$embeddedExclusion = isset($embedded->exclusion) ? $this->parseExclusion($embedded->exclusion) : null;
$xmlElementName = isset($embedded->attributes('')->{'xml-element-name'}) ? $this->checkExpression((string) $embedded->attributes('')->{'xml-element-name'}) : null;
$type = isset($embedded->attributes('')->{'type'}) ? $this->typeParser->parse((string) $embedded->attributes('')->{'type'}) : null;
$type = isset($embedded->attributes('')->type) ? $this->typeParser->parse((string) $embedded->attributes('')->type) : null;

return new Embedded(
$this->checkExpression((string) $embedded->content),
Expand Down
1 change: 1 addition & 0 deletions src/Configuration/Metadata/Driver/YamlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function __construct(
ParserInterface $typeParser
) {
parent::__construct($locator);

$this->relationProvider = $relationProvider;
$this->expressionLanguage = $expressionLanguage;
$this->typeParser = $typeParser;
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration/Provider/ChainProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function addProvider(RelationProviderInterface $resolver): void
}

/**
* {@inheritdoc}
* {@inheritDoc}
*/
public function getRelations(RelationProvider $configuration, string $class): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration/Provider/ExpressionEvaluatorProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct(ExpressionEvaluatorInterface $expressionEvaluator)
}

/**
* {@inheritdoc}
* {@inheritDoc}
*/
public function getRelations(RelationProvider $configuration, string $class): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration/Provider/FunctionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class FunctionProvider implements RelationProviderInterface
{
/**
* {@inheritdoc}
* {@inheritDoc}
*/
public function getRelations(RelationProvider $configuration, string $class): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration/Provider/StaticMethodProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class StaticMethodProvider implements RelationProviderInterface
{
/**
* {@inheritdoc}
* {@inheritDoc}
*/
public function getRelations(RelationProvider $configuration, string $class): array
{
Expand Down
4 changes: 0 additions & 4 deletions src/Configuration/Relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class Relation
* @param string|Expression $name
* @param string|Route $href
* @param Embedded|string|mixed $embedded
* @param array $attributes
*/
public function __construct(string $name, $href = null, $embedded = null, array $attributes = [], ?Exclusion $exclusion = null)
{
Expand Down Expand Up @@ -71,9 +70,6 @@ public function getHref()
return $this->href;
}

/**
* @return array
*/
public function getAttributes(): array
{
return $this->attributes;
Expand Down
2 changes: 0 additions & 2 deletions src/Expression/LinkExpressionFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ class LinkExpressionFunction implements ExpressionFunctionProviderInterface
{
/**
* @return ExpressionFunction[]
*
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint
*/
public function getFunctions(): array
{
Expand Down
4 changes: 0 additions & 4 deletions src/Factory/EmbeddedsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ public function create(object $object, SerializationContext $context): array

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

/**
* @param mixed $exp
* @param array $data
*
* @return mixed
*/
Expand Down
7 changes: 0 additions & 7 deletions src/Factory/LinkFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public function createLink(object $object, Relation $relation, SerializationCont

/**
* @param mixed $exp
* @param array $data
*
* @return mixed
*/
Expand All @@ -88,12 +87,6 @@ private function checkExpression($exp, array $data)
}
}

/**
* @param array $array
* @param array $data
*
* @return array
*/
private function evaluateArray(array $array, array $data): array
{
$newArray = [];
Expand Down
4 changes: 2 additions & 2 deletions src/Hateoas.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ public function __construct(SerializerInterface $serializer, LinkHelper $linkHel
}

/**
* {@inheritdoc}
* {@inheritDoc}
*/
public function serialize($data, string $format, ?SerializationContext $context = null, ?string $type = null): string
{
return $this->serializer->serialize($data, $format, $context, $type);
}

/**
* {@inheritdoc}
* {@inheritDoc}
*/
public function deserialize(string $data, string $type, string $format, ?DeserializationContext $context = null)
{
Expand Down
4 changes: 0 additions & 4 deletions src/HateoasBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@ public function includeInterfaceMetadata(bool $include): HateoasBuilder
* Set a map of namespace prefixes to directories.
*
* This method overrides any previously defined directories.
*
* @param array $namespacePrefixToDirMap
*/
public function setMetadataDirs(array $namespacePrefixToDirMap): HateoasBuilder
{
Expand Down Expand Up @@ -357,8 +355,6 @@ public function addMetadataDir(string $dir, string $namespacePrefix = ''): Hateo

/**
* Add a map of namespace prefixes to directories.
*
* @param array $namespacePrefixToDirMap
*/
public function addMetadataDirs(array $namespacePrefixToDirMap): HateoasBuilder
{
Expand Down
6 changes: 0 additions & 6 deletions src/Model/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,13 @@ class Link
*/
private $attributes;

/**
* @param array $attributes
*/
public function __construct(string $rel, string $href, array $attributes = [])
{
$this->rel = $rel;
$this->href = $href;
$this->attributes = $attributes;
}

/**
* @return array
*/
public function getAttributes(): array
{
return $this->attributes;
Expand Down
2 changes: 0 additions & 2 deletions src/Representation/AbstractSegmentedRepresentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ public function getLimit(): int

/**
* @param null $limit
*
* @return array
*/
public function getParameters(?int $limit = null): array
{
Expand Down
2 changes: 0 additions & 2 deletions src/Representation/OffsetRepresentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ public function getOffset(): ?int
/**
* @param null $offset
* @param null $limit
*
* @return array
*/
public function getParameters(?int $offset = null, ?int $limit = null): array
{
Expand Down
2 changes: 0 additions & 2 deletions src/Representation/PaginatedRepresentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ public function getPage(): int
/**
* @param null $page
* @param null $limit
*
* @return array
*/
public function getParameters($page = null, $limit = null): array
{
Expand Down
4 changes: 0 additions & 4 deletions src/Representation/RouteAwareRepresentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class RouteAwareRepresentation

/**
* @param mixed $inline
* @param array $parameters
*/
public function __construct($inline, string $route, array $parameters = [], bool $absolute = false)
{
Expand All @@ -69,9 +68,6 @@ public function getRoute(): string
return $this->route;
}

/**
* @return array
*/
public function getParameters(): array
{
return $this->parameters;
Expand Down

0 comments on commit 73fcb54

Please sign in to comment.