Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83308 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15279 invoked from network); 20 Feb 2015 14:58:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Feb 2015 14:58:23 -0000 Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.179 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.217.179 mail-lb0-f179.google.com Received: from [209.85.217.179] ([209.85.217.179:35319] helo=mail-lb0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 58/10-14173-D8B47E45 for ; Fri, 20 Feb 2015 09:58:22 -0500 Received: by lbjb6 with SMTP id b6so6787465lbj.2 for ; Fri, 20 Feb 2015 06:58:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=pd+mZNSA0lvv0WaEPvgDkkXNZFDVqLpW+YaFc4t0wNQ=; b=FpY6cKYFalZVZsgzOB5DksCbFMvRcJvxPCVjFMyUsotXuKsnyZesltEXoQ5qzozllV yMJer5NlVMD9TIBXrx3c4u3UkyrHktxYgO4T0WQpN0f+fSBVoD647KI9ej7UoDkC7Tn/ cEA22quZY1amKV4zTSWD0d0Xh/fDf6ynb5zrBsSWugcF0mv2Tq9SNz4e9+zduKqHWXd5 5Q7mcqZff/5B2zCSICaldS4KtjvP1IH88F+R9bllTO8cyeKXu90DGcnaeCgbO6q5bjvA vqE0nBWBarZnLiVf63aH+yvonfycVeCe0xE6EhPBh26nvApPNnfJqhXDcXtww1ghssE1 v2GA== MIME-Version: 1.0 X-Received: by 10.112.139.136 with SMTP id qy8mr9006721lbb.38.1424444298349; Fri, 20 Feb 2015 06:58:18 -0800 (PST) Received: by 10.25.43.9 with HTTP; Fri, 20 Feb 2015 06:58:18 -0800 (PST) In-Reply-To: <1624E4FE-8937-4BC1-A449-47D6DF3973E0@chrisnharvey.com> References: <1624E4FE-8937-4BC1-A449-47D6DF3973E0@chrisnharvey.com> Date: Fri, 20 Feb 2015 09:58:18 -0500 Message-ID: To: Chris Harvey Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC-Discuss] Scalar Type Declarations v0.5 From: ircmaxell@gmail.com (Anthony Ferrara) Chris, I'll edit in the proposal, but you can check the tests in the mean time: https://github.com/ircmaxell/php-src/blob/c8590799622ddb801360664d08ac5d7f4fa342df/Zend/tests/typehints/scalar_strict_declaration_placement_002.phpt https://github.com/ircmaxell/php-src/blob/c8590799622ddb801360664d08ac5d7f4fa342df/Zend/tests/typehints/scalar_strict_declaration_placement_004.phpt https://github.com/ircmaxell/php-src/blob/c8590799622ddb801360664d08ac5d7f4fa342df/Zend/tests/typehints/scalar_strict_declaration_placement_005.phpt So it needs to come before the namespace declaration (in fact, it currently needs to be the first declaration in the file). Though I am about to implement the block syntax, and that may alter things slightly (though declare will be required to be outside the namespace). Anthony On Fri, Feb 20, 2015 at 6:07 AM, Chris Harvey wrote: > Hi Anthony, > > I have been interested in this proposal for a while now. I'm not on internals, but I have a question about your proposal. > >> 1. declare(strict_types=1) (if used) is required to be the first >> instruction in the file only. No other usages allowed. > > How would this work with namespaces? > > declare(strict_types=1) namespace Foo; > > namespace Bar; declare(strict_types=1) > > strict namespace Baz; > > Really good proposal though. Really hope it passes vote and we finally get scalar type hints in PHP. > > Cheers, > > Chris