Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CS / phpstan changes #1648

Merged
merged 4 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"require-dev": {
"composer/package-versions-deprecated": "^1.11",
"doctrine/annotations": "^1.7 || ^2.0",
"friendsofphp/php-cs-fixer": "^2.17 || ^3.47.1",
"friendsofphp/php-cs-fixer": "^2.17 || 3.62.0",
"phpstan/phpstan": "^1.6",
"phpunit/phpunit": ">=8",
"vimeo/psalm": "^4.23"
Expand Down
10 changes: 10 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ parameters:
count: 1
path: src/Generator.php

-
message: "#^Result of && is always false\\.$#"
count: 3
path: src/Processors/AugmentProperties.php

-
message: "#^Strict comparison using \\=\\=\\= between non\\-empty\\-string and '' will always evaluate to false\\.$#"
count: 1
path: src/Processors/AugmentProperties.php

-
message: "#^Call to function is_array\\(\\) with bool\\|OpenApi\\\\Annotations\\\\AdditionalProperties will always evaluate to false\\.$#"
count: 1
Expand Down
9 changes: 5 additions & 4 deletions src/Attributes/AdditionalProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
namespace OpenApi\Attributes;

use OpenApi\Generator;
use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS)]
class AdditionalProperties extends \OpenApi\Annotations\AdditionalProperties
class AdditionalProperties extends OA\AdditionalProperties
{
/**
* @param string|non-empty-array<string>|null $type
Expand All @@ -19,9 +20,9 @@ class AdditionalProperties extends \OpenApi\Annotations\AdditionalProperties
* @param int|float $maximum
* @param int|float $minimum
* @param array<string|int|float|bool|\UnitEnum|null>|class-string|null $enum
* @param array<Schema|\OpenApi\Annotations\Schema> $allOf
* @param array<Schema|\OpenApi\Annotations\Schema> $anyOf
* @param array<Schema|\OpenApi\Annotations\Schema> $oneOf
* @param array<Schema|OA\Schema> $allOf
* @param array<Schema|OA\Schema> $anyOf
* @param array<Schema|OA\Schema> $oneOf
* @param array<string,mixed>|null $x
* @param Attachable[]|null $attachables
*/
Expand Down
4 changes: 3 additions & 1 deletion src/Attributes/Attachable.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

namespace OpenApi\Attributes;

use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_ALL | \Attribute::IS_REPEATABLE)]
class Attachable extends \OpenApi\Annotations\Attachable
class Attachable extends OA\Attachable
{
public function __construct(array $properties = [])
{
Expand Down
23 changes: 12 additions & 11 deletions src/Attributes/Components.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,22 @@
namespace OpenApi\Attributes;

use OpenApi\Generator;
use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS)]
class Components extends \OpenApi\Annotations\Components
class Components extends OA\Components
{
/**
* @param array<Schema|\OpenApi\Annotations\Schema>|null $schemas
* @param Response[]|null $responses
* @param Parameter[]|null $parameters
* @param RequestBody[]|null $requestBodies
* @param array<Examples>|null $examples
* @param Header[]|null $headers
* @param SecurityScheme[]|null $securitySchemes
* @param Link[]|null $links
* @param array<string,mixed>|null $x
* @param Attachable[]|null $attachables
* @param array<Schema|OA\Schema>|null $schemas
* @param Response[]|null $responses
* @param Parameter[]|null $parameters
* @param RequestBody[]|null $requestBodies
* @param array<Examples>|null $examples
* @param Header[]|null $headers
* @param SecurityScheme[]|null $securitySchemes
* @param Link[]|null $links
* @param array<string,mixed>|null $x
* @param Attachable[]|null $attachables
*/
public function __construct(
?array $schemas = null,
Expand Down
3 changes: 2 additions & 1 deletion src/Attributes/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
namespace OpenApi\Attributes;

use OpenApi\Generator;
use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS)]
class Contact extends \OpenApi\Annotations\Contact
class Contact extends OA\Contact
{
/**
* @param array<string,mixed>|null $x
Expand Down
4 changes: 3 additions & 1 deletion src/Attributes/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

namespace OpenApi\Attributes;

use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class Delete extends \OpenApi\Annotations\Delete
class Delete extends OA\Delete
{
use OperationTrait;
}
3 changes: 2 additions & 1 deletion src/Attributes/Discriminator.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
namespace OpenApi\Attributes;

use OpenApi\Generator;
use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS)]
class Discriminator extends \OpenApi\Annotations\Discriminator
class Discriminator extends OA\Discriminator
{
/**
* @param string[]|null $mapping
Expand Down
3 changes: 2 additions & 1 deletion src/Attributes/Examples.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
namespace OpenApi\Attributes;

use OpenApi\Generator;
use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY | \Attribute::IS_REPEATABLE)]
class Examples extends \OpenApi\Annotations\Examples
class Examples extends OA\Examples
{
/**
* @param string|class-string|object|null $ref
Expand Down
3 changes: 2 additions & 1 deletion src/Attributes/ExternalDocumentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
namespace OpenApi\Attributes;

use OpenApi\Generator;
use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS)]
class ExternalDocumentation extends \OpenApi\Annotations\ExternalDocumentation
class ExternalDocumentation extends OA\ExternalDocumentation
{
/**
* @param array<string,mixed>|null $x
Expand Down
3 changes: 2 additions & 1 deletion src/Attributes/Flow.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
namespace OpenApi\Attributes;

use OpenApi\Generator;
use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS)]
class Flow extends \OpenApi\Annotations\Flow
class Flow extends OA\Flow
{
/**
* @param array<string,mixed>|null $x
Expand Down
4 changes: 3 additions & 1 deletion src/Attributes/Get.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

namespace OpenApi\Attributes;

use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class Get extends \OpenApi\Annotations\Get
class Get extends OA\Get
{
use OperationTrait;
}
4 changes: 3 additions & 1 deletion src/Attributes/Head.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

namespace OpenApi\Attributes;

use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class Head extends \OpenApi\Annotations\Head
class Head extends OA\Head
{
use OperationTrait;
}
3 changes: 2 additions & 1 deletion src/Attributes/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
namespace OpenApi\Attributes;

use OpenApi\Generator;
use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class Header extends \OpenApi\Annotations\Header
class Header extends OA\Header
{
/**
* @param string|class-string|object|null $ref
Expand Down
3 changes: 2 additions & 1 deletion src/Attributes/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
namespace OpenApi\Attributes;

use OpenApi\Generator;
use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS)]
class Info extends \OpenApi\Annotations\Info
class Info extends OA\Info
{
/**
* @param array<string,mixed>|null $x
Expand Down
9 changes: 5 additions & 4 deletions src/Attributes/Items.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
namespace OpenApi\Attributes;

use OpenApi\Generator;
use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD)]
class Items extends \OpenApi\Annotations\Items
class Items extends OA\Items
{
/**
* @param string|non-empty-array<string>|null $type
Expand All @@ -19,9 +20,9 @@ class Items extends \OpenApi\Annotations\Items
* @param int|float $maximum
* @param int|float $minimum
* @param array<string|int|float|bool|\UnitEnum|null>|class-string|null $enum
* @param array<Schema|\OpenApi\Annotations\Schema> $allOf
* @param array<Schema|\OpenApi\Annotations\Schema> $anyOf
* @param array<Schema|\OpenApi\Annotations\Schema> $oneOf
* @param array<Schema|OA\Schema> $allOf
* @param array<Schema|OA\Schema> $anyOf
* @param array<Schema|OA\Schema> $oneOf
* @param array<string,mixed>|null $x
* @param Attachable[]|null $attachables
*/
Expand Down
9 changes: 5 additions & 4 deletions src/Attributes/JsonContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
namespace OpenApi\Attributes;

use OpenApi\Generator;
use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS)]
class JsonContent extends \OpenApi\Annotations\JsonContent
class JsonContent extends OA\JsonContent
{
/**
* @param string|non-empty-array<string>|null $type
Expand All @@ -20,9 +21,9 @@ class JsonContent extends \OpenApi\Annotations\JsonContent
* @param int|float $maximum
* @param int|float $minimum
* @param array<string|int|float|bool|\UnitEnum|null>|class-string|null $enum
* @param array<Schema|\OpenApi\Annotations\Schema> $allOf
* @param array<Schema|\OpenApi\Annotations\Schema> $anyOf
* @param array<Schema|\OpenApi\Annotations\Schema> $oneOf
* @param array<Schema|OA\Schema> $allOf
* @param array<Schema|OA\Schema> $anyOf
* @param array<Schema|OA\Schema> $oneOf
* @param array<string,mixed>|null $x
* @param Attachable[]|null $attachables
*/
Expand Down
3 changes: 2 additions & 1 deletion src/Attributes/License.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
namespace OpenApi\Attributes;

use OpenApi\Generator;
use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS)]
class License extends \OpenApi\Annotations\License
class License extends OA\License
{
/**
* @param array<string,mixed>|null $x
Expand Down
3 changes: 2 additions & 1 deletion src/Attributes/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
namespace OpenApi\Attributes;

use OpenApi\Generator;
use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD)]
class Link extends \OpenApi\Annotations\Link
class Link extends OA\Link
{
/**
* @param string|class-string|object|null $ref
Expand Down
3 changes: 2 additions & 1 deletion src/Attributes/MediaType.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
namespace OpenApi\Attributes;

use OpenApi\Generator;
use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS)]
class MediaType extends \OpenApi\Annotations\MediaType
class MediaType extends OA\MediaType
{
/**
* @param array<Examples> $examples
Expand Down
3 changes: 2 additions & 1 deletion src/Attributes/OpenApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
namespace OpenApi\Attributes;

use OpenApi\Generator;
use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS)]
class OpenApi extends \OpenApi\Annotations\OpenApi
class OpenApi extends OA\OpenApi
{
/**
* @param Server[]|null $servers
Expand Down
4 changes: 3 additions & 1 deletion src/Attributes/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

namespace OpenApi\Attributes;

use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class Options extends \OpenApi\Annotations\Options
class Options extends OA\Options
{
use OperationTrait;
}
4 changes: 3 additions & 1 deletion src/Attributes/Parameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

namespace OpenApi\Attributes;

use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY | \Attribute::TARGET_PARAMETER | \Attribute::IS_REPEATABLE)]
class Parameter extends \OpenApi\Annotations\Parameter
class Parameter extends OA\Parameter
{
use ParameterTrait;
}
4 changes: 3 additions & 1 deletion src/Attributes/Patch.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

namespace OpenApi\Attributes;

use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class Patch extends \OpenApi\Annotations\Patch
class Patch extends OA\Patch
{
use OperationTrait;
}
3 changes: 2 additions & 1 deletion src/Attributes/PathItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
namespace OpenApi\Attributes;

use OpenApi\Generator;
use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class PathItem extends \OpenApi\Annotations\PathItem
class PathItem extends OA\PathItem
{
/**
* @param string|class-string|object|null $ref
Expand Down
4 changes: 3 additions & 1 deletion src/Attributes/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

namespace OpenApi\Attributes;

use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class Post extends \OpenApi\Annotations\Post
class Post extends OA\Post
{
use OperationTrait;
}
9 changes: 5 additions & 4 deletions src/Attributes/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
namespace OpenApi\Attributes;

use OpenApi\Generator;
use OpenApi\Annotations as OA;

#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY | \Attribute::TARGET_PARAMETER | \Attribute::TARGET_CLASS_CONSTANT | \Attribute::IS_REPEATABLE)]
class Property extends \OpenApi\Annotations\Property
class Property extends OA\Property
{
/**
* @param string|non-empty-array<string>|null $type
Expand All @@ -19,9 +20,9 @@ class Property extends \OpenApi\Annotations\Property
* @param int|float $maximum
* @param int|float $minimum
* @param array<string|int|float|bool|\UnitEnum|null>|class-string|null $enum
* @param array<Schema|\OpenApi\Annotations\Schema> $allOf
* @param array<Schema|\OpenApi\Annotations\Schema> $anyOf
* @param array<Schema|\OpenApi\Annotations\Schema> $oneOf
* @param array<Schema|OA\Schema> $allOf
* @param array<Schema|OA\Schema> $anyOf
* @param array<Schema|OA\Schema> $oneOf
* @param array<string,mixed>|null $x
* @param Attachable[]|null $attachables
*/
Expand Down
Loading