Re: Scalar Type Declaration Syntax Weirdness

From: Date: Tue, 24 Nov 2015 15:27:34 +0000
Subject: Re: Scalar Type Declaration Syntax Weirdness
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-89376@lists.php.net to get a copy of this message
On Tue, Nov 24, 2015 at 8:10 AM, Sebastian Bergmann <sebastian@php.net> wrote: > The following is currently valid PHP 7 code > > <?php > function a(\int $i) {} > > Is it intentional that the \ in front of the "int" is allowed? IMHO, this > confusing notation must not be allowed. > > > Why not? Its a root level type, you can prefix a \ on any other root level type that's valid for use in type hinting. function a(\DateTime $d) {} function b(\SplFileObject $f) {} Also, this is the only way to get some IDEs to recognize the type when in a namespace (at least currently).

« previous php.internals (#89376) next »