Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1430805
ArrayShapeNode.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ArrayShapeNode.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
PHPStan\PhpDocParser\Ast\Type
;
use
PHPStan\PhpDocParser\Ast\NodeAttributes
;
use
function
implode
;
class
ArrayShapeNode
implements
TypeNode
{
public
const
KIND_ARRAY
=
'array'
;
public
const
KIND_LIST
=
'list'
;
public
const
KIND_NON_EMPTY_ARRAY
=
'non-empty-array'
;
public
const
KIND_NON_EMPTY_LIST
=
'non-empty-list'
;
use
NodeAttributes
;
/** @var ArrayShapeItemNode[] */
public
array
$items
;
public
bool
$sealed
;
/** @var self::KIND_* */
public
$kind
;
public
?
ArrayShapeUnsealedTypeNode
$unsealedType
=
null
;
/**
* @param ArrayShapeItemNode[] $items
* @param self::KIND_* $kind
*/
private
function
__construct
(
array
$items
,
bool
$sealed
=
true
,
?
ArrayShapeUnsealedTypeNode
$unsealedType
=
null
,
string
$kind
=
self
::
KIND_ARRAY
)
{
$this
->
items
=
$items
;
$this
->
sealed
=
$sealed
;
$this
->
unsealedType
=
$unsealedType
;
$this
->
kind
=
$kind
;
}
/**
* @param ArrayShapeItemNode[] $items
* @param self::KIND_* $kind
*/
public
static
function
createSealed
(
array
$items
,
string
$kind
=
self
::
KIND_ARRAY
):
self
{
return
new
self
(
$items
,
true
,
null
,
$kind
);
}
/**
* @param ArrayShapeItemNode[] $items
* @param self::KIND_* $kind
*/
public
static
function
createUnsealed
(
array
$items
,
?
ArrayShapeUnsealedTypeNode
$unsealedType
,
string
$kind
=
self
::
KIND_ARRAY
):
self
{
return
new
self
(
$items
,
false
,
$unsealedType
,
$kind
);
}
public
function
__toString
():
string
{
$items
=
$this
->
items
;
if
(!
$this
->
sealed
)
{
$items
[]
=
'...'
.
$this
->
unsealedType
;
}
return
$this
->
kind
.
'{'
.
implode
(
', '
,
$items
)
.
'}'
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 19:36 (4 h, 10 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
db/a3/45fd6ff223e70856057cb04833f1
Default Alt Text
ArrayShapeNode.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment