Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119482 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 76972 invoked from network); 7 Feb 2023 20:21:10 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Feb 2023 20:21:10 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 476A518054F for ; Tue, 7 Feb 2023 12:21:05 -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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS20857 136.144.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from outbound4.mail.transip.nl (outbound4.mail.transip.nl [136.144.136.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 7 Feb 2023 12:21:04 -0800 (PST) Received: from submission3.mail.transip.nl (unknown [10.100.4.72]) by outbound4.mail.transip.nl (Postfix) with ESMTP id 4PBDzM0pQYztd9X for ; Tue, 7 Feb 2023 21:21:03 +0100 (CET) Received: from [IPV6:2a02:a450:3eae:1:5c3b:e27:4efe:78ee] (2a02-a450-3eae-1-5c3b-e27-4efe-78ee.fixed6.kpn.net [IPv6:2a02:a450:3eae:1:5c3b:e27:4efe:78ee]) by submission3.mail.transip.nl (Postfix) with ESMTPA id 4PBDzG6TqNz43Tf1 for ; Tue, 7 Feb 2023 21:20:58 +0100 (CET) Message-ID: Date: Tue, 7 Feb 2023 21:20:58 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Content-Language: nl To: internals@lists.php.net References: <18627e9c82d.1185ba82a2669697.6762525826203739336@wendelladriel.com> <8c3fb742-4367-0e4a-b96e-142657ac902c@gmail.com> <5edaa45e-08ff-9529-3a1b-42f655a68497@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: ClueGetter at submission3.mail.transip.nl DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=transip-a; d=demon-angel.eu; t=1675801259; h=from:subject:to: references:in-reply-to:date:mime-version:content-type; bh=3znwgj1x2mMDg3UNreh2496yHGM+hs1CiQBbaBh2cFs=; b=Jl+Pf2eSzt8LFx/efJ3ZftlQHuhjelpP0BAHl6dmqi0qPZZzYAV4rkJCLtm5qxTgfMsj0S 6Dk/+aGLxBvMLA7wsaIn5zN3vURVLoEr8BDvdUPPYPqmRVq4mdg73pQxW5q1afIIe3BT95 6xZBVzBYMVDiHXwszw/Or3w6T5H+gucj0JOB0Vo0An16h71xyOiipB3ZxEhpb5uOZD6Czq Yp1BgeCTg18waSwRq0QfEVZrzP6/T9tIzs+1ZyZZbge5mxthAE7nNbdQrczoM7YyHBxt8R NAzf30tBrIAegaYN/PxgsQzrtfl7RT+Cc5Q5k4r+QvSMynJSkgBol8ILk31FVA== X-Report-Abuse-To: abuse@transip.nl Subject: Re: [PHP-DEV] RFC Proposal - Types for Inline Variables From: mark@demon-angel.eu (Mark Baker) On 07/02/2023 20:53, Olle Härstedt wrote: > No not really. I'd expect it behave similar to function argument > type-hinting in PHP, that is, runtime checks, but where the notation > can be used by external tools. The big difference is that the current checking for function arguments is only necessary when a function is called; but that checking for local-scoped variables would be required on every assignment to a variable, or operation that can change a variable value; and that becomes more problematic with the potential need for union types. $mystring = 'I love elephants'; $findme   = 'php'; int $pos = strpos($mystring, $findme); // $pos can be an integer or false or when a type can legitimately change int $result = PHP_MAX_INT; ++$i; // $i is now a float -- Mark Baker