Re: Re: [RFC] Reserving More Types in PHP 7
| From: | Johannes Schlüter | Date: | Tue, 28 Apr 2015 12:39:20 +0000 |
| Subject: | Re: Re: [RFC] Reserving More Types in PHP 7 | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-85989@lists.php.net to get a copy of this message | ||
On Tue, 2015-04-28 at 13:07 +0100, Rowan Collins wrote:
> François Laupretre wrote on 28/04/2015 12:32:
> > Bare class names are still recognized and priority is given to class names (if a
> > 'String' class is defined, every 'String' or even 'string' type hints
> > will always refer to it).
>
> This part is likely to be rather tricky to implement. How do you know if
> a 'String' class is defined or not?
>
> The Engine would have to do something like this:
This also becomes funny with code like this:
<?php
function foo(String $bar) {}
foo($bar); // No class Sttttring,, $bar must be native string
include('some_file_which_defines_a_class_String_maybe_via_autoload_or_sth.php');
foo($bar); // Class String exists, $bar must be of that class
?>
Make things as deterministic as possible.
johannes