Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122223 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 80655 invoked from network); 22 Jan 2024 18:33:37 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 22 Jan 2024 18:33:37 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1705948459; bh=qMGSjlTPZjCGF2UHl/h4n+MI70VA01N1qyaMuc1Bxbw=; h=Date:From:To:Subject:In-Reply-To:References:From; b=QFdxk3nPbgnClWcfw1dJMz6tzpbxcfdtN5XbZgTdyCt12V5pOVT8QTStqTUeXZgGe aGS/rZMJcmkqlOtDfcdQVy1WySFanU5IZ2zfWQ6Q874EbC+Mwd3G6NUxashgOju1ju dLpfW6GH6fQ3neExbaIuATNEe6kPJAWN+SznbRe2NkcwQPfPoQPc3z6BCPnHtUZWlc POI+5oSg0cckqPz8zCityQ8G7IZK0iueNikjEMLtIKBoSdWJSKXkgZ2iXA50Art0J8 5sTdA87vIa73q3SZgw+XRtaqAuGYemWn66jx8EXO9z/fBBG7ZA84XN2++/sOJOrHVc kvT14OPhRXbAQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A710818005A for ; Mon, 22 Jan 2024 10:34:18 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 22 Jan 2024 10:34:18 -0800 (PST) Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-40eacb6067dso16009985e9.1 for ; Mon, 22 Jan 2024 10:33:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705948414; x=1706553214; darn=lists.php.net; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=qMGSjlTPZjCGF2UHl/h4n+MI70VA01N1qyaMuc1Bxbw=; b=j57K2BsRXE3Z3SsBgynfoU5jlDZ1hy+I1pRb4h4BbjvNryHHZkPs1U8s3p/wb0ulLv XhZpB3W7T0ltEvsec6BxvbCdyat3vJ/6iBHiJROQwoOzByXeDOgGgW7jlmmE1A2ydNaa FEwrxADNJ/wR7RHj+KKMuD1vUh94t/9lgwCPEU0z+h5+ddPmd3GBlyUKDqdqRKev8VG8 3W50/nX96/MiSV8bZ8DTLOs+D1kinsq/a5Q1rKWtFyLMuVKSQkdrFrcQtNnMw5DwMqPh YGnk3/JdIf9RdtvZDc6Y/TX6wWheTdcVhG9ncleC4kl1hAD5ynx+G+mZwbYklowxuq0V Pd9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705948414; x=1706553214; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:to:from:date:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=qMGSjlTPZjCGF2UHl/h4n+MI70VA01N1qyaMuc1Bxbw=; b=jEqRSBk3aO6g7DLwckr6AAQYBiyoLT+y7SPqk71a+8IGFXa3R0fS2NRCmoAj31C1X5 lNieqW9z964dGw59NkAMpXqVtVkOKqP1G7UdEpn2+82Picl2pskJuK3FdXuawlNSVMru yphgGxrWL/vKYOBdqbdllO/UFfZE3Oz0M5I6bIYDjoMiCVI1EkTduTTqNtv0U1iQykB0 QMN1MmX2ax14/UJTxDeWJygTJj/WwcXkIrbn9/fj2ObQkm2GrT+ZlHS7oCkGztaT+MVL /utu2tyIuSOXHPSL1Tex8209THc7eSb5zNxXHLulzProTug5LeeYPkO/93VmGcUD9Etz Turw== X-Gm-Message-State: AOJu0Yw4q4gGGwoA1yVy/jMvZnMYVMzWLJfvx1n7yXfQj0cP8aByH8qM UHqACwP3AwQVw/quSJZ8mjUMJCsACtnE5dzHYhQo8c37U+LSjEDeS/P8FzGl X-Google-Smtp-Source: AGHT+IHnSUQBzuKHmxOdg0ohUv5emZZ9Qv9T7dJp4Bkq4O10TOYYre40LGNSbMI1a03jGfDblCAetw== X-Received: by 2002:a05:600c:1c25:b0:40e:7491:91f1 with SMTP id j37-20020a05600c1c2500b0040e749191f1mr1233460wms.172.1705948413732; Mon, 22 Jan 2024 10:33:33 -0800 (PST) Received: from [127.0.0.1] (cpc83311-brig21-2-0-cust191.3-3.cable.virginm.net. [86.20.40.192]) by smtp.gmail.com with ESMTPSA id o31-20020a05600c511f00b0040e703ad630sm31275341wms.22.2024.01.22.10.33.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Jan 2024 10:33:33 -0800 (PST) Date: Mon, 22 Jan 2024 18:33:31 +0000 To: internals@lists.php.net User-Agent: K-9 Mail for Android In-Reply-To: References: Message-ID: <47C806EB-83EE-4972-8456-B1D5C3E7E5BC@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Deprecate implicitly nullable parameter type From: rowan.collins@gmail.com (Rowan Tommins) On 22 January 2024 10:21:12 GMT, tag Knife wrote: >As you are mistaking `iint $var =3D null` params as "nullable"=2E Which t= hey >are not, they are "optional default" parameters=2E The feature which is being discussed is that, for the specific case of "= =3D null", the parameter is made both optional *and* nullable=2E To make it clearer, the following all declare default values within the al= lowed type: int $foo =3D 1 int|string $foo =3D 'hello' ?int $foo =3D 1 ?int $foo =3D null The following all lead to a type error, because the default value isn't al= lowed for the declared type: int $foo =3D 'hello' int|string $foo =3D new DateTime; ?int $foo =3D 'hello' However, there is a special case: for purely historical reasons, a default= of null is allowed *even when it doesn't match the declared type*: int $foo =3D null int|string $foo =3D null These are processed as though they were declared as nullable types; and th= e fix for the proposed deprecation would be to do so: ?int $foo =3D null int|string|null $foo =3D null The fact that the feature is tricky to explain is a good reason to depreca= te it, and I think I support the proposal unless I see a good argument agai= nst=2E Regards, --=20 Rowan Tommins [IMSoP]