Skip to content

Commit

Permalink
Fix nonexistent BackedEnum in stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Oct 14, 2024
1 parent 992a62e commit e26fd3c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
6 changes: 6 additions & 0 deletions compatibility/BackedEnum.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

interface BackedEnum
{

}
6 changes: 6 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,9 @@ parameters:
- '#^Call to function method_exists\(\) with Doctrine\\DBAL\\Connection and ''createSchemaManager'' will always evaluate to true\.$#'
- '#^Call to an undefined method Doctrine\\DBAL\\Connection\:\:getSchemaManager\(\)\.$#'
path: tests/Platform/QueryResultTypeWalkerFetchTypeMatrixTest.php

services:
-
class: PHPStan\BackedEnumStubExtension
tags:
- phpstan.stubFilesExtension
22 changes: 22 additions & 0 deletions tests/BackedEnumStubExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php declare(strict_types = 1);

namespace PHPStan;

use PHPStan\PhpDoc\StubFilesExtension;
use const PHP_VERSION_ID;

class BackedEnumStubExtension implements StubFilesExtension
{

public function getFiles(): array
{
if (PHP_VERSION_ID >= 80100) {
return [];
}

return [
__DIR__ . '/../compatibility/BackedEnum.stub',
];
}

}

0 comments on commit e26fd3c

Please sign in to comment.