2020-11-27 22:24:59 +01:00
|
|
|
<?php
|
|
|
|
namespace Psalm\Internal\Analyzer\Statements\Expression\Call;
|
|
|
|
|
|
|
|
use PhpParser;
|
2021-12-04 03:37:19 +01:00
|
|
|
use Psalm\Storage\FunctionLikeParameter;
|
|
|
|
use Psalm\Storage\FunctionLikeStorage;
|
2020-11-27 22:24:59 +01:00
|
|
|
use Psalm\Type;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
class FunctionCallInfo
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var ?string
|
|
|
|
*/
|
2021-09-26 23:24:07 +02:00
|
|
|
public $function_id;
|
2020-11-27 22:24:59 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var ?bool
|
|
|
|
*/
|
2021-09-26 23:24:07 +02:00
|
|
|
public $function_exists;
|
2020-11-27 22:24:59 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $is_stubbed = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $in_call_map = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array<string, Type\Union>
|
|
|
|
*/
|
|
|
|
public $defined_constants = [];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array<string, bool>
|
|
|
|
*/
|
|
|
|
public $global_variables = [];
|
|
|
|
|
|
|
|
/**
|
2021-12-04 03:37:19 +01:00
|
|
|
* @var ?array<int, FunctionLikeParameter>
|
2020-11-27 22:24:59 +01:00
|
|
|
*/
|
2021-09-26 23:24:07 +02:00
|
|
|
public $function_params;
|
2020-11-27 22:24:59 +01:00
|
|
|
|
|
|
|
/**
|
2021-12-04 03:37:19 +01:00
|
|
|
* @var ?FunctionLikeStorage
|
2020-11-27 22:24:59 +01:00
|
|
|
*/
|
2021-09-26 23:24:07 +02:00
|
|
|
public $function_storage;
|
2020-11-27 22:24:59 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var ?PhpParser\Node\Name
|
|
|
|
*/
|
2021-09-26 23:24:07 +02:00
|
|
|
public $new_function_name;
|
2020-11-27 22:24:59 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $allow_named_args = true;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
public $byref_uses = [];
|
2021-03-25 14:05:59 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @mutation-free
|
|
|
|
*/
|
|
|
|
public function hasByReferenceParameters(): bool
|
|
|
|
{
|
|
|
|
if (null === $this->function_params) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($this->function_params as $value) {
|
|
|
|
if ($value->by_ref) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2020-11-27 22:24:59 +01:00
|
|
|
}
|