Re: Re: [RFC-Discuss] Scalar Type Declarations v0.5
| From: | Jordi Boggiano | Date: | Wed, 25 Feb 2015 17:12:17 +0000 |
| Subject: | Re: Re: [RFC-Discuss] Scalar Type Declarations v0.5 | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-83808@lists.php.net to get a copy of this message | ||
On 25/02/2015 12:30, Dmitry Stogov wrote:
anyone may tell, what this will print without running :) main.php ======== <?php declare(strict_types=1) include "a.php"; include "b.php"; var_dump(foo("5")); ?> a.php ===== <?php declare(strict_types=0) function foo(string $a): string {I am not sure if we really need to focus the discussion on whether edge cases using references are confusing or not. They already are confusing even without scalar hints (of any kind), and that's why most people know to stay away from refs in PHP. PHP5 would behave the same if you did an explicit $a = (int) $a; in bar() for example, and the same WTF happens with the other RFC, so I am not really sure what you are trying to point out here. Cheers -- Jordi Boggiano @seldaek - http://nelm.io/jordibar($a); return $a;} ?> b.php ===== <?php declare(strict_types=1) function bar(int &$a) {var_dump($a);} ?>