On Wed, Feb 25, 2015 at 3:54 PM, Shashank Kumar <shashankkumar...@gmail.com> wrote:
> On Wed, Feb 25, 2015 at 4:30 AM, Dmitry Stogov <dmi...@zend.com> 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 { >> bar($a); >> return $a; >> } >> ?> >> >> b.php >> ===== >> <?php >> declare(strict_types=1) >> function bar(int &$a) { >> var_dump($a); >> } >> ?> >> >> Thank. Dmitry. >> >> > As I understand the proposal and above example, it's possible to change > the 'strict_type' settings per file. > So, for an enterprise application being developed over many years, it's a > very realistic scenario > that this setting will be different in different files especially if > coding conventions are not followed (happens very often). > > Does that mean when reading or writing code, in addition to checking the > signature of a function, > I have to check the 'strict_types' setting at the top as well, to > understand how that signature behaves? > I think you should check it in the top line of the file where the function was called from. Thanks. Dmitry. > > Thanks > Shashank >