Skip to content

Commit

Permalink
Remove the deprecated ProcessorInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
DerManoMann committed Jan 15, 2025
1 parent c6956de commit 5c9ea49
Show file tree
Hide file tree
Showing 22 changed files with 39 additions and 155 deletions.
137 changes: 18 additions & 119 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,187 +1,86 @@
parameters:
ignoreErrors:
-
message: '#^Property OpenApi\\Annotations\\AbstractAnnotation\:\:\$x \(array\<string, mixed\>\) does not accept string\.$#'
identifier: assign.propertyType
message: "#^Property OpenApi\\\\Annotations\\\\AbstractAnnotation\\:\\:\\$x \\(array\\<string, mixed\\>\\) does not accept string\\.$#"
count: 1
path: Examples/processors/schema-query-parameter/SchemaQueryParameter.php

-
message: '#^Attribute class JetBrains\\PhpStorm\\ArrayShape does not exist\.$#'
identifier: attribute.notFound
message: "#^Attribute class JetBrains\\\\PhpStorm\\\\ArrayShape does not exist\\.$#"
count: 1
path: Examples/using-links-php81/User.php

-
message: '#^Call to function method_exists\(\) with ReflectionProperty and ''isPromoted'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 1
path: src/Analysers/AttributeAnnotationFactory.php

-
message: '#^Call to function method_exists\(\) with ReflectionClass\<object\> and ''isEnum'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 1
path: src/Analysers/ReflectionAnalyser.php

-
message: '#^Access to an undefined property OpenApi\\Annotations\\AbstractAnnotation\:\:\$description\.$#'
identifier: property.notFound
message: "#^Access to an undefined property OpenApi\\\\Annotations\\\\AbstractAnnotation\\:\\:\\$description\\.$#"
count: 1
path: src/Annotations/AbstractAnnotation.php

-
message: '#^Access to an undefined property OpenApi\\Annotations\\AbstractAnnotation\:\:\$summary\.$#'
identifier: property.notFound
message: "#^Access to an undefined property OpenApi\\\\Annotations\\\\AbstractAnnotation\\:\\:\\$summary\\.$#"
count: 1
path: src/Annotations/AbstractAnnotation.php

-
message: '#^Call to function property_exists\(\) with OpenApi\\Annotations\\AbstractAnnotation and ''_context'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 1
path: src/Annotations/AbstractAnnotation.php

-
message: '#^Variable \$name might not be defined\.$#'
identifier: variable.undefined
message: "#^Variable \\$name might not be defined\\.$#"
count: 2
path: src/Annotations/Components.php

-
message: '#^Variable \$type might not be defined\.$#'
identifier: variable.undefined
message: "#^Variable \\$type might not be defined\\.$#"
count: 1
path: src/Annotations/Components.php

-
message: '#^Property OpenApi\\Annotations\\Flow\:\:\$scopes \(array\) does not accept stdClass\.$#'
identifier: assign.propertyType
message: "#^Property OpenApi\\\\Annotations\\\\Flow\\:\\:\\$scopes \\(array\\) does not accept stdClass\\.$#"
count: 1
path: src/Annotations/Flow.php

-
message: '#^Method OpenApi\\Processors\\AugmentParameters\:\:extractVarTypeAndDescription\(\) should return array\<string, string\|null\> but returns array\<int\|string, string\|null\>\.$#'
identifier: return.type
message: "#^Access to an undefined property object\\:\\:\\$enum\\.$#"
count: 1
path: src/Processors/AugmentParameters.php
path: src/Annotations/Schema.php

-
message: '#^Strict comparison using \!\=\= between false and string will always evaluate to true\.$#'
identifier: notIdentical.alwaysTrue
count: 1
path: src/Processors/AugmentParameters.php

-
message: '#^Method OpenApi\\Processors\\AugmentProperties\:\:extractVarTypeAndDescription\(\) should return array\<string, string\|null\> but returns array\<int\|string, string\|null\>\.$#'
identifier: return.type
count: 1
path: src/Processors/AugmentProperties.php

-
message: '#^Strict comparison using \!\=\= between false and string will always evaluate to true\.$#'
identifier: notIdentical.alwaysTrue
count: 1
path: src/Processors/AugmentProperties.php

-
message: '#^Property OpenApi\\Annotations\\Schema\:\:\$properties \(array\<OpenApi\\Annotations\\Property\>\) does not accept string\.$#'
identifier: assign.propertyType
message: "#^Property OpenApi\\\\Annotations\\\\Schema\\:\\:\\$properties \\(array\\<OpenApi\\\\Annotations\\\\Property\\>\\) does not accept string\\.$#"
count: 1
path: src/Processors/AugmentSchemas.php

-
message: '#^Method OpenApi\\Processors\\DocBlockDescriptions\:\:extractVarTypeAndDescription\(\) should return array\<string, string\|null\> but returns array\<int\|string, string\|null\>\.$#'
identifier: return.type
count: 1
path: src/Processors/DocBlockDescriptions.php

-
message: '#^Parameter \#1 \$annotation of method OpenApi\\Processors\\DocBlockDescriptions\:\:description\(\) expects OpenApi\\Annotations\\Operation\|OpenApi\\Annotations\\Parameter\|OpenApi\\Annotations\\Schema, OpenApi\\Annotations\\AbstractAnnotation given\.$#'
identifier: argument.type
message: "#^Parameter \\#1 \\$annotation of method OpenApi\\\\Processors\\\\DocBlockDescriptions\\:\\:description\\(\\) expects OpenApi\\\\Annotations\\\\Operation\\|OpenApi\\\\Annotations\\\\Parameter\\|OpenApi\\\\Annotations\\\\Schema, OpenApi\\\\Annotations\\\\AbstractAnnotation given\\.$#"
count: 1
path: src/Processors/DocBlockDescriptions.php

-
message: '#^Parameter \#1 \$annotation of method OpenApi\\Processors\\DocBlockDescriptions\:\:summaryAndDescription\(\) expects OpenApi\\Annotations\\Operation\|OpenApi\\Annotations\\Parameter\|OpenApi\\Annotations\\Schema, OpenApi\\Annotations\\AbstractAnnotation given\.$#'
identifier: argument.type
message: "#^Parameter \\#1 \\$annotation of method OpenApi\\\\Processors\\\\DocBlockDescriptions\\:\\:summaryAndDescription\\(\\) expects OpenApi\\\\Annotations\\\\Operation\\|OpenApi\\\\Annotations\\\\Parameter\\|OpenApi\\\\Annotations\\\\Schema, OpenApi\\\\Annotations\\\\AbstractAnnotation given\\.$#"
count: 1
path: src/Processors/DocBlockDescriptions.php

-
message: '#^Strict comparison using \!\=\= between false and string will always evaluate to true\.$#'
identifier: notIdentical.alwaysTrue
count: 1
path: src/Processors/DocBlockDescriptions.php

-
message: '#^Property OpenApi\\Annotations\\Schema\:\:\$examples \(array\<OpenApi\\Annotations\\Examples\>\) does not accept string\.$#'
identifier: assign.propertyType
message: "#^Property OpenApi\\\\Annotations\\\\Schema\\:\\:\\$examples \\(array\\<OpenApi\\\\Annotations\\\\Examples\\>\\) does not accept string\\.$#"
count: 1
path: src/Processors/MergeJsonContent.php

-
message: '#^Property OpenApi\\Annotations\\Schema\:\:\$examples \(array\<OpenApi\\Annotations\\Examples\>\) does not accept string\.$#'
identifier: assign.propertyType
message: "#^Property OpenApi\\\\Annotations\\\\Schema\\:\\:\\$examples \\(array\\<OpenApi\\\\Annotations\\\\Examples\\>\\) does not accept string\\.$#"
count: 1
path: src/Processors/MergeXmlContent.php

-
message: '#^Parameter \#1 \$callback of function spl_autoload_register expects \(callable\(string\)\: void\)\|null, array\{Composer\\Autoload\\ClassLoader, ''findFile''\} given\.$#'
identifier: argument.type
message: "#^Parameter \\#1 \\$callback of function spl_autoload_register expects \\(callable\\(string\\)\\: void\\)\\|null, array\\{Composer\\\\Autoload\\\\ClassLoader, 'findFile'\\} given\\.$#"
count: 1
path: tests/Analysers/ComposerAutoloaderScannerTest.php

-
message: '#^Access to an undefined property OpenApi\\Analysers\\AnnotationFactoryInterface\:\:\$reflectors\.$#'
identifier: property.notFound
message: "#^Access to an undefined property OpenApi\\\\Analysers\\\\AnnotationFactoryInterface\\:\\:\\$reflectors\\.$#"
count: 2
path: tests/Analysers/ReflectionAnalyserTest.php

-
message: '#^Access to an undefined property Reflector\:\:\$name\.$#'
identifier: property.notFound
message: "#^Access to an undefined property Reflector\\:\\:\\$name\\.$#"
count: 1
path: tests/Analysers/ReflectionAnalyserTest.php

-
message: '#^Call to an undefined method ReflectionType\:\:getName\(\)\.$#'
identifier: method.notFound
message: "#^Call to an undefined method ReflectionType\\:\\:getName\\(\\)\\.$#"
count: 1
path: tests/Annotations/AttributesSyncTest.php

-
message: '#^Method OpenApi\\Tests\\Processors\\AugmentParametersTest\:\:extractVarTypeAndDescription\(\) should return array\<string, string\|null\> but returns array\<int\|string, string\|null\>\.$#'
identifier: return.type
count: 1
path: tests/Processors/AugmentParametersTest.php

-
message: '#^Strict comparison using \!\=\= between false and string will always evaluate to true\.$#'
identifier: notIdentical.alwaysTrue
count: 1
path: tests/Processors/AugmentParametersTest.php

-
message: '#^Method OpenApi\\Tests\\Processors\\AugmentRefsTest\:\:extractVarTypeAndDescription\(\) should return array\<string, string\|null\> but returns array\<int\|string, string\|null\>\.$#'
identifier: return.type
count: 1
path: tests/Processors/AugmentRefsTest.php

-
message: '#^Strict comparison using \!\=\= between false and string will always evaluate to true\.$#'
identifier: notIdentical.alwaysTrue
count: 1
path: tests/Processors/AugmentRefsTest.php

-
message: '#^Method OpenApi\\Tests\\Processors\\DocBlockDescriptionsTest\:\:extractVarTypeAndDescription\(\) should return array\<string, string\|null\> but returns array\<int\|string, string\|null\>\.$#'
identifier: return.type
count: 1
path: tests/Processors/DocBlockDescriptionsTest.php

-
message: '#^Strict comparison using \!\=\= between false and string will always evaluate to true\.$#'
identifier: notIdentical.alwaysTrue
count: 1
path: tests/Processors/DocBlockDescriptionsTest.php
5 changes: 2 additions & 3 deletions src/Analysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
namespace OpenApi;

use OpenApi\Annotations as OA;
use OpenApi\Processors\ProcessorInterface;

/**
* Result of the analyser.
Expand Down Expand Up @@ -405,11 +404,11 @@ public function split()
/**
* Apply the processor(s).
*
* @param callable|ProcessorInterface|array<ProcessorInterface|callable> $processors One or more processors
* @param callable|array<callable> $processors One or more processors
*/
public function process($processors = null): void
{
if (is_array($processors) === false && is_callable($processors) || $processors instanceof ProcessorInterface) {
if (false === is_array($processors) && is_callable($processors)) {
$processors = [$processors];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Processors/AugmentParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Augments shared and operations parameters from docblock comments.
*/
class AugmentParameters implements ProcessorInterface
class AugmentParameters
{
use DocblockTrait;

Expand Down
2 changes: 1 addition & 1 deletion src/Processors/AugmentProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Use the property context to extract useful information and inject that into the annotation.
*/
class AugmentProperties implements ProcessorInterface
class AugmentProperties
{
use Concerns\DocblockTrait;
use Concerns\RefTrait;
Expand Down
2 changes: 1 addition & 1 deletion src/Processors/AugmentRefs.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use OpenApi\Annotations as OA;
use OpenApi\Generator;

class AugmentRefs implements ProcessorInterface
class AugmentRefs
{
use Concerns\RefTrait;

Expand Down
2 changes: 1 addition & 1 deletion src/Processors/AugmentRequestBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* Use the RequestBody context to extract useful information and inject that into the annotation.
*/
class AugmentRequestBody implements ProcessorInterface
class AugmentRequestBody
{
public function __invoke(Analysis $analysis)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Processors/AugmentSchemas.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* Merges properties.
*/
class AugmentSchemas implements ProcessorInterface
class AugmentSchemas
{
public function __invoke(Analysis $analysis)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Processors/AugmentTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* Ensures that all tags used on operations also exist in the global <code>tags</code> list.
*/
class AugmentTags implements ProcessorInterface
class AugmentTags
{
/** @var array<string> */
protected array $whitelist = [];
Expand Down
2 changes: 1 addition & 1 deletion src/Processors/BuildPaths.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Build the openapi->paths using the detected `@OA\PathItem` and `@OA\Operation` (`@OA\Get`, `@OA\Post`, etc).
*/
class BuildPaths implements ProcessorInterface
class BuildPaths
{
public function __invoke(Analysis $analysis)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Processors/CleanUnmerged.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use OpenApi\Analysis;
use OpenApi\Annotations as OA;

class CleanUnmerged implements ProcessorInterface
class CleanUnmerged
{
public function __invoke(Analysis $analysis)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Processors/CleanUnusedComponents.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* Tracks the use of all <code>Components</code> and removed unused schemas.
*/
class CleanUnusedComponents implements ProcessorInterface
class CleanUnusedComponents
{
use Concerns\AnnotationTrait;

Expand Down
2 changes: 1 addition & 1 deletion src/Processors/DocBlockDescriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* Use `null`, for example: `@Annotation(description=null)`, if you don't want the annotation to have a description.
*/
class DocBlockDescriptions implements ProcessorInterface
class DocBlockDescriptions
{
use Concerns\DocblockTrait;

Expand Down
2 changes: 1 addition & 1 deletion src/Processors/ExpandClasses.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* - else
* => merge ancestor properties into the schema.
*/
class ExpandClasses implements ProcessorInterface
class ExpandClasses
{
use Concerns\MergePropertiesTrait;

Expand Down
2 changes: 1 addition & 1 deletion src/Processors/ExpandEnums.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* Determines `schema`, `enum` and `type`.
*/
class ExpandEnums implements ProcessorInterface
class ExpandEnums
{
use Concerns\TypesTrait;

Expand Down
2 changes: 1 addition & 1 deletion src/Processors/ExpandTraits.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* - merge trait annotations/methods/properties into the schema if the trait does not have a schema itself
* - inherit from the trait if it has a schema (allOf).
*/
class ExpandTraits implements ProcessorInterface
class ExpandTraits
{
use Concerns\MergePropertiesTrait;

Expand Down
2 changes: 1 addition & 1 deletion src/Processors/MergeIntoComponents.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Merge reusable annotation into @OA\Schemas.
*/
class MergeIntoComponents implements ProcessorInterface
class MergeIntoComponents
{
public function __invoke(Analysis $analysis)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Processors/MergeIntoOpenApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Merge all @OA\OpenApi annotations into one.
*/
class MergeIntoOpenApi implements ProcessorInterface
class MergeIntoOpenApi
{
public function __invoke(Analysis $analysis)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Processors/MergeJsonContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Split JsonContent into Schema and MediaType.
*/
class MergeJsonContent implements ProcessorInterface
class MergeJsonContent
{
public function __invoke(Analysis $analysis)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Processors/MergeXmlContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Split XmlContent into Schema and MediaType.
*/
class MergeXmlContent implements ProcessorInterface
class MergeXmlContent
{
public function __invoke(Analysis $analysis)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Processors/OperationId.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* Generate the OperationId based on the context of the OpenApi annotation.
*/
class OperationId implements ProcessorInterface
class OperationId
{
protected bool $hash;

Expand Down
2 changes: 1 addition & 1 deletion src/Processors/PathFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* If no `tags` or `paths` filters are set, no filtering is performed.
* All filter (regular) expressions must be enclosed within delimiter characters as they are used as-is.
*/
class PathFilter implements ProcessorInterface
class PathFilter
{
use AnnotationTrait;

Expand Down
Loading

0 comments on commit 5c9ea49

Please sign in to comment.