Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1431481
Some.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
Some.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Phan\Library
;
/**
* `Some<T>` is a sub-type of `Option<T>` representing an option with a value.
* @see Option
*
* @template T
* The type of the element. Should implement __toString()
*
* @inherits Option<T>
* phpcs:disable PSR2.Classes.PropertyDeclaration.Underscore
* @phan-pure
*/
class
Some
extends
Option
{
/** @var T the value wrapped by this Some<T>*/
private
$_
;
/**
* @param T $_
* @phan-file-suppress PhanParamNameIndicatingUnused
*/
public
function
__construct
(
$_
)
{
$this
->
_
=
$_
;
}
public
function
isDefined
():
bool
{
return
true
;
}
/**
* @return T
*/
public
function
get
()
{
return
$this
->
_
;
}
/**
* @param T $else used in the None sibling class (@phan-unused-param)
* @return T
*/
public
function
getOrElse
(
$else
)
{
return
$this
->
_
;
}
/**
* @return string
* @suppress PhanTypeSuspiciousStringExpression this should be used with T where __toString() is defined.
* A string representation of this object
*/
public
function
__toString
():
string
{
return
'Some('
.
$this
->
_
.
')'
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 20:32 (1 d, 5 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ea/f7/c68f927e1b5eed0a7f0adf209c1f
Default Alt Text
Some.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment