Skip to content

Instantly share code, notes, and snippets.

@tomasnorre
Created May 9, 2019 21:00
Show Gist options
  • Save tomasnorre/fa068f8b10895311b788f239e0ee9f84 to your computer and use it in GitHub Desktop.
Save tomasnorre/fa068f8b10895311b788f239e0ee9f84 to your computer and use it in GitHub Desktop.
$ php test.php
PHP Fatal error: Uncaught TypeError: Return value of doStuff() must be of the type bool, int returned in test.php:10
Stack trace:
#0 test.php(13): doStuff()
#1 {main}
thrown in test.php on line 10
Fatal error: Uncaught TypeError: Return value of doStuff() must be of the type bool, int returned in test.php:10
Stack trace:
#0 test.php(13): doStuff()
#1 {main}
thrown in test.php on line 10
<?php
declare(strict_types=1);
function gimmeTrue(): bool { return true; }
function doStuff(): bool
{
$success = gimmeTrue();
$success &= gimmeTrue();
return $success;
}
doStuff();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment