Skip to content

Commit c53fe7c

Browse files
committed
Simplify warning display logic
1 parent a9f4970 commit c53fe7c

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

build/gen_stub.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,9 @@ public function getDeclaration(): string
321321
return "ZEND_FUNCTION($this->name);\n";
322322
}
323323

324-
public function getName(): string
325-
{
326-
return $this->className ? "$this->className::$this->name" : $this->name;
327-
}
328-
329324
public function __toString()
330325
{
331-
return $this->getName();
326+
return $this->className ? "$this->className::$this->name" : $this->name;
332327
}
333328
}
334329

@@ -642,7 +637,7 @@ function parseFunctionLike(
642637
$args = [];
643638
$numRequiredArgs = 0;
644639
$foundVariadic = false;
645-
static $warnings = [];
640+
$hasParameterWarning = false;
646641
foreach ($func->getParams() as $i => $param) {
647642
$varName = $param->var->name;
648643
$preferRef = !empty($paramMeta[$varName]['preferRef']);
@@ -661,8 +656,8 @@ function parseFunctionLike(
661656
}
662657

663658
$type = $param->type ? Type::fromNode($param->type) : null;
664-
if ($type === null && !isset($docParamTypes[$varName]) && !isset($warnings[$name->getName()])) {
665-
$warnings[$name->getName()] = true;
659+
if ($type === null && !isset($docParamTypes[$varName]) && !$hasParameterWarning) {
660+
$hasParameterWarning = true;
666661
//throw new Exception("Missing argument type for function $name()");
667662
echo "Warning: Missing argument type for function $name()\n";
668663
}

0 commit comments

Comments
 (0)