Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122590 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id BC4E91AD8F6 for ; Sat, 9 Mar 2024 07:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1709968753; bh=Qf29gcrSGwSHderAj5R0opcALislcHrLp4RmPSGwUck=; h=Date:To:From:Subject:From; b=MYsToZ9Xs4j/qemx4x3RT75nIJnwAJSl0S+Qto+nzWpylYStDg2HRVSJdygSwveQT xkNB0PVjhDTttexe6wrC4Mn8BZuG3PnA2r5nU4dQATvb+p7W5pH1yaszac+gx6K6uo HyQKcPaqFesDofD/GU4hRW6B3+xv6BuHTm6XmJLfGFNknJ9dko8bdF0G/C79MFkTFV VMw1fhoDLNf2AlVohB1hkkLJaHUW6Mu/MoTFE8/tAU98hYHGljA9+svf+fQiL6uTfS Mvn54a/+MvdHytKaE94omkuWMY4B3b1ehOQDWW1sxmtxxqdRWPZFJDQ8p9kHFj7EB8 PoU2ulbzG1shg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A9020180697 for ; Sat, 9 Mar 2024 07:19:12 +0000 (UTC) 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.3 required=5.0 tests=BAYES_50,DKIM_INVALID, DKIM_SIGNED,DMARC_MISSING,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from wp160.webpack.hosteurope.de (wp160.webpack.hosteurope.de [80.237.132.167]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 9 Mar 2024 07:19:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mabe.berlin ; s=he194859; h=Content-Transfer-Encoding:Content-Type:Subject:From:To: MIME-Version:Date:Message-ID:From:Sender:Reply-To:Subject:Date:Message-ID:To: Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:In-Reply-To:References; bh=J6VwXUXOBzPxx5k6lnq8UALVFJeN6mSVskX7vmA+Z3Y=; t=1709968738; x=1710400738; b=vR0pq2ApoNmxkUM/FYHHReipX6UNvRqlRJG/f8B5pJy4l1yncRzrl07Bgw6belVVIHSYQJVe27 DENo232lm54k54eJE5N9no9wJWAhuc0GmBGDDqsfmIKNurC41P9ddcGS9Xac2VIqknYjJgbr0xfm1 m9oOUtxL39WvmGl1hnRSFvl210h6l6EECe5CpnPFDBRZkzVQVkFghRPiERQOdkP0OC6PkAZCuoL9g Z71E6s6csLxkv98CBC4F/ZtWVuNjaUCqRGR4zRy4KAJxUlYmxobfnuwBBSJmbHdzjEGFUREb42KJu sk3QjeNRR77RZuF0Yy3xZ+ka2gdViTobTCqdg==; Received: from [2a02:8109:b323:1700:e5f9:7932:39d4:19d7]; authenticated by wp160.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1riqyu-0001xQ-Gj; Sat, 09 Mar 2024 08:18:56 +0100 Message-ID: <5ac38d16-4b70-428e-ad80-87ae54839622@mabe.berlin> Date: Sat, 9 Mar 2024 08:18:56 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: internals@lists.php.net Content-Language: en-US Subject: [PHP-DEV] Idea: Implicit inheriting function argument & return type-hint Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-bounce-key: webpack.hosteurope.de;marc@mabe.berlin;1709968738;f7d85372; X-HE-SMSGID: 1riqyu-0001xQ-Gj From: marc@mabe.berlin (Marc) Hi internals, Based on the discussion of "Property accessor hooks, take 2​" and the set-hook argument type - I got to wonder why we still define "no type" as `mixed`. As the pseudo type `mixed` exists since PHP 8.0, which is already out-of-date, I have the feeling it would be better to force people to explicitly write `mixed` to widen the type of an overwritten function and let "no type" inherit the argument and return type of the parent. Example: class A {     public function typed(int $var): int { return $var; }     public function untyped($var) { return $var; } // implicit mixed as no overwrite } class B extends A {     public function typed($var) { return $var; } // implicit int as inherited from overwritten function } class C extends A {     public function typed(mixed $var):mixed { return $var; } // explicit mixed to widen the type } That do you think? This is just something that come to mind without having the knowledge nor time for this kind of RFC or implementation. Greetings, Marc