Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119676 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 8586 invoked from network); 9 Mar 2023 16:30:38 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Mar 2023 16:30:38 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 58DA118033A for ; Thu, 9 Mar 2023 08:30:37 -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,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS19151 66.111.4.0/24 X-Spam-Virus: No X-Envelope-From: Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (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 ; Thu, 9 Mar 2023 08:30:36 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1BEBE5C019D for ; Thu, 9 Mar 2023 11:30:34 -0500 (EST) Received: from imap50 ([10.202.2.100]) by compute4.internal (MEProxy); Thu, 09 Mar 2023 11:30:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-type:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1678379434; x= 1678465834; bh=6OyNelLXbn5MlCIwoVaombtGjdlWKxvcr+1pxP0+nH8=; b=m ibAZxiUtm1ANtfEtNRH6tpL79xZ8L/v64zFDRJnQGaCELMKqtigvdpfjQOJCSwFN gkPs9lR+L/RbWadJ8DdEisj8stxrGkuwBPFLruZRHjjXITmBJhHOo1dZSUkOqMCY WEw3KxfJSmf6rLE+CwVH4jgg+E8wnfffmR0wYfAJxHSXwLr8GFDBcQ/OGEdrIub1 phQSsv1PGViOgxnJYezNQ5ZfMwGOK4/shMMiX18muY+DEBmTlHlhO+9fT/UsEKNR /MiQsBQAqQUWdxIr/JQbbSVs5OYOiovzmtYTUgL32cgMJYK7lSiKYhPBo9gfl8p6 BGNs6ySYbn/LhxBDOnLQA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1678379434; x=1678465834; bh=6OyNelLXbn5Ml CIwoVaombtGjdlWKxvcr+1pxP0+nH8=; b=A/iV0Pob/V1cDZX+qSONUrz/mswtQ rhl0DuYxJIU5epKIiYQDI8mIuzylZtHwDokBI8l323ie09rihATMpjPGU0TytqAD 2ulpFQG4Dx8yasKRALt5E9YrlNMbDddopn3gHIIaFuyAbtAggKNUv7X03QO5gpC9 EozgAZ9suzfPAunTHrzAolp//etzqCxTzyi5PRK02TXUZ/GQWf+3M+YK8raWGA0o UB2G1fuL69VlwsEjyQDdyOPp9gofZrMrjhfnGtb2yshfifte4IitE0UQKxbhg6NE p/9osTHmuSde9yaKmp7Mu7hZyyOhBbh2Jtf4HCGOveDr6Xjxlz2Vn0+ig== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdduiedgkeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeeglefgkeduiedvvdetffeujefftdfhjeeiveehgfff keduveektddvledvvdfffeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id B2F021700090; Thu, 9 Mar 2023 11:30:33 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-206-g57c8fdedf8-fm-20230227.001-g57c8fded Mime-Version: 1.0 Message-ID: <1d94e66d-f329-41f1-895b-c36e191f133b@app.fastmail.com> In-Reply-To: References: Date: Thu, 09 Mar 2023 10:30:13 -0600 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] Two Issues regarding Named Parameters; want to understand the technicality From: larry@garfieldtech.com ("Larry Garfield") On Wed, Mar 8, 2023, at 6:26 PM, Hamza Ahmad wrote: > In my second project, I did not receive a warning when I passed the > wrong parameters. To give you an example, I have two constructors: > 1. ` public function __construct(int $date, int$month, int $year) ` > 2. ` public function __construct(string ...$names) ` > When I initialized the latter object with the former object's > signature i.e., `new LatterObject(date: 1, month: 1, year: 1970); > `, I did not receive a warning of passing the wrong parameters. Is the code in strict mode? If not, then that is the expected behavior. You should get a $names array that has 3 associative keys, each with a numeric value that's been cast to a string. In strict mode, I would expect that to give a TypeError, but not in weak mode. --Larry Garfield