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

Make sure $argv and $argc are not globally available

This commit is contained in:
Matthew Brown 2017-02-12 22:12:31 -05:00
parent 1001e03f8a
commit 500044dac1
2 changed files with 11 additions and 6 deletions

View File

@ -196,6 +196,13 @@ class FileChecker extends SourceChecker implements StatementsSource
$this->context = new Context();
$this->context->count_references = $project_checker->count_references;
$this->context->vars_in_scope['$argc'] = Type::getInt();
$this->context->vars_in_scope['$argv'] = new Type\Union([
new Type\Atomic\TArray([
Type::getInt(),
Type::getString(),
])
]);
}
/**

View File

@ -490,17 +490,15 @@ class ExpressionChecker
if (in_array(
$stmt->name,
[
'GLOBALS',
'_SERVER',
'_GET',
'_POST',
'_COOKIE',
'_REQUEST',
'_FILES',
'_ENV',
'_COOKIE',
'_SESSION',
'GLOBALS',
'argv',
'argc',
'_REQUEST',
'_ENV',
]
)
) {