Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7412708
Option.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1023 B
Referenced Files
None
Subscribers
None
Option.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Phan\Library
;
/**
* An Option is a safer equivalent to nullable values, indicating that callers should check for absences of values.
* This demonstrates Phan's template support.
*
* It is either `None` (analogous to `null`) or `Some<T>` (analogous to `T`).
*
* This was introduced prior to Phan's support for nullable types and strict type checking.
*
* @template T
* The type of the element
* @phan-pure
*/
abstract
class
Option
{
/**
* If this has a value, return that value.
* Otherwise, return $else
*
* @param T $else
* @return T
*/
abstract
public
function
getOrElse
(
$else
);
/**
* @return bool true if this is defined (i.e. this is an instance of Some)
*/
abstract
public
function
isDefined
():
bool
;
/**
* Gets the value, or throws if this was an instance of None.
*
* The caller should check if $this->isDefined()
*
* @return T
*/
abstract
public
function
get
();
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 00:35 (1 d, 19 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
a5/c2/3b2261150fb8b001a75ffdc2490b
Default Alt Text
Option.php (1023 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment