Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108410 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 5876 invoked from network); 6 Feb 2020 13:28:06 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Feb 2020 13:28:06 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C0B1218050A for ; Thu, 6 Feb 2020 03:40:45 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 6 Feb 2020 03:40:45 -0800 (PST) Received: by mail-lf1-f54.google.com with SMTP id n25so3881050lfl.0 for ; Thu, 06 Feb 2020 03:40:45 -0800 (PST) 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=S4DIAAXoeqP9/P0gGyIMPmwbcy0uwaGkggExJNzl5wY=; b=kd+QD8V86WRdLhrou/aaSG0Lk8qcG/D4PXF8OmcCaNIs0Pe/m8MEqT+/HG8qczuAU+ Bx3Edq5RMlqupJ86Sc0JL7NO57BUnvmDl+Av3Vkln1Srr+48R1lNCrcYOGAVOT0srk5a dCR1RS+fS4A9Xv7FJnkfrqPntafEZmYbQNmNX8EADGpqYWumfvWoUihn+CGO7HF3HA5q ClAh9ToQ7eVPUNM4mBIdMvmgCBDje/URAELlXI/6xXUS3Ao6y0fXRwLZHh6lBUIQUCgH kI9+qLoQbIvaOzJqHiaZO9E1xgNz1x/T+hwEkGqeRaeUejjy3ofzlMegAPFvYyMsslFc uczA== 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=S4DIAAXoeqP9/P0gGyIMPmwbcy0uwaGkggExJNzl5wY=; b=YH6Ph2PC8CdbGQfG4UOlS59uSInzRGQd432WYLYtcvkcZhzz/C/ND5I3rjFd1rUelb mI414divtpyO0ocXYG4OR5AiY2cWEgMbcrU6Bx8Aj5liFUjEUANaS1jTETnrvJs7BDb4 NzbucgZ/7SdIJUyBgs7qpK3BcQ0HIy7VTDvldQ7b/vJ8WtowvMtMeJuAHUKUtmhaU19W gNsIsotxgu8MNYQUUZqCjLTH1osJXe+ld6k3HS9v0vnTpLa0BBmZGsk2r1K5XorK+Ydp dTg9INGjL0gc3eLUDqaJ/hdn+8gqQNyqfj4bq/+thhrsRwL3+GoRBBSQ+RNab3bvlQVL 9T2g== X-Gm-Message-State: APjAAAUpUBNhyPp+gxFgJetNJJR0HwgWEZgMXsPy6F3uMjBLHVHjgQDy v+5O9eUJcka2sepo1TFoX8IloTO7ZaSyDnj7e/s= X-Google-Smtp-Source: APXvYqyCyb41dAR7PROqHso7HUroX2nii9w7WoL7y9tv6lL3Vhk3+JY/S+UdPhEVQ9JRPkOn1/0OcHviC00uHLPYfhA= X-Received: by 2002:ac2:43c6:: with SMTP id u6mr1571753lfl.191.1580989242943; Thu, 06 Feb 2020 03:40:42 -0800 (PST) MIME-Version: 1.0 References: <5e24c6ec.1c69fb81.1d93b.aafcSMTPIN_ADDED_MISSING@mx.google.com> In-Reply-To: Date: Thu, 6 Feb 2020 12:40:26 +0100 Message-ID: To: Guilliam Xavier Cc: Andrea Faulds , PHP internals Content-Type: multipart/alternative; boundary="000000000000382aa8059de6bea2" Subject: Re: [PHP-DEV] Warn when declaring required parameter after optional one From: nikita.ppv@gmail.com (Nikita Popov) --000000000000382aa8059de6bea2 Content-Type: text/plain; charset="UTF-8" On Wed, Feb 5, 2020 at 1:15 PM Guilliam Xavier wrote: > Hi, > > On Wednesday, February 5, 2020, Nikita Popov wrote: >> >> >> I like this idea and have updated the pull request to ignore the "Type >> $param = null" case, so the deprecation should now just catch the >> "definitely" incorrect signatures. >> >> So to summarize the current state: >> >> function test($foo = "bar", $baz) {} >> // Deprecated: Required parameter $baz follows optional parameter $foo >> >> function test(Abc $foo = null, $baz) {} >> // No warnings, works fine! >> >> With that adjustment made, are there any further concerns about this >> change? > > > Can you please just clarify which of the following will emit a deprecation? > > function f1($a = null, $b) {} > function f2(A $a = null, $b) {} > function f3(?A $a = null, $b) {} > > (I think f1 will, f2 won't, but f3? > f1 will, f2 won't, f3 also won't. f3 could technically emit one, but I'm not sure it's worth having a special case of a special case for this. Nikita --000000000000382aa8059de6bea2--