Address PHP 8.2. warnings and static analysis (#1263)
* Address PHP 8.2. warnings * Supress UndefinedAttributeClass error for AllowDynamicProperties
This commit is contained in:
parent
a98944325d
commit
9beaa98db4
|
@ -40,6 +40,11 @@ parameters:
|
|||
count: 1
|
||||
path: src/Annotations/Schema.php
|
||||
|
||||
-
|
||||
message: "#^Attribute class AllowDynamicProperties does not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Context.php
|
||||
|
||||
-
|
||||
message: "#^Ternary operator condition is always true\\.$#"
|
||||
count: 1
|
||||
|
|
|
@ -18,5 +18,11 @@
|
|||
</projectFiles>
|
||||
|
||||
<issueHandlers>
|
||||
<UndefinedAttributeClass>
|
||||
<errorLevel type="suppress">
|
||||
<referencedClass name="AllowDynamicProperties" />
|
||||
<file name="src/Context.php" />
|
||||
</errorLevel>
|
||||
</UndefinedAttributeClass>
|
||||
</issueHandlers>
|
||||
</psalm>
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace OpenApi;
|
|||
|
||||
use OpenApi\Annotations\OpenApi;
|
||||
use OpenApi\Loggers\DefaultLogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Context.
|
||||
|
@ -44,10 +45,11 @@ use OpenApi\Loggers\DefaultLogger;
|
|||
* the serializer
|
||||
* @property Annotations\AbstractAnnotation|null $nested
|
||||
* @property Annotations\AbstractAnnotation[]|null $annotations
|
||||
* @property \Psr\Log\LoggerInterface|null $logger Guaranteed to be set when using the `Generator`
|
||||
* @property LoggerInterface|null $logger Guaranteed to be set when using the `Generator`
|
||||
* @property array|null $scanned Details of file scanner when using ReflectionAnalyser
|
||||
* @property string|null $version The OpenAPI version in use
|
||||
*/
|
||||
#[\AllowDynamicProperties]
|
||||
class Context
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,9 @@ class AbstractAnnotationTest extends OpenApiTestCase
|
|||
$this->assertSame(123, $output->$prefixedProperty);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHP < 8.2
|
||||
*/
|
||||
public function testInvalidField(): void
|
||||
{
|
||||
$this->assertOpenApiLogEntryContains('Unexpected field "doesnot" for @OA\Get(), expecting');
|
||||
|
|
Loading…
Reference in New Issue