1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-09 22:49:31 +01:00
psalm/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayCreationInfo.php
AndrolGenhald d54eebfe02 Fix various array spread issues.
- Correctly infer `array` and `list` instead of `non-empty-array` and `non-empty-list` (fixes #7296)
 - Add support for spreading string keys (fixes #7297).
 - Show issue when trying to unpack non-iterable
 - Show issue when trying to unpack iterable with non-array-key key
 - Re-added invalid PHP 8.0 tests removed in #6613
 - Unpacked lists with known keys will be inferred as eg `array{0: int, 1: int}<int<0, max>, int>` now but will still be treated as lists
 - Unpacked arrays with known keys will now be inferred as eg `array{a: string, b: string}<int, int>` instead of `array<int|string, int|string>`
2022-07-26 12:00:03 -05:00

61 lines
950 B
PHP

<?php
namespace Psalm\Internal\Analyzer\Statements\Expression;
use Psalm\Internal\DataFlow\DataFlowNode;
use Psalm\Type\Atomic;
use Psalm\Type\Union;
/**
* @internal
*/
class ArrayCreationInfo
{
/**
* @var list<Atomic>
*/
public $item_key_atomic_types = [];
/**
* @var list<Atomic>
*/
public $item_value_atomic_types = [];
/**
* @var array<int|string, Union>
*/
public $property_types = [];
/**
* @var array<string, true>
*/
public $class_strings = [];
/**
* @var bool
*/
public $can_create_objectlike = true;
/**
* @var array<int|string, true>
*/
public $array_keys = [];
/**
* @var int
*/
public $int_offset = 0;
/**
* @var bool
*/
public $all_list = true;
/**
* @var array<string, DataFlowNode>
*/
public $parent_taint_nodes = [];
public bool $can_be_empty = true;
}