Skip to content

Commit

Permalink
PHPStan: new options
Browse files Browse the repository at this point in the history
  • Loading branch information
mabar committed Jun 21, 2024
1 parent fbea7b8 commit 8ce3d1b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
14 changes: 12 additions & 2 deletions src/Enum/ParameterIn.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,25 @@ final class ParameterIn
'query' => ['form', 'spaceDelimited', 'pipeDelimited', 'deepObject'],
];

/** @readonly */
/**
* @var value-of<self::ValuesAndNames>
* @readonly
*/
public string $name;

/** @readonly */
/**
* @var key-of<self::ValuesAndNames>
* @readonly
*/
public string $value;

/** @var array<string, self> */
private static array $instances = [];

/**
* @param value-of<self::ValuesAndNames> $name
* @param key-of<self::ValuesAndNames> $value
*/
private function __construct(string $name, string $value)
{
$this->name = $name;
Expand Down
15 changes: 5 additions & 10 deletions tools/phpstan.baseline.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#2 \\$value of class Orisai\\\\OpenAPI\\\\Enum\\\\ParameterIn constructor expects 'cookie'\\|'header'\\|'path'\\|'query', string given\\.$#"
count: 1
path: ../src/Enum/ParameterIn.php

-
message: "#^Parameter \\#1 \\$name of method Orisai\\\\OpenAPI\\\\Spec\\\\Encoding\\:\\:addContentType\\(\\) expects non\\-empty\\-string, string given\\.$#"
count: 1
Expand Down Expand Up @@ -50,16 +55,6 @@ parameters:
count: 1
path: ../tests/Unit/Spec/ResponsesTest.php

-
message: "#^Offset 0 might not exist on list\\<string\\|null\\>\\|null\\.$#"
count: 1
path: ../tests/Unit/Utils/HeadersTest.php

-
message: "#^Offset 1 might not exist on list\\<string\\|null\\>\\|null\\.$#"
count: 1
path: ../tests/Unit/Utils/MediaTypesTest.php

-
message: "#^Parameter \\#1 \\$mediaType of static method Orisai\\\\OpenAPI\\\\Utils\\\\MediaTypes\\:\\:format\\(\\) expects non\\-empty\\-string, string given\\.$#"
count: 1
Expand Down
4 changes: 3 additions & 1 deletion tools/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ includes:
- phpstan.baseline.neon

parameters:
phpVersion: 70400
phpVersion: 80300
level: 8
tmpDir: ../var/tools/PHPStan
resultCachePath: %currentWorkingDirectory%/var/tools/PHPStan/resultCache.php
Expand All @@ -12,6 +12,8 @@ parameters:
checkMissingCallableSignature: true
checkInternalClassCaseSensitivity: true
checkTooWideReturnTypesInProtectedAndPublicMethods: true
reportAnyTypeWideningInVarTag: true
reportPossiblyNonexistentConstantArrayOffset: true

exceptions:
check:
Expand Down

0 comments on commit 8ce3d1b

Please sign in to comment.