Documentation

PhpVersion
in package

A PHP version, representing only the major and minor version components.

Table of Contents

Constants

BUILTIN_TYPE_VERSIONS  = ['array' => 50100, 'callable' => 50400, 'bool' => 70000, 'int' => 70000, 'float' => 70000, 'string' => 70000, 'iterable' => 70100, 'void' => 70100, 'object' => 70200, 'null' => 80000, 'false' => 80000, 'mixed' => 80000, 'never' => 80100, 'true' => 80200]

Properties

$id  : int

Methods

allowsAssignNewByReference()  : bool
Whether this version allows "$var =& new Obj".
allowsDelInIdentifiers()  : bool
Whether this version allows DEL (\x7f) to occur in identifiers.
allowsInvalidOctals()  : bool
Whether this version allows invalid octals like "08".
equals()  : bool
Check whether two versions are the same.
fromComponents()  : self
Create a PhpVersion object from major and minor version components.
fromString()  : self
Parse the version from a string like "8.1".
getHostVersion()  : self
Get the host PHP version, that is the PHP version we're currently running on.
getNewestSupported()  : self
Get the newest PHP version supported by this library. Support for this version may be partial, if it is still under development.
isHostVersion()  : bool
Check whether this is the host PHP version.
newerOrEqual()  : bool
Check whether this version is greater than or equal to the argument.
older()  : bool
Check whether this version is older than the argument.
supportsBuiltinType()  : bool
Check whether this PHP version supports the given builtin type. Type name must be lowercase.
supportsFlexibleHeredoc()  : bool
Whether this version supports flexible heredoc/nowdoc.
supportsShortArrayDestructuring()  : bool
Whether this version supports [] for destructuring.
supportsShortArraySyntax()  : bool
Whether this version supports [] array literals.
supportsTrailingCommaInParamList()  : bool
Whether this version supports trailing commas in parameter lists.
supportsUnicodeEscapes()  : bool
Whether this version supports unicode escape sequences in strings.
supportsYieldWithoutParentheses()  : bool
Whether this version supports yield in expression context without parentheses.
__construct()  : mixed

Constants

BUILTIN_TYPE_VERSIONS

private array<string|int, int> BUILTIN_TYPE_VERSIONS = ['array' => 50100, 'callable' => 50400, 'bool' => 70000, 'int' => 70000, 'float' => 70000, 'string' => 70000, 'iterable' => 70100, 'void' => 70100, 'object' => 70200, 'null' => 80000, 'false' => 80000, 'mixed' => 80000, 'never' => 80100, 'true' => 80200]

Minimum versions for builtin types

Properties

$id

public int $id

Version ID in PHP_VERSION_ID format

Methods

allowsAssignNewByReference()

Whether this version allows "$var =& new Obj".

public allowsAssignNewByReference() : bool
Return values
bool

allowsDelInIdentifiers()

Whether this version allows DEL (\x7f) to occur in identifiers.

public allowsDelInIdentifiers() : bool
Return values
bool

allowsInvalidOctals()

Whether this version allows invalid octals like "08".

public allowsInvalidOctals() : bool
Return values
bool

fromComponents()

Create a PhpVersion object from major and minor version components.

public static fromComponents(int $major, int $minor) : self
Parameters
$major : int
$minor : int
Return values
self

fromString()

Parse the version from a string like "8.1".

public static fromString(string $version) : self
Parameters
$version : string
Return values
self

getHostVersion()

Get the host PHP version, that is the PHP version we're currently running on.

public static getHostVersion() : self
Return values
self

getNewestSupported()

Get the newest PHP version supported by this library. Support for this version may be partial, if it is still under development.

public static getNewestSupported() : self
Return values
self

isHostVersion()

Check whether this is the host PHP version.

public isHostVersion() : bool
Return values
bool

newerOrEqual()

Check whether this version is greater than or equal to the argument.

public newerOrEqual(PhpVersion $other) : bool
Parameters
$other : PhpVersion
Return values
bool

older()

Check whether this version is older than the argument.

public older(PhpVersion $other) : bool
Parameters
$other : PhpVersion
Return values
bool

supportsBuiltinType()

Check whether this PHP version supports the given builtin type. Type name must be lowercase.

public supportsBuiltinType(string $type) : bool
Parameters
$type : string
Return values
bool

supportsFlexibleHeredoc()

Whether this version supports flexible heredoc/nowdoc.

public supportsFlexibleHeredoc() : bool
Return values
bool

supportsShortArrayDestructuring()

Whether this version supports [] for destructuring.

public supportsShortArrayDestructuring() : bool
Return values
bool

supportsShortArraySyntax()

Whether this version supports [] array literals.

public supportsShortArraySyntax() : bool
Return values
bool

supportsTrailingCommaInParamList()

Whether this version supports trailing commas in parameter lists.

public supportsTrailingCommaInParamList() : bool
Return values
bool

supportsUnicodeEscapes()

Whether this version supports unicode escape sequences in strings.

public supportsUnicodeEscapes() : bool
Return values
bool

supportsYieldWithoutParentheses()

Whether this version supports yield in expression context without parentheses.

public supportsYieldWithoutParentheses() : bool
Return values
bool

__construct()

private __construct(int $id) : mixed
Parameters
$id : int

        
On this page

Search results