Skip to content

Commit

Permalink
argv and argc were inconsistent in Context with VariableFetchAnalyzer
Browse files Browse the repository at this point in the history
Not sure why argv/argc are declared in context independently in the first place though
  • Loading branch information
kkmuffme committed Aug 8, 2023
1 parent 3098e51 commit 54a9b73
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Psalm/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
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 +870,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 54a9b73

Please sign in to comment.