1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Merge pull request #10093 from kkmuffme/inconsistent-argv-argc-in-context

argv and argc were inconsistent in Context with VariableFetchAnalyzer
This commit is contained in:
orklah 2023-08-13 19:32:19 +02:00 committed by GitHub
commit a6e2e31aae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,7 +12,8 @@ use Psalm\Internal\Scope\LoopScope;
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;
@ -868,10 +869,19 @@ final class Context
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();