Page MenuHomePhorge

No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None
diff --git a/.phan/config.php b/.phan/config.php
index ffd2a9a1536..bb2dcd5c714 100644
--- a/.phan/config.php
+++ b/.phan/config.php
@@ -20,7 +20,8 @@
$cfg = require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config.php';
-// This value should match the PHP version specified in composer.json and PHPVersionCheck.php.
+// This value should match the PHP version specified in composer.json,
+// PHPVersionCheck.php, and ScopeStructureTest.php
$cfg['minimum_target_php_version'] = '8.1.0';
$cfg['file_list'] = array_merge(
diff --git a/includes/PHPVersionCheck.php b/includes/PHPVersionCheck.php
index 2ced9af2dc1..f4298feb6bc 100644
--- a/includes/PHPVersionCheck.php
+++ b/includes/PHPVersionCheck.php
@@ -79,6 +79,8 @@ class PHPVersionCheck {
* Displays an error, if the installed PHP version does not meet the minimum requirement.
*/
function checkRequiredPHPVersion() {
+ // This value should match the PHP version specified in composer.json,
+ // .phan/config.php, and ScopeStructureTest.php
$minimumVersion = '8.1.0';
/**
diff --git a/includes/utils/ClassCollector.php b/includes/utils/ClassCollector.php
index 02dce1c29cb..d59380732d4 100644
--- a/includes/utils/ClassCollector.php
+++ b/includes/utils/ClassCollector.php
@@ -68,7 +68,7 @@ class ClassCollector {
$matches = null;
preg_match_all(
// phpcs:ignore Generic.Files.LineLength.TooLong
- '#^\t*(?:namespace |(final )?(abstract )?(class|interface|trait) |class_alias\()[^;{]+[;{]\s*\}?#m',
+ '#^\t*(?:namespace |(final )?(abstract )?(class|interface|trait|enum) |class_alias\()[^;{]+[;{]\s*\}?#m',
$code,
$matches
);
@@ -109,6 +109,7 @@ class ClassCollector {
switch ( $token[0] ) {
case T_NAMESPACE:
case T_CLASS:
+ case T_ENUM:
case T_INTERFACE:
case T_TRAIT:
case T_DOUBLE_COLON:
@@ -204,6 +205,7 @@ class ClassCollector {
break;
case T_CLASS:
+ case T_ENUM:
case T_INTERFACE:
case T_TRAIT:
$this->tokens[] = $token;
diff --git a/tests/phpunit/structure/AutoLoaderStructureTest.php b/tests/phpunit/structure/AutoLoaderStructureTest.php
index e45229768e8..a0b854828fa 100644
--- a/tests/phpunit/structure/AutoLoaderStructureTest.php
+++ b/tests/phpunit/structure/AutoLoaderStructureTest.php
@@ -25,7 +25,7 @@ class AutoLoaderStructureTest extends MediaWikiIntegrationTestCase {
$matches = [];
preg_match_all( '/
^ [\t ]* (?:
- (?:final\s+)? (?:abstract\s+)? (?:class|interface|trait) \s+
+ (?:final\s+)? (?:abstract\s+)? (?:class|interface|trait|enum) \s+
(?P<class> \w+)
|
class_alias \s* \( \s*
diff --git a/tests/phpunit/structure/ScopeStructureTest.php b/tests/phpunit/structure/ScopeStructureTest.php
index 41a4e434faf..90a8a2a0058 100644
--- a/tests/phpunit/structure/ScopeStructureTest.php
+++ b/tests/phpunit/structure/ScopeStructureTest.php
@@ -30,8 +30,10 @@ class ScopeStructureTest extends MediaWikiIntegrationTestCase {
* @dataProvider provideAutoloadNoFileScope
*/
public function testAutoloadNoFileScope( $file ) {
- $parser = ( new ParserFactory )
- ->createForVersion( PhpVersion::fromComponents( 7, 0 ) );
+ // This value should match the PHP version specified in composer.json,
+ // PHPVersionCheck.php, and .phan/config.php
+ $version = PhpVersion::fromComponents( 8, 1 );
+ $parser = ( new ParserFactory )->createForVersion( $version );
$ast = $parser->parse( file_get_contents( $file ) );
foreach ( $ast as $node ) {
if ( $node instanceof Stmt\ClassLike

File Metadata

Mime Type
text/x-diff
Expires
Sat, Jul 5, 5:33 AM (1 d, 7 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
227819
Default Alt Text
(3 KB)

Event Timeline