kphp
kphp copied to clipboard
PHP 7
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_brightness: — high priority
- :low_brightness: — low priority
- :small_orange_diamond: — breaks backward compatibility
- :small_red_triangle: — will not be changed in KPHP
- :hourglass_flowing_sand: — syntax is supported at the parser level
- :hammer: - in progress
PHP 7
Added
New syntax
- [x] Null Coalesce Operator (RFC)
- [x] Combined Comparison (Spaceship) Operator
$a <=> $b
(RFC) - [x] Group Use Declarations
use name\space\{A, B, C as c}
(RFC) - [x] New types of function/method parameters
int, float, bool
(RFC) - [x] Types of function/method return
int, float, bool, array
(RFC) - [ ] Anonymous Classes
$class = new class{}
(RFC) | :hammer: #273 - [ ] :hourglass_flowing_sand: Generator Return Expressions
yield ... return 99
(RFC) | :hammer: - [ ] :hourglass_flowing_sand: Generator Delegation
yield from func()
(RFC) | :hammer:
Other
- [x] Array in define
define( 'FOO', [1,2] )
(RFC)
Changed
- [x] Fix "foreach" behavior (RFC)
PHP 7.1
Added
New syntax
- [x] Nullable type
?int
(RFC) - [x] Return type
void
(RFC) - [x] Square bracket syntax for array destructuring assignment
['key'=>$var] = ['key'=>'Значение']
(RFC) - [x] Key support in list()
list( 'id'=>$id ) = $data
(RFC) - [ ] :hourglass_flowing_sand: New pseudo-type
iterable
(RFC) | :hammer: - [x] Generalize support of negative string offsets
$string[-1]
(RFC) - [ ] :hourglass_flowing_sand: Catching Multiple Exception Types
catch (First | Second $e)
(RFC) | :hammer:
Other
- [ ] New static Closure method
Closure::fromCallable()
(RFC) - [x] Scope of constants in classes
private const
(RFC)
PHP 7.2
Added
New syntax
- [x] Trailing Commas In List Syntax (RFC)
PHP 7.3
Added
New syntax
- [ ] :hourglass_flowing_sand: Links in list
list( &$a )
(RFC) | :hammer:
Other
Changed
- [x] Flexible Heredoc and Nowdoc Syntaxes (RFC)
PHP 7.4
Added
New syntax
- [x] Spread Operator in Array Expression
[ ...$arr ]
(RFC) - [x] Null Coalescing Assignment Operator
??=
(RFC) - [x] Numeric Literal Separator
299_792
(RFC)
Other
- [x] Covariant Returns and Contravariant Parameters (RFC)
- [x]
strip_tags( $str, ['a', 'p'] )
(RFC) - [x]
__serialize() __unserialize()
(RFC && RFC) - [ ] Call array_merge without arguments
array_merge()
(RFC) - [ ] Allow throwing exceptions from __toString() (RFC)
- [ ] Weak References (RFC)