Skip to content

Instantly share code, notes, and snippets.

@cyrilletuzi
Created January 29, 2017 09:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cyrilletuzi/6593337893cf8eb24f6dd1296e55c991 to your computer and use it in GitHub Desktop.
<?php
/* PHP 7+ - default (automatic conversion) */
function myMethod(string $data): int {
$data; // '20'
return 10;
}
myMethod(20); // OK
/* PHP 7+ - strict types */
declare(strict_types=1);
function myMethod(string $data): int {
return 10;
}
myMethod(20); // Error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment