Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102842 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77257 invoked from network); 16 Jul 2018 11:15:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2018 11:15:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@ohgaki.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@ohgaki.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ohgaki.net designates 180.42.98.130 as permitted sender) X-PHP-List-Original-Sender: yohgaki@ohgaki.net X-Host-Fingerprint: 180.42.98.130 ns1.es-i.jp Received: from [180.42.98.130] ([180.42.98.130:41134] helo=es-i.jp) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D2/B8-39793-B6E7C4B5 for ; Mon, 16 Jul 2018 07:15:58 -0400 Received: (qmail 111182 invoked by uid 89); 16 Jul 2018 11:15:52 -0000 Received: from unknown (HELO mail-yw0-f181.google.com) (yohgaki@ohgaki.net@209.85.161.181) by 0 with ESMTPA; 16 Jul 2018 11:15:52 -0000 Received: by mail-yw0-f181.google.com with SMTP id t18-v6so14031041ywg.2 for ; Mon, 16 Jul 2018 04:15:52 -0700 (PDT) X-Gm-Message-State: AOUpUlHx3tpiMhGIo15rF0zhwNFwf9VH/zD1l0JFuZ7nDvZtgf6lJNnF cFQU94wkFGj8S8CHwLoBTS7iT16CxH5MMFLgmg== X-Google-Smtp-Source: AAOMgpdQcKjdCGmxWWTMsyix5Xtc1q3Pnq4OPnr6emVHCyhMp07wWSHAM48nPZbeR67Fw7ZHiaJq0S2HJDoETEoifmE= X-Received: by 2002:a81:2dd5:: with SMTP id t204-v6mr4366081ywt.174.1531739746521; Mon, 16 Jul 2018 04:15:46 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 16 Jul 2018 20:15:10 +0900 X-Gmail-Original-Message-ID: Message-ID: To: mitke013@gmail.com Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000007ad93e05711bf362" Subject: Re: [PHP-DEV] [RFC] Optional typehint check for parameters From: yohgaki@ohgaki.net (Yasuo Ohgaki) --0000000000007ad93e05711bf362 Content-Type: text/plain; charset="UTF-8" On Mon, Jul 16, 2018 at 4:46 AM Zeljko Mitic wrote: > PHP is dynamic language and each typed typehinted parameter has to be > checked every time. I am suggesting new php.ini value "typecheck.enable = > 1" which can be turned off. > > Example: > with default php config, a code like this would check each member of $users > array: > > function demo(User ...$users) {} > > but with "typecheck.enable = 0", same code would be treated like it was > written this way: > > function demo(...$users) {} > > Basically, php would simply *ignore* typehints and work like they are not > there. > What you need is DbC. It's more flexible and complete. It satisfies all of your needs and more. An issue is that DbC is not static code analysis tool friendly. https://wiki.php.net/rfc/introduce_design_by_contract https://wiki.php.net/rfc/dbc https://wiki.php.net/rfc/dbc2 Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --0000000000007ad93e05711bf362--