Skip to content

Commit

Permalink
phan-plugins: Work around microsoft/tolerant-php-parser not being 8.4…
Browse files Browse the repository at this point in the history
…-safe yet
  • Loading branch information
anomiex committed Nov 19, 2024
1 parent 2ee17ff commit 7777ebc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
5 changes: 5 additions & 0 deletions projects/packages/phan-plugins/changelog/add-ci-php-8.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Work around microsoft/tolerant-php-parser not being 8.4-safe yet in test


20 changes: 15 additions & 5 deletions projects/packages/phan-plugins/tests/php/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,22 @@ private function runPhan( $dir, $usePolyfill = false, $analyzeTwice = false ) {
$printer = new CapturingJSONPrinter();
Phan::setPrinter( $printer );

Phan::analyzeFileList(
$this->codeBase,
static function () use ( $cli ) {
return $cli->getFileList();
$old = error_reporting();
try {
if ( $usePolyfill ) {
// microsoft/tolerant-php-parser raises PHP 8.4 deprecation warnings.
// @todo If it gets updated at some point, hopefully this can be removed.
error_reporting( $old & ~E_DEPRECATED );
}
);
Phan::analyzeFileList(
$this->codeBase,
static function () use ( $cli ) {
return $cli->getFileList();
}
);
} finally {
error_reporting( $old );
}

$expectFile = $this->chooseFile( "$dir/expect.json", $usePolyfill, $analyzeTwice );
$expect = json_decode( file_get_contents( $expectFile ), true );
Expand Down

0 comments on commit 7777ebc

Please sign in to comment.