VKCOM/kphp

PHP 7

Tsygankov-Slava opened this issue Β· 0 comments

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

  • is_countable() (RFC)
  • array_(key|value)_(first|last)() (RFC && RFC)

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)

Changed

  • Typed Properties 2.0 public int $id (RFC)
  • Arrow Functions 2.0 fn( $x ) => $x (RFC)