Hey Pavel,

> how will these examples work btw?
>
> // a.php
> <?php
> declare(strict_types=1);
> function foo($fn) {
> $fn("1");
> };
>
> // b.php
> <?php
> require 'a.php';
> foo(function (int $a) { return $a * 2; });

Result: catchable fatal error
Reason: invocation context is in strict mode


> // c.php
> <?php
> function foo($fn) {
> $fn("1");
> };
>
> // d.php
> <?php
> declare(strict_types=1);
> require 'c.php';
> foo(function (int $a) { return $a * 2; });

Result: no error
Reason: invocation context is in weak mode

> I can't find this in the RFC. I'd intuitively expect error in the
> first example and the second one to work OK.

Correct :)

-Tom

                                          
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to