Skip to content

Instantly share code, notes, and snippets.

@fernandodebrando
Created July 6, 2017 02:34
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 fernandodebrando/3c0425c3c4ad5cd43bf28cbc1b0ca19d to your computer and use it in GitHub Desktop.
Save fernandodebrando/3c0425c3c4ad5cd43bf28cbc1b0ca19d to your computer and use it in GitHub Desktop.
Object typehint
<?php
// Esta função será analisada estaticamente de acordo com o
// tipo retornado
function correctFunction() : object {
$obj = json_decode('{}');
return $obj;
}
// Esta função será analisada estaticamente e contém erro
// que resultará em falha em tempo de execução
function errorFunction() : object {
return [];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment