Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1432247
ElementContext.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
ElementContext.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Phan\Language
;
use
Phan\CodeBase
;
use
Phan\Language\Element\AddressableElement
;
use
Phan\Language\Element\TypedElement
;
/**
* A context referring to an element that hasn't been created yet.
* This is used when issues can be emitted before an object is added to the codebase.
*/
class
ElementContext
extends
Context
{
/** @var ?AddressableElement $element */
private
$element
;
public
function
__construct
(
AddressableElement
$element
)
{
$this
->
copyPropertiesFrom
(
$element
->
getContext
());
$this
->
element
=
$element
;
}
public
function
isInElementScope
():
bool
{
return
true
;
}
/**
* Manually free the element reference to avoid the gc loop of
* Element -> Parameter -> ElementContext -> Element
*
* (Phan runs without garbage collection for performance reasons)
*/
public
function
freeElementReference
():
void
{
$this
->
element
=
null
;
}
public
function
getElementInScope
(
CodeBase
$code_base
):
TypedElement
{
return
$this
->
element
??
parent
::
getElementInScope
(
$code_base
);
}
public
function
isInGlobalScope
():
bool
{
return
false
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 21:33 (1 d, 6 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
be/68/afd8e1021a91ecdf5b747a8f2438
Default Alt Text
ElementContext.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment