|
6 | 6 |
|
7 | 7 | final class ClassFixtures |
8 | 8 | { |
| 9 | + private const EXTENSIONS = [ |
| 10 | + 'bcmath' => true, |
| 11 | + 'bz2' => true, |
| 12 | + 'calendar' => true, |
| 13 | + 'Core' => true, |
| 14 | + 'ctype' => true, |
| 15 | + 'curl' => true, |
| 16 | + 'date' => true, |
| 17 | + 'dba' => true, |
| 18 | + 'dom' => true, |
| 19 | + 'exif' => true, |
| 20 | + 'FFI' => true, |
| 21 | + 'fileinfo' => true, |
| 22 | + 'filter' => true, |
| 23 | + 'ftp' => true, |
| 24 | + 'gd' => true, |
| 25 | + 'gettext' => true, |
| 26 | + 'gmp' => true, |
| 27 | + 'hash' => true, |
| 28 | + 'iconv' => true, |
| 29 | + 'intl' => true, |
| 30 | + 'json' => true, |
| 31 | + 'ldap' => true, |
| 32 | + 'libxml' => true, |
| 33 | + 'mbstring' => true, |
| 34 | + 'mysqli' => true, |
| 35 | + 'mysqlnd' => true, |
| 36 | + 'odbc' => true, |
| 37 | + 'openssl' => true, |
| 38 | + 'pcntl' => true, |
| 39 | + 'pcov' => true, |
| 40 | + 'pcre' => true, |
| 41 | + 'PDO' => true, |
| 42 | + 'pdo_dblib' => true, |
| 43 | + 'pdo_mysql' => true, |
| 44 | + 'PDO_ODBC' => true, |
| 45 | + 'pdo_pgsql' => true, |
| 46 | + 'pdo_sqlite' => true, |
| 47 | + 'pgsql' => true, |
| 48 | + 'Phar' => true, |
| 49 | + 'posix' => true, |
| 50 | + 'pspell' => true, |
| 51 | + 'random' => true, |
| 52 | + 'readline' => true, |
| 53 | + 'Reflection' => true, |
| 54 | + 'session' => true, |
| 55 | + 'shmop' => true, |
| 56 | + 'SimpleXML' => true, |
| 57 | + 'soap' => true, |
| 58 | + 'sockets' => true, |
| 59 | + 'sodium' => true, |
| 60 | + 'SPL' => true, |
| 61 | + 'sqlite3' => true, |
| 62 | + 'standard' => true, |
| 63 | + 'sysvmsg' => true, |
| 64 | + 'sysvsem' => true, |
| 65 | + 'sysvshm' => true, |
| 66 | + 'tidy' => true, |
| 67 | + 'tokenizer' => true, |
| 68 | + 'xml' => true, |
| 69 | + 'xmlreader' => true, |
| 70 | + 'xmlwriter' => true, |
| 71 | + 'xsl' => true, |
| 72 | + 'Zend OPcache' => true, |
| 73 | + 'zip' => true, |
| 74 | + 'zlib' => true, |
| 75 | + ]; |
| 76 | + private const INTERNAL_CLASSES_TO_SKIP = [ |
| 77 | + // has a private constructor that is available only via ReflectionClass::getConstructor() |
| 78 | + 'IntlCodePointBreakIterator' => true, |
| 79 | + // ReflectionClass::getModifiers() returns 0 instead of 32 (enums have IS_FINAL) |
| 80 | + 'Random\IntervalBoundary' => true, |
| 81 | + // is iterable, but does not implement Traversable |
| 82 | + 'FFI\CData' => true, |
| 83 | + // has a lot of problems with __invoke() |
| 84 | + 'Closure' => true, |
| 85 | + // getMethod(ispersistent).getNumberOfRequiredParameters(): failed asserting that 0 is identical to 2 |
| 86 | + 'ZMQContext' => true, |
| 87 | + // getMethod(remove).getNumberOfRequiredParameters(): failed asserting that 1 is identical to 2 |
| 88 | + 'ZMQPoll' => true, |
| 89 | + // Fatal error: OAuthProvider::__construct(): For the CLI sapi parameters must be set first via OAuthProvider::__construct(array("oauth_param" => "value", ...)) |
| 90 | + 'OAuthProvider' => true, |
| 91 | + // problems with readonly properties |
| 92 | + 'AMQPTimestamp' => true, |
| 93 | + // problems with readonly properties |
| 94 | + 'AMQPDecimal' => true, |
| 95 | + ]; |
| 96 | + |
9 | 97 | private function __construct() {} |
10 | 98 |
|
11 | 99 | /** |
@@ -41,35 +129,17 @@ public static function get(): array |
41 | 129 |
|
42 | 130 | return self::$classes; |
43 | 131 | } |
44 | | - private const INTERNAL_CLASSES_TO_SKIP = [ |
45 | | - // has a private constructor that is available only via ReflectionClass::getConstructor() |
46 | | - 'IntlCodePointBreakIterator' => true, |
47 | | - // ReflectionClass::getModifiers() returns 0 instead of 32 (enums have IS_FINAL) |
48 | | - 'Random\IntervalBoundary' => true, |
49 | | - // is iterable, but does not implement Traversable |
50 | | - 'FFI\CData' => true, |
51 | | - // has a lot of problems with __invoke() |
52 | | - 'Closure' => true, |
53 | | - // getMethod(ispersistent).getNumberOfRequiredParameters(): failed asserting that 0 is identical to 2 |
54 | | - 'ZMQContext' => true, |
55 | | - // getMethod(remove).getNumberOfRequiredParameters(): failed asserting that 1 is identical to 2 |
56 | | - 'ZMQPoll' => true, |
57 | | - // Fatal error: OAuthProvider::__construct(): For the CLI sapi parameters must be set first via OAuthProvider::__construct(array("oauth_param" => "value", ...)) |
58 | | - 'OAuthProvider' => true, |
59 | | - // problems with readonly properties |
60 | | - 'AMQPTimestamp' => true, |
61 | | - // problems with readonly properties |
62 | | - 'AMQPDecimal' => true, |
63 | | - ]; |
64 | 132 |
|
65 | 133 | /** |
66 | 134 | * @return \Generator<class-string, array{class-string}> |
67 | 135 | */ |
68 | 136 | public static function internal(): \Generator |
69 | 137 | { |
70 | 138 | foreach (self::allDeclaredClasses() as $class) { |
| 139 | + $extension = (new \ReflectionClass($class))->getExtensionName(); |
| 140 | + |
71 | 141 | /** @psalm-suppress InvalidArrayOffset */ |
72 | | - if (!isset(self::INTERNAL_CLASSES_TO_SKIP[$class]) && (new \ReflectionClass($class))->isInternal()) { |
| 142 | + if ($extension !== false && !isset(self::INTERNAL_CLASSES_TO_SKIP[$class]) && isset(self::EXTENSIONS[$extension])) { |
73 | 143 | yield $class => [$class]; |
74 | 144 | } |
75 | 145 | } |
|
0 commit comments