Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102834 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56106 invoked from network); 16 Jul 2018 06:01:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2018 06:01:14 -0000 Authentication-Results: pb1.pair.com header.from=arvids.godjuks@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=arvids.godjuks@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.44 as permitted sender) X-PHP-List-Original-Sender: arvids.godjuks@gmail.com X-Host-Fingerprint: 209.85.218.44 mail-oi0-f44.google.com Received: from [209.85.218.44] ([209.85.218.44:37149] helo=mail-oi0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 18/B5-39793-7A43C4B5 for ; Mon, 16 Jul 2018 02:01:11 -0400 Received: by mail-oi0-f44.google.com with SMTP id k81-v6so72552594oib.4 for ; Sun, 15 Jul 2018 23:01:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1l0W/YnJrJobKAhoKssievxzo0aN/JSXGpZiY/AMbok=; b=lJ1z6Sn2r/BN33w5JzP1BAFXbbx07W7nR+vPK9woGElUa/1tXMW93dD+sNGsZRx01c OhI6SoLnixzD5kUu6NY/YeGpfqJ6FLymm574pi5i6ifs903w/bfNYTMwcMpgKSGrMtcM bXTF1R6E/MHenEvzcZiEJ55RzIZh50F5nlUdK90oN+D5nH3BA1yJZhir6IrK3jLssheZ arWbQ7V2DCuFPJRi1aNE7UfmwaoUFgQPQdinrnghuZW6xhdXdHkWp7Iy8OLGm7OhVefw +EkpxRwacfeZ5Xl2y+ZdLUz0KS/hwQgoqMhJrqK+bM6YgLl4bP0qP1Zp3ePBY674q3tI nV2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1l0W/YnJrJobKAhoKssievxzo0aN/JSXGpZiY/AMbok=; b=eM2m/SlPpYpILs6SB8zw6IF2KBkqS5KbZnIVdWA9ZHGaOf6YyH5KAHLKWW2xTIU3Sh nUm8hTyx3uz0qimaAQ/PbHWwzn6t3CJwug/Yr+ajzOs0pXLaxApJ15bcaXpamJipyKwk y33MkSGegfN85uYHrqfKUC1ESDnTrfIqd6k4t9tuYyK0+I2oRikaVxQFAMKGiyOj7pAh 6lcRD1vP94g8+G/VfNOdDY/6Hzk+Vyhp6MANwBOk98K2EY9YTTfZCiteXWA1A25QrqWq /xM8ld3yLn76HzHgFal9PzOdIfr3rGKZr8j4XgEY6eI5A01aIiVhiT1G6pQlWyNIYq/t E3KA== X-Gm-Message-State: AOUpUlHdataU1xCUBIg/MIiEiXwPc66w+McM7FbS62+d/VIi1BW/0ETO RPf3QrrdO2301Ghz94oqXKf7nVJHSPo4FkJYhuQ= X-Google-Smtp-Source: AAOMgpf4VtLzg7J0faWa/pISv1Okp98FBR96/fhivLVpRoDtHAAvSp8Si1nuq3lCEb8Ntbo1IAldwRz73PXwtMf14LM= X-Received: by 2002:aca:a56:: with SMTP id 83-v6mr17787576oik.57.1531720868393; Sun, 15 Jul 2018 23:01:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 16 Jul 2018 09:00:56 +0300 Message-ID: To: Zeljko Mitic Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="0000000000004176e10571178e5f" Subject: Re: [PHP-DEV] [RFC] Optional typehint check for parameters From: arvids.godjuks@gmail.com (Arvids Godjuks) --0000000000004176e10571178e5f Content-Type: text/plain; charset="UTF-8" On Sun, Jul 15, 2018, 22:45 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. > > It would be programmers responsibility to send correct values but people > using typehints are not those still learning the basics. > > Just like it is programmers responsibility to restart php-fpm when using > opcache.validate=0, it would be theirs responsibility to send correct > values. Any decent IDE would mark errors for wrong parameter type and with > tools like phpstan, it is almost impossible to make one. Only development > computers would need to have this checks turned on. > > This creates no BC problems as it is a new feature. Given that typechecks > can be turned off, all existing programs would benefit from extra speed. > > I am sending this mail by following rules from > https://wiki.php.net/rfc/howto . I don't have any knowledge of php > internals so unfortunatelly, I can't help with this. I at least hope > someone will take this RFC into consideration. > Hello, php.ini settings that modify language behaviour on such large scale are not up for introduction or even discussion. PHP has been getting rid of those past 10 years, so forgive me for harshness, but as a user land developer I say "no chance In hell". Arvids, > --0000000000004176e10571178e5f--