first_class_callable_015.phpt 479 B

123456789101112131415161718192021222324
  1. --TEST--
  2. First class callables and strict types
  3. --FILE--
  4. <?php
  5. declare(strict_types=1);
  6. function test(int $i) {
  7. var_dump($i);
  8. }
  9. require __DIR__ . '/first_class_callable_015_weak.inc';
  10. require __DIR__ . '/first_class_callable_015_strict.inc';
  11. $fn = test(...);
  12. do_weak_call($fn);
  13. try {
  14. do_strict_call($fn);
  15. } catch (Error $e) {
  16. echo $e->getMessage(), "\n";
  17. }
  18. ?>
  19. --EXPECTF--
  20. int(42)
  21. test(): Argument #1 ($i) must be of type int, string given, called in %s on line %d