mirror of
https://github.com/danog/psalm-plugin-symfony.git
synced 2024-11-26 20:04:58 +01:00
add UnitEnum stub (PHP 8.1) (#249)
This commit is contained in:
parent
44f9a695cd
commit
f11c57890d
@ -90,6 +90,7 @@ class Plugin implements PluginEntryPointInterface
|
||||
|
||||
$this->addStubs($api, __DIR__.'/Stubs/common');
|
||||
$this->addStubs($api, __DIR__.'/Stubs/'.Kernel::MAJOR_VERSION);
|
||||
$this->addStubs($api, __DIR__.'/Stubs/php');
|
||||
|
||||
if (isset($config->twigCachePath)) {
|
||||
$twig_cache_path = getcwd().DIRECTORY_SEPARATOR.ltrim((string) $config->twigCachePath, DIRECTORY_SEPARATOR);
|
||||
|
7
src/Stubs/php/UnitEnum.stubphp
Normal file
7
src/Stubs/php/UnitEnum.stubphp
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
interface UnitEnum {
|
||||
public static function cases(): array;
|
||||
}
|
@ -83,7 +83,7 @@ Feature: Naming conventions
|
||||
}
|
||||
"""
|
||||
When I run Psalm
|
||||
And I see no other errors
|
||||
And I see no errors
|
||||
|
||||
Scenario: Detects parameter naming convention violation
|
||||
Given I have the following code
|
||||
|
@ -69,6 +69,6 @@ Feature: ParameterBag
|
||||
"""
|
||||
When I run Psalm
|
||||
Then I see these errors
|
||||
| Type | Message |
|
||||
| Trace | $nonExistentParameter: array<array-key, mixed>\|null\|scalar |
|
||||
| Type | Message |
|
||||
| Trace | $nonExistentParameter: UnitEnum\|array<array-key, mixed>\|null\|scalar |
|
||||
And I see no other errors
|
||||
|
Loading…
Reference in New Issue
Block a user