Skip to content

Commit

Permalink
add BC-related improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Zakhar Shokel committed Sep 10, 2024
1 parent 191b540 commit e287c67
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 45 deletions.
12 changes: 2 additions & 10 deletions src/Attribute/Body.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ public function __construct(
$this->setOptional($options['optional'] ?? $optional);
}

/**
* @param string|null $denormalizationType
* @return $this
*/
private function setDenormalizationType($denormalizationType): self
private function setDenormalizationType(?string $denormalizationType): self
{
$this->denormalizationType = $denormalizationType;
return $this;
Expand All @@ -71,11 +67,7 @@ private function setParameterName(string $parameterName): self
return $this;
}

/**
* @param bool|null $optional
* @return $this
*/
private function setOptional($optional): self
private function setOptional(?bool $optional): self
{
$this->optional = $optional;
return $this;
Expand Down
12 changes: 2 additions & 10 deletions src/Attribute/PathAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,13 @@ private function setPathPartName(string $pathPartName): self
return $this;
}

/**
* @param string|null $resolverType
* @return $this
*/
private function setResolverType($resolverType): self
private function setResolverType(?string $resolverType): self
{
$this->resolverType = $resolverType;
return $this;
}

/**
* @param bool|null $resolutionMandatory
* @return $this
*/
private function setResolutionMandatory($resolutionMandatory): self
private function setResolutionMandatory(?bool $resolutionMandatory): self
{
$this->resolutionMandatory = $resolutionMandatory;
return $this;
Expand Down
12 changes: 2 additions & 10 deletions src/Attribute/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ private function setParameterName(string $parameterName): self
return $this;
}

/**
* @param string|null $denormalizationType
* @return $this
*/
private function setDenormalizationType($denormalizationType): self
private function setDenormalizationType(?string $denormalizationType): self
{
$this->denormalizationType = $denormalizationType;
return $this;
Expand All @@ -72,11 +68,7 @@ public function setDenormalizationGroup($denormalizationGroup): self
return $this;
}

/**
* @param Validation|null $validation
* @return $this
*/
private function setValidation($validation): self
private function setValidation(?Validation $validation): self
{
$this->validation = $validation;
return $this;
Expand Down
9 changes: 2 additions & 7 deletions src/Attribute/ResponseNormalization.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,12 @@ public function __construct(
array $options = [],
?string $normalizationType = null,
?string $normalizationGroup = null
)
{
) {
$this->setNormalizationType($options['normalizationType'] ?? $normalizationType);
$this->setNormalizationGroup($options['normalizationGroup'] ?? $normalizationGroup);
}

/**
* @param string|null $normalizationType
* @return $this
*/
private function setNormalizationType($normalizationType): self
private function setNormalizationType(?string $normalizationType): self
{
$this->normalizationType = $normalizationType;
return $this;
Expand Down
20 changes: 12 additions & 8 deletions src/Service/Annotation/ReflectionMethodWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@

namespace Paysera\Bundle\ApiBundle\Service\Annotation;

use Paysera\Bundle\ApiBundle\Service\RoutingLoader\ReflectionMethodWrapper as RoutingLoaderReflectionMethodWrapper;

/**
* @internal
* @deprecated Use {@link RoutingLoaderReflectionMethodWrapper} instead
*/
class ReflectionMethodWrapper extends RoutingLoaderReflectionMethodWrapper
{
use Paysera\Bundle\ApiBundle\Service\RoutingLoader\ReflectionMethodWrapper as NewReflectionMethodWrapper;

class_exists(NewReflectionMethodWrapper::class);

if (false) {
/**
* @internal
* @deprecated since 1.8, to be removed in 2.0, use {@link NewReflectionMethodWrapper} instead
*/
class ReflectionMethodWrapper extends NewReflectionMethodWrapper
{
}
}
5 changes: 5 additions & 0 deletions src/Service/RoutingLoader/ReflectionMethodWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Paysera\Bundle\ApiBundle\Exception\ConfigurationException;
use ReflectionMethod;
use ReflectionParameter;
use Paysera\Bundle\ApiBundle\Service\Annotation\ReflectionMethodWrapper as LegacyReflectionMethodWrapper;

/**
* @internal
Expand Down Expand Up @@ -59,3 +60,7 @@ public function getFriendlyName()
);
}
}

if (!class_exists(LegacyReflectionMethodWrapper::class, false)) {
class_alias(ReflectionMethodWrapper::class, LegacyReflectionMethodWrapper::class);
}

0 comments on commit e287c67

Please sign in to comment.