Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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