1--TEST--
2Test nested function calls in strict_types=0 and strict_types=1 modes
3--FILE--
4<?php
5
6function takes_int(int $x) {
7    global $errored;
8    if ($errored) {
9        echo "Failure!", PHP_EOL;
10        $errored = FALSE;
11    } else {
12        echo "Success!", PHP_EOL;
13    }
14}
15
16declare(strict_types=1) {
17    function strict_calls_takes_int() {
18        takes_int(1.0); // should fail, strict mode
19    }
20
21    class StrictTakesIntCaller {
22        public function call() {
23            takes_int(1.0); // should fail, strict mode
24        }
25    }
26}
27
28declare(strict_types=0) {
29    function explicit_weak_calls_takes_int() {
30        takes_int(1.0); // should succeed, weak mode
31    }
32
33    class ExplicitWeakTakesIntCaller {
34        public function call() {
35            takes_int(1.0); // should succeed, weak mode
36        }
37    }
38}
39
40
41?>
42--EXPECTF--
43Fatal error: strict_types declaration must be the very first statement in the script in %s on line %d
44