Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121636 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 18776 invoked from network); 10 Nov 2023 11:47:39 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Nov 2023 11:47:39 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CE4D5180211 for ; Fri, 10 Nov 2023 03:47:38 -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=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,FREEMAIL_REPLYTO_END_DIGIT,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 10 Nov 2023 03:47:38 -0800 (PST) Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-da30fd994fdso2702253276.1 for ; Fri, 10 Nov 2023 03:47:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699616857; x=1700221657; darn=lists.php.net; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=z844q3dys6vkq076EaCzipJNzI/zZENeZiJpBS11Lug=; b=HV/WSpWbh7x31kSpBObKPWOxkl6HX5dQXYisqpzIjgM1vFg/d+F4iw9qgOtxrtzS5g wTjQetPD/gVbLXcnWLGbiGwFIxRFKj/9dhAf8NSUVGu9kbbpWVGRhgnsgicti0i7oAh9 gdaCVtia0xvY36RNMRSQ3f4SOeKvRWNYEuqs8WFGX/nsI/1BlUGMB3Nqo9/DvlMeYNfX LAfT3EPBKkpyYo3CAi5r9Gv8QkSfsQTfaVtR/NVZO8mrPb2uogImQ3iwrk33TQSJRfZN O2s/osptajHo4Tp/oYWsLRuy+tM5M+Lq46Bq6VKG4Do1OG58WzWF1wTdQ8rNbZZM+Mwq SStw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699616857; x=1700221657; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=z844q3dys6vkq076EaCzipJNzI/zZENeZiJpBS11Lug=; b=eYovNRIPenxtHtrzvjeoZxvmEC/ekBPY8vE5XzAqt2dkJs1bXCudID52HUSTn3LwZg WT4gmULO/2+dP/3Pv7Y8GkRQeuOBlv2z9g8ylV50WhRk2TMhGxUeYm+A3zY4c/cloF6c DLAS+vl9IDWL1+TV6kW7S10o9TL9TL7mQLV6UTt55QlDoVaSbHKoc2Bmxg8gx6bdzZ9Z Iyg/3Z3FeuPbvRsnJwmTpbHeq1RIyO5uiaEO551gYxvOnz3VHliqVW428lt5W2AjJ4Tg Q8/U6QkzdpWalKY6Wh4nmN99Z0eMEhfFhF7k4cWt2TFkZPF91/E2XOf1c4iRT+1UH7Eb whKg== X-Gm-Message-State: AOJu0YyQ8qZJ8gTCb27dXb2e7pom1+JALFwWLq70naVFqG47yNxhx41N kO6KluP6dDcGkl2Dmt7bUcaAPJkX784Gw0THFGE= X-Google-Smtp-Source: AGHT+IHI8CLLivx95co33ct+vl5dlQkp/e5uoDUvQoQkPZL/b8Fx2f0KHdhIGarMIyV/AUblx3BoO637lhwWcjcaKO8= X-Received: by 2002:a25:f609:0:b0:d86:4342:290 with SMTP id t9-20020a25f609000000b00d8643420290mr1524205ybd.21.1699616857594; Fri, 10 Nov 2023 03:47:37 -0800 (PST) MIME-Version: 1.0 References: <5144806E-E21F-4AF8-B9A2-0161561A6B9E@craigfrancis.co.uk> <1A044D32-019A-4152-A3C0-3F393974AC3B@craigfrancis.co.uk> <88815C70-1100-442A-AFCC-A420862669C3@craigfrancis.co.uk> In-Reply-To: <88815C70-1100-442A-AFCC-A420862669C3@craigfrancis.co.uk> Reply-To: autaut03@gmail.com Date: Fri, 10 Nov 2023 13:47:26 +0200 Message-ID: To: Craig Francis Cc: Kamil Tekiela , PHP internals Content-Type: multipart/alternative; boundary="0000000000000d217b0609cae3b6" Subject: Re: [PHP-DEV] Passing null to parameter From: autaut03@gmail.com (Alex Wells) --0000000000000d217b0609cae3b6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Nov 10, 2023 at 1:33=E2=80=AFPM Craig Francis wrote: > On 10 Nov 2023, at 10:54, Alex Wells wrote: > > PHPStan does find them: > https://phpstan.org/r/38fc1545-2567-49b9-9937-f275dcfff6f5 > > > > It does not: > > https://phpstan.org/r/c533ff42-80e4-4309-9751-1ec79e359946 > > It fails to correctly change the type of the variable to nullable due to the coalescing operator. This is a bug in PHPStan, but if you manually specify the type of that variable as nullable, it starts to correctly report an error on line 5. So it's not that PHPStan can't find places where a null is passed into a non-nullable parameter, but rather PHPStan failing to infer the variable type correctly, thinking it's actually not nullable. --0000000000000d217b0609cae3b6--