Skip to content

Commit 14a3b36

Browse files
committed
Fix generate-function-metadata.php script
1 parent 37f4e56 commit 14a3b36

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

Diff for: .github/workflows/update-phpstorm-stubs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: "Checkout"
1717
uses: actions/checkout@v4
1818
with:
19-
ref: 1.12.x
19+
ref: 2.0.x
2020
fetch-depth: '0'
2121
token: ${{ secrets.PHPSTAN_BOT_TOKEN }}
2222
- name: "Install PHP"

Diff for: bin/generate-function-metadata.php

+13-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
(function (): void {
1717
require_once __DIR__ . '/../vendor/autoload.php';
1818

19-
$parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7);
19+
$parser = (new ParserFactory())->createForNewestSupportedVersion();
2020
$finder = new Finder();
2121
$finder->in(__DIR__ . '/../vendor/jetbrains/phpstorm-stubs')->files()->name('*.php');
2222

@@ -69,8 +69,19 @@ public function enterNode(Node $node)
6969
$traverser->addVisitor(new NodeConnectingVisitor());
7070
$traverser->addVisitor($visitor);
7171

72+
$contents = FileReader::read($path);
73+
if (str_ends_with($path, '/vendor/jetbrains/phpstorm-stubs/Core/Core.php')) {
74+
$contents = str_replace([
75+
'function exit',
76+
'function die',
77+
], [
78+
'function _exit',
79+
'function _die',
80+
], $contents);
81+
}
82+
7283
$traverser->traverse(
73-
$parser->parse(FileReader::read($path)),
84+
$parser->parse($contents),
7485
);
7586
}
7687

0 commit comments

Comments
 (0)