classArrayItems
final class ArrayItems
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.The bracketed items of an array constructor: [a, b], or the sub-arrays of a multidimensional array [[a], [b]].
Mirrors one level of PostgreSQL's A_ArrayExpr: an inner level is written without the ARRAY keyword. A level holds either values or sub-arrays, or nothing. Source: https://www.postgresql.org/docs/17/sql-expressions.html#SQL-SYNTAX-ARRAY-CONSTRUCTORS.
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT ARRAY[[1, 2], [3, 4]]');
[count($query->field(0)->expression->items->nested), $query->field(0)->type->descriptor->name()] // => [2, 'integer[]']Properties§
public list<Scalar> $valuespublic list<ArrayItems> $nestedMethods§
public function __construct(list<Scalar> $values = [], list<ArrayItems> $nested = [])Parameters
$values | list<Scalar> | The values in order |
$nested | list<ArrayItems> | The sub-arrays in order |
Calls 4
- static-call Check::listOf() line 46
- class-const Scalar::class() line 46
- class-const ArrayItems::class() line 47
- static-call Check::input() line 48
public function render(Output $out): voidWrites the values or the sub-arrays in brackets.
Parameters
$out | Output |
Test cases 1
Calls 1
- method-call Output::symbol() line 56
Test cases 8§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Other tests reaching this symbol 6
ArrayTypingTest::testItemsGivesTextForStringscallsArrayConstructorTest::testDeriveScalarIsAnArrayOfTheCommonTypecallsArrayConstructorTest::testDeriveScalarReportsValuesWithoutACommonTypecallsArrayConstructorTest::testOutputNameIsArraycallsArrayConstructorTest::testRenderWritesArraycallsQuantifiedArrayTest::testDeriveScalarComparesWithTheElementTypecalls
Relations§
Instantiated in 3
- new SqlSemantics\Platform\PostgreSql\Lowering\Expression\ConstructorRule::items() packages/sql-semantics-postgres/src/Lowering/Expression/ConstructorRule.php:71
- new SqlSemantics\Platform\PostgreSql\Lowering\Expression\ConstructorRule::items() packages/sql-semantics-postgres/src/Lowering/Expression/ConstructorRule.php:74
- new SqlSemantics\Platform\PostgreSql\Lowering\Expression\ConstructorRule::items() packages/sql-semantics-postgres/src/Lowering/Expression/ConstructorRule.php:84
Type declarations 4
- type SqlSemantics\Platform\PostgreSql\Lowering\Expression\ConstructorRule packages/sql-semantics-postgres/src/Lowering/Expression/ConstructorRule.php:67
- type SqlSemantics\Platform\PostgreSql\Lowering\Expression\Expressions packages/sql-semantics-postgres/src/Lowering/Expression/Expressions.php:164
- type SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\ArrayTyping packages/sql-semantics-postgres/src/Rules/Expression/Typing/ArrayTyping.php:37
- type SqlSemantics\Platform\PostgreSql\Statement\Expression\Constructor\ArrayConstructor packages/sql-semantics-postgres/src/Statement/Expression/Constructor/ArrayConstructor.php:41