PHP 7
Tsygankov-Slava opened this issue Β· 0 comments
Tsygankov-Slava commented
PHP 7.x added a lot of different things and changed a lot of behaviors.
This issue is tracking the status of PHP 7 implementation in KPHP.
The following emoji will be used to denote the task status:
- π β high priority
- π β low priority
- πΈ β breaks backward compatibility
- πΊ β will not be changed in KPHP
- β³ β syntax is supported at the parser level
- π¨ - in progress
PHP 7
Added
New syntax
- Null Coalesce Operator (RFC)
- Combined Comparison (Spaceship) Operator
$a <=> $b
(RFC) - Group Use Declarations
use name\space\{A, B, C as c}
(RFC) - New types of function/method parameters
int, float, bool
(RFC) - Types of function/method return
int, float, bool, array
(RFC) - Anonymous Classes
$class = new class{}
(RFC) | π¨ #273 - β³ Generator Return Expressions
yield ... return 99
(RFC) | π¨ - β³ Generator Delegation
yield from func()
(RFC) | π¨
Other
- Array in define
define( 'FOO', [1,2] )
(RFC)
Changed
- Fix "foreach" behavior (RFC)
PHP 7.1
Added
New syntax
- Nullable type
?int
(RFC) - Return type
void
(RFC) - Square bracket syntax for array destructuring assignment
['key'=>$var] = ['key'=>'ΠΠ½Π°ΡΠ΅Π½ΠΈΠ΅']
(RFC) - Key support in list()
list( 'id'=>$id ) = $data
(RFC) - β³ New pseudo-type
iterable
(RFC) | π¨ - Generalize support of negative string offsets
$string[-1]
(RFC) - β³ Catching Multiple Exception Types
catch (First | Second $e)
(RFC) | π¨
Other
- New static Closure method
Closure::fromCallable()
(RFC) - Scope of constants in classes
private const
(RFC)
PHP 7.2
Added
New syntax
- Trailing Commas In List Syntax (RFC)
PHP 7.3
Added
New syntax
- β³ Links in list
list( &$a )
(RFC) | π¨
Other
Changed
- Flexible Heredoc and Nowdoc Syntaxes (RFC)
PHP 7.4
Added
New syntax
- Spread Operator in Array Expression
[ ...$arr ]
(RFC) - Null Coalescing Assignment Operator
??=
(RFC) - Numeric Literal Separator
299_792
(RFC)
Other
- Covariant Returns and Contravariant Parameters (RFC)
-
strip_tags( $str, ['a', 'p'] )
(RFC) -
__serialize() __unserialize()
(RFC && RFC) - Call array_merge without arguments
array_merge()
(RFC) - Allow throwing exceptions from __toString() (RFC)
- Weak References (RFC)