add UnitEnum stub (PHP 8.1) (#249)

This commit is contained in:
Farhad Safarov 2022-04-10 23:35:50 +03:00 committed by GitHub
parent 44f9a695cd
commit f11c57890d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 3 deletions

View File

@ -90,6 +90,7 @@ class Plugin implements PluginEntryPointInterface
$this->addStubs($api, __DIR__.'/Stubs/common'); $this->addStubs($api, __DIR__.'/Stubs/common');
$this->addStubs($api, __DIR__.'/Stubs/'.Kernel::MAJOR_VERSION); $this->addStubs($api, __DIR__.'/Stubs/'.Kernel::MAJOR_VERSION);
$this->addStubs($api, __DIR__.'/Stubs/php');
if (isset($config->twigCachePath)) { if (isset($config->twigCachePath)) {
$twig_cache_path = getcwd().DIRECTORY_SEPARATOR.ltrim((string) $config->twigCachePath, DIRECTORY_SEPARATOR); $twig_cache_path = getcwd().DIRECTORY_SEPARATOR.ltrim((string) $config->twigCachePath, DIRECTORY_SEPARATOR);

View File

@ -0,0 +1,7 @@
<?php
declare(strict_types=1);
interface UnitEnum {
public static function cases(): array;
}

View File

@ -83,7 +83,7 @@ Feature: Naming conventions
} }
""" """
When I run Psalm When I run Psalm
And I see no other errors And I see no errors
Scenario: Detects parameter naming convention violation Scenario: Detects parameter naming convention violation
Given I have the following code Given I have the following code

View File

@ -69,6 +69,6 @@ Feature: ParameterBag
""" """
When I run Psalm When I run Psalm
Then I see these errors Then I see these errors
| Type | Message | | Type | Message |
| Trace | $nonExistentParameter: array<array-key, mixed>\|null\|scalar | | Trace | $nonExistentParameter: UnitEnum\|array<array-key, mixed>\|null\|scalar |
And I see no other errors And I see no other errors