Skip to content

Commit c2f8107

Browse files
DanielEScherzerkocsismate
authored andcommitted
gen_stub: clean up some variable declarations
Inline single-use variables, remove unneeded forward declarations
1 parent 4af64fd commit c2f8107

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

build/gen_stub.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4599,14 +4599,12 @@ function parseClass(
45994599
?int $minimumPhpVersionIdCompatibility,
46004600
bool $isUndocumentable
46014601
): ClassInfo {
4602-
$flags = $class instanceof Class_ ? $class->flags : 0;
46034602
$comments = $class->getComments();
46044603
$alias = null;
46054604
$isDeprecated = false;
46064605
$isStrictProperties = false;
46074606
$isNotSerializable = false;
46084607
$allowsDynamicProperties = false;
4609-
$attributes = [];
46104608

46114609
if ($comments) {
46124610
$tags = parseDocComments($comments);
@@ -4667,7 +4665,7 @@ function parseClass(
46674665

46684666
return new ClassInfo(
46694667
$name,
4670-
$flags,
4668+
$class instanceof Class_ ? $class->flags : 0,
46714669
$classKind,
46724670
$alias,
46734671
$class instanceof Enum_ && $class->scalarType !== null
@@ -4911,8 +4909,7 @@ function handleStatements(FileInfo $fileInfo, array $stmts, PrettyPrinterAbstrac
49114909
}
49124910

49134911
function parseStubFile(string $code): FileInfo {
4914-
$lexer = new PhpParser\Lexer\Emulative();
4915-
$parser = new PhpParser\Parser\Php7($lexer);
4912+
$parser = new PhpParser\Parser\Php7(new PhpParser\Lexer\Emulative());
49164913
$nodeTraverser = new PhpParser\NodeTraverser;
49174914
$nodeTraverser->addVisitor(new PhpParser\NodeVisitor\NameResolver);
49184915
$prettyPrinter = new class extends Standard {
@@ -5178,8 +5175,7 @@ static function (FuncInfo $funcInfo) use (&$generatedFuncInfos, $fileInfo) {
51785175
$framelessFunctionCode = generateCodeWithConditions(
51795176
$fileInfo->getAllFuncInfos(), "\n",
51805177
static function (FuncInfo $funcInfo) {
5181-
$code = $funcInfo->getFramelessDeclaration($funcInfo);
5182-
return $code;
5178+
return $funcInfo->getFramelessDeclaration($funcInfo);
51835179
}
51845180
);
51855181

0 commit comments

Comments
 (0)