Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7478428
VarFactory.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
VarFactory.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
phpDocumentor\Reflection\DocBlock\Tags\Factory
;
use
phpDocumentor\Reflection\DocBlock\DescriptionFactory
;
use
phpDocumentor\Reflection\DocBlock\Tag
;
use
phpDocumentor\Reflection\DocBlock\Tags\Var_
;
use
phpDocumentor\Reflection\TypeResolver
;
use
phpDocumentor\Reflection\Types\Context
;
use
PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode
;
use
PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode
;
use
Webmozart\Assert\Assert
;
use
function
is_string
;
use
function
trim
;
/**
* @internal This class is not part of the BC promise of this library.
*/
final
class
VarFactory
implements
PHPStanFactory
{
private
DescriptionFactory
$descriptionFactory
;
private
TypeResolver
$typeResolver
;
public
function
__construct
(
TypeResolver
$typeResolver
,
DescriptionFactory
$descriptionFactory
)
{
$this
->
descriptionFactory
=
$descriptionFactory
;
$this
->
typeResolver
=
$typeResolver
;
}
public
function
create
(
PhpDocTagNode
$node
,
Context
$context
):
Tag
{
$tagValue
=
$node
->
value
;
Assert
::
isInstanceOf
(
$tagValue
,
VarTagValueNode
::
class
);
$description
=
$tagValue
->
getAttribute
(
'description'
);
if
(
is_string
(
$description
)
===
false
)
{
$description
=
$tagValue
->
description
;
}
return
new
Var_
(
trim
(
$tagValue
->
variableName
,
'$'
),
$this
->
typeResolver
->
createType
(
$tagValue
->
type
,
$context
),
$this
->
descriptionFactory
->
create
(
$description
,
$context
)
);
}
public
function
supports
(
PhpDocTagNode
$node
,
Context
$context
):
bool
{
return
$node
->
value
instanceof
VarTagValueNode
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Nov 23, 11:15 (4 d, 17 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
93/f1/22c8c2cc15b257ebec74ed63f4fe
Default Alt Text
VarFactory.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment