Skip to content

Instantly share code, notes, and snippets.

@erikaheidi
Created August 18, 2020 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erikaheidi/b5eafb0fe8329747d2d755173ab7af75 to your computer and use it in GitHub Desktop.
Save erikaheidi/b5eafb0fe8329747d2d755173ab7af75 to your computer and use it in GitHub Desktop.
Notas de Estudo: PHP 8

Novidades do PHP 8

  • Union Types (|)
    • public function foo(Foo|Bar $input): int|float;
  • JIT
    • TODO: comparar performance PHP 7 x PHP 8 com processamento de imagens
  • The nullsafe operator (?)
    • $dateAsString = $booking->getStartDate()?->asDateTimeString();
  • Named arguments
    • function foo(string $a, string $b, ?string $c = null, ?string $d = null)
  • Attributes (@@)
    • estudar mais
  • Match expression
  • Constructor property promotion
  • New static return type
  • New mixed type
  • Throw expression
  • Inheritance with private methods
  • Weak maps
  • Allowing ::class on objects
  • Non-capturing catches
  • Trailing comma in parameter lists
  • Create DateTime objects from interface
  • New Stringable interface
  • New str_contains() function
  • New str_starts_with() and str_ends_with() functions
  • New fdiv() function
  • New get_debug_type() function
  • New get_resource_id() function
  • Abstract methods in traits improvements
  • Object implementation of token_get_all()
  • Variable syntax tweaks
  • ext-json always available
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment