Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88268 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66327 invoked from network); 16 Sep 2015 22:11:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Sep 2015 22:11:39 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.180 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.160.180 mail-yk0-f180.google.com Received: from [209.85.160.180] ([209.85.160.180:33679] helo=mail-yk0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B4/E4-41443-A19E9F55 for ; Wed, 16 Sep 2015 18:11:38 -0400 Received: by ykft14 with SMTP id t14so249669ykf.0 for ; Wed, 16 Sep 2015 15:11:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:message-id:subject:to:content-type; bh=hsWdRKyxPoyQEhcLzoDtuxhJtNi+kJx3ZqwcxzCo0Mo=; b=J3/8jXMzAt7QBoZPifQfHb5XguFo/lxyv0j0zvYl7ty39TXA6+THUq3V12/59X3DMj om4y7YMwqhbbHEZDvymNH+rzG+L41tyKdu++8UCnwf8YRb8oW71umLK5Z87PtWdmeI37 emOI65dVLLa0dxlw9pPEyTtLJHPuQLjRAf0sFZZgVKthEg1anotWX1RXGBinCUFH0dFC pOmwDYYqSZbplAhbdvCWb5yAQaR3n5kEcYbXsKjuJa2GOVE1CQA6cVAEBhMvB3l0dlCs oU/8M8VSGcQrXTFPZsxh+zhQmocGUHe1eh7JxU4wvthPfaCQCKKb1DwyQOO7aAZzG/GL bZtA== X-Received: by 10.129.49.3 with SMTP id x3mr30954800ywx.56.1442441495316; Wed, 16 Sep 2015 15:11:35 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.129.57.215 with HTTP; Wed, 16 Sep 2015 15:10:55 -0700 (PDT) Date: Thu, 17 Sep 2015 07:10:55 +0900 X-Google-Sender-Auth: f0SEhCClQKz4FGLBwbITeykJPy0 Message-ID: To: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Make strict mode more strict? From: yohgaki@ohgaki.net (Yasuo Ohgaki) Hi all, PHP 7 has strict_types mode for function parameters/return values and these are binded to certain type strictly. https://wiki.php.net/rfc/scalar_type_hints_v5 Why not make strict_types mode more strict? The idea is as follows: Assigning different type to already initialized variable is a bug most likely. There may be cases that variable should have several types, e.g. return INT for success and FALSE for failure, but programmers can use different variable or return value directly or make BOOL/NULL exception. This is useful with reference especially. For example, outputs string(6) "string" Just an idea. Any comments? -- Yasuo Ohgaki yohgaki@ohgaki.net