Skip to content

Commit

Permalink
Enable no_superfluous_phpdoc_tags CS rule
Browse files Browse the repository at this point in the history
  • Loading branch information
DerManoMann committed Mar 15, 2024
1 parent 294ff2d commit 1d93c33
Show file tree
Hide file tree
Showing 22 changed files with 3 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
'nullable_type_declaration_for_default_null_value' => true,

'no_empty_phpdoc' => true,
// 7.3 only 'no_superfluous_phpdoc_tags' => true,
'no_superfluous_phpdoc_tags' => true,
'phpdoc_align' => true,
'general_phpdoc_tag_rename' => true,
'phpdoc_inline_tag_normalizer' => true,
Expand Down
3 changes: 1 addition & 2 deletions src/Analysers/DocBlockParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ public function setAliases(array $aliases): void
/**
* Use doctrine to parse the comment block and return the detected annotations.
*
* @param string $comment a T_DOC_COMMENT
* @param Context $context
* @param string $comment a T_DOC_COMMENT
*
* @return array<OA\AbstractAnnotation>
*/
Expand Down
9 changes: 0 additions & 9 deletions src/Annotations/AbstractAnnotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ public function __get(string $property)
$this->_context->logger->warning('Property "' . $property . '" doesn\'t exist in a ' . $this->identity() . ', existing properties: "' . implode('", "', array_keys($properties)) . '" in ' . $this->_context);
}

/**
* @param mixed $value
*/
public function __set(string $property, $value): void
{
$fields = get_object_vars($this);
Expand Down Expand Up @@ -287,9 +284,6 @@ public function __debugInfo()
return $properties;
}

/**
* @return mixed
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
Expand Down Expand Up @@ -741,8 +735,6 @@ private function validateDefaultTypes(string $type, $value): bool

/**
* Validate array type.
*
* @param mixed $value
*/
private function validateArrayType($value): bool
{
Expand All @@ -764,7 +756,6 @@ private function validateArrayType($value): bool
/**
* Wrap the context with a reference to the annotation it is nested in.
*
* @param AbstractAnnotation $annotation
*
* @return AbstractAnnotation
*/
Expand Down
2 changes: 0 additions & 2 deletions src/Annotations/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ class Link extends AbstractAnnotation

/**
* A literal value or {expression} to use as a request body when calling the target operation.
*
* @var mixed
*/
public $requestBody = Generator::UNDEFINED;

Expand Down
2 changes: 0 additions & 2 deletions src/Annotations/MediaType.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class MediaType extends AbstractAnnotation
*
* Furthermore, if referencing a schema which contains an example,
* the example value shall override the example provided by the schema.
*
* @var mixed
*/
public $example = Generator::UNDEFINED;

Expand Down
2 changes: 0 additions & 2 deletions src/Annotations/Parameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ class Parameter extends AbstractAnnotation
* The example object is mutually exclusive of the examples object.
* Furthermore, if referencing a schema which contains an example, the example value shall override the example provided by the schema.
* To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary.
*
* @var mixed
*/
public $example = Generator::UNDEFINED;

Expand Down
6 changes: 0 additions & 6 deletions src/Annotations/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ class Schema extends AbstractAnnotation
* Sets a default value to the parameter. The type of the value depends on the defined type.
*
* @see [JSON schema validation](http://json-schema.org/latest/json-schema-validation.html#anchor101)
*
* @var mixed
*/
public $default = Generator::UNDEFINED;

Expand Down Expand Up @@ -318,8 +316,6 @@ class Schema extends AbstractAnnotation
*
* To represent examples that cannot naturally be represented in JSON or YAML, a string value can be used to
* contain the example with escaping where necessary.
*
* @var mixed
*/
public $example = Generator::UNDEFINED;

Expand Down Expand Up @@ -407,8 +403,6 @@ class Schema extends AbstractAnnotation

/**
* http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.3.
*
* @var mixed
*/
public $const = Generator::UNDEFINED;

Expand Down
1 change: 0 additions & 1 deletion src/Attributes/OperationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
trait OperationTrait
{
/**
* @param array $security
* @param Server[] $servers
* @param string[] $tags
* @param Parameter[] $parameters
Expand Down
1 change: 0 additions & 1 deletion src/Attributes/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class Schema extends \OpenApi\Annotations\Schema
* @param array<Schema|\OpenApi\Annotations\Schema> $allOf
* @param array<Schema|\OpenApi\Annotations\Schema> $anyOf
* @param array<Schema|\OpenApi\Annotations\Schema> $oneOf
* @param mixed $const
* @param array<string,mixed>|null $x
* @param Attachable[]|null $attachables
*/
Expand Down
2 changes: 0 additions & 2 deletions src/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ class Context
{
/**
* Prototypical inheritance for properties.
*
* @var Context|null
*/
private ?Context $parent;

Expand Down
3 changes: 0 additions & 3 deletions src/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ public function __construct(?LoggerInterface $logger = null)
$this->setNamespaces(self::DEFAULT_NAMESPACES);
}

/**
* @param mixed $value
*/
public static function isDefault($value): bool
{
return $value === Generator::UNDEFINED;
Expand Down
2 changes: 0 additions & 2 deletions src/Processors/AugmentParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public function isAugmentOperationParameters(): bool

/**
* If set to <code>true</code> try to find operation parameter descriptions in the operation docblock.
*
* @param bool $augmentOperationParameters
*/
public function setAugmentOperationParameters(bool $augmentOperationParameters): void
{
Expand Down
2 changes: 0 additions & 2 deletions src/Processors/OperationId.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public function isHash(): bool

/**
* If set to <code>true</code> generate ids (md5) instead of clear text operation ids.
*
* @param bool $hash
*/
public function setHash(bool $hash): OperationId
{
Expand Down
4 changes: 0 additions & 4 deletions src/Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,6 @@ protected function doDeserialize(\stdClass $c, string $class, Context $context):

/**
* Deserialize the annotation's property.
*
* @param mixed $value
*
* @return mixed
*/
protected function doDeserializeProperty(OA\AbstractAnnotation $annotation, string $property, $value, Context $context)
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Annotations/AttributesSyncTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ protected function prepDocComment(string $docComment): array

protected function propertyType(\ReflectionProperty $property): ?string
{
$var = null;
$var = 'mixed';
foreach ($this->prepDocComment($property->getDocComment()) as $line) {
if (substr($line, 0, 5) === '@var ') {
$var = trim(substr($line, 5));
Expand Down
2 changes: 0 additions & 2 deletions tests/Fixtures/Annotations/CustomAttachable.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ class CustomAttachable extends OA\Attachable
{
/**
* The attribute value.
*
* @var mixed
*/
public $value = Generator::UNDEFINED;

Expand Down
2 changes: 0 additions & 2 deletions tests/Fixtures/Attributes/CustomAttachable.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ class CustomAttachable extends OAT\Attachable
{
/**
* The attribute value.
*
* @var mixed
*/
public $value = Generator::UNDEFINED;

Expand Down
4 changes: 0 additions & 4 deletions tests/Fixtures/Scratch/ComplexCustomAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ class Schema extends OAT\Schema
{
/**
* @param class-string $of
* @param string|null $description
* @param array $optional
* @param int|null $minLength
* @param int|null $maxLength
*
* @throws \ReflectionException
*/
Expand Down
2 changes: 0 additions & 2 deletions tests/Fixtures/Scratch/MergeTraits.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ trait HasId
* format="int64",
* readOnly=true,
* )
*
* @var int
*/
public int $id;
}
Expand Down
2 changes: 0 additions & 2 deletions tests/Fixtures/Scratch/PromotedProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ class PromotedPropertyDescription
{
/**
* Property name.
*
* @var string
*/
#[OAT\Property(property: 'thename')]
public string $name = '';
Expand Down
2 changes: 0 additions & 2 deletions tests/Fixtures/TypedProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ class TypedProperties
public string $annotationTrumpsNative;

/**
* @var string
*
* @OA\Property(
* type="integer",
* )
Expand Down
5 changes: 0 additions & 5 deletions tests/OpenApiTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ public function assertOpenApiLogEntryContains(string $needle, string $message =
*
* @param array|OA\OpenApi|\stdClass|string $actual The generated output
* @param array|OA\OpenApi|\stdClass|string $expected The specification
* @param string $message
* @param bool $normalized flag indicating whether the inputs are already normalized or
* not
*/
Expand Down Expand Up @@ -255,8 +254,6 @@ protected function annotationsFromDocBlockParser(string $docBlock, array $extraA

/**
* Collect list of all non-abstract annotation classes.
*
* @return array
*/
public function allAnnotationClasses(): array
{
Expand All @@ -278,8 +275,6 @@ public function allAnnotationClasses(): array

/**
* Collect list of all non-abstract attribute classes.
*
* @return array
*/
public function allAttributeClasses(): array
{
Expand Down

0 comments on commit 1d93c33

Please sign in to comment.