Skip to content

Commit

Permalink
Merge pull request #10093 from kkmuffme/inconsistent-argv-argc-in-con…
Browse files Browse the repository at this point in the history
…text

argv and argc were inconsistent in Context with VariableFetchAnalyzer
  • Loading branch information
orklah authored Aug 13, 2023
2 parents a645331 + 801cca2 commit a6e2e31
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/Psalm/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
use Psalm\Internal\Type\AssertionReconciler;
use Psalm\Storage\FunctionLikeStorage;
use Psalm\Type\Atomic\DependentType;
use Psalm\Type\Atomic\TArray;
use Psalm\Type\Atomic\TIntRange;
use Psalm\Type\Atomic\TNull;
use Psalm\Type\Union;
use RuntimeException;

Expand Down Expand Up @@ -868,10 +869,19 @@ public function getScopeSummary(): string
public function defineGlobals(): void
{
$globals = [
// not sure why this is declared here again, see VariableFetchAnalyzer
'$argv' => new Union([
new TArray([Type::getInt(), Type::getString()]),
Type::getNonEmptyListAtomic(Type::getString()),
new TNull(),
], [
'ignore_nullable_issues' => true,
]),
'$argc' => new Union([
new TIntRange(1, null),
new TNull(),
], [
'ignore_nullable_issues' => true,
]),
'$argc' => Type::getInt(),
];

$config = Config::getInstance();
Expand Down

0 comments on commit a6e2e31

Please sign in to comment.