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
boolallowsDelInIdentifiers()
Whether this version allows DEL (\x7f) to occur in identifiers.
public
allowsDelInIdentifiers() : bool
Return values
boolallowsInvalidOctals()
Whether this version allows invalid octals like "08".
public
allowsInvalidOctals() : bool
Return values
boolequals()
Check whether two versions are the same.
public
equals(PhpVersion $other) : bool
Parameters
- $other : PhpVersion
Return values
boolfromComponents()
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
selffromString()
Parse the version from a string like "8.1".
public
static fromString(string $version) : self
Parameters
- $version : string
Return values
selfgetHostVersion()
Get the host PHP version, that is the PHP version we're currently running on.
public
static getHostVersion() : self
Return values
selfgetNewestSupported()
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
selfisHostVersion()
Check whether this is the host PHP version.
public
isHostVersion() : bool
Return values
boolnewerOrEqual()
Check whether this version is greater than or equal to the argument.
public
newerOrEqual(PhpVersion $other) : bool
Parameters
- $other : PhpVersion
Return values
boololder()
Check whether this version is older than the argument.
public
older(PhpVersion $other) : bool
Parameters
- $other : PhpVersion
Return values
boolsupportsBuiltinType()
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
boolsupportsFlexibleHeredoc()
Whether this version supports flexible heredoc/nowdoc.
public
supportsFlexibleHeredoc() : bool
Return values
boolsupportsShortArrayDestructuring()
Whether this version supports [] for destructuring.
public
supportsShortArrayDestructuring() : bool
Return values
boolsupportsShortArraySyntax()
Whether this version supports [] array literals.
public
supportsShortArraySyntax() : bool
Return values
boolsupportsTrailingCommaInParamList()
Whether this version supports trailing commas in parameter lists.
public
supportsTrailingCommaInParamList() : bool
Return values
boolsupportsUnicodeEscapes()
Whether this version supports unicode escape sequences in strings.
public
supportsUnicodeEscapes() : bool
Return values
boolsupportsYieldWithoutParentheses()
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