Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109686 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 30344 invoked from network); 16 Apr 2020 15:52:24 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Apr 2020 15:52:24 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B782C1804D3 for ; Thu, 16 Apr 2020 07:22:34 -0700 (PDT) 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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 16 Apr 2020 07:22:34 -0700 (PDT) Received: by mail-lj1-f182.google.com with SMTP id q22so8075415ljg.0 for ; Thu, 16 Apr 2020 07:22:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WK+71+TJY5ZW9M4wlNNmCLb8D7uvpmVlqs5GhCuDhH4=; b=oI2DAfYcB3iRa2ZapHO/Wiq8jDzvLGBA/w64P6a7tr7URgJoFmvtPKQWHQAQTTtmS0 /CSljEK/k87QrxrD3rxkuo0JotqePcQY6xPYCHldYcE61hPAStcdqYQJtcNEE+Ofhw5Z aUW9gWmtfGP1HVJW/Mj6r9+jwOAHWmDla73IZUH/uId/KWM2VXpFodkSrcxn/J5Dp9SQ F4eJsctfYPt05gPjdLJtf+MFgXcGv1zWYdTDRQ3Ry8PYsnX64uGRVhFC0luAWc34MFHS dSVTM8sxQzSZLx4aGwmzTAFs9u1Cxn+JfanjLv3kMKLtEVqwhBZjoTmRhMPCzRXJq2wR DCZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WK+71+TJY5ZW9M4wlNNmCLb8D7uvpmVlqs5GhCuDhH4=; b=dS9Eq1dyE227ta3vVAHH5K698rRvg2d65nPw9p2GIFkrt702d6bCjJPfqZYhJsc3HA ap/PTyVv1EsqE5dicqpyN0SPEpe3xQIalO8Seh09AJp7Fqo67rOjlIIWyVkowv/HPKbE l7wosOrc2VQLKyU3UtO+0ZMVgtoEFUqKvGWWiaur4fU9/5kRpT3BjXsoknDouvyNCmuF 4VyfFtoxEaR7Qc9NZ7YFpYNfQJ+X3q2CkMR0cQVZFbQL4O6lX8CO+aJERuU8M5/SwC76 zj6SZLPzFrsjZ7EG079RhnVWyJFdl823p+a/SMYhWqTkjrKZ1q/Jb/TndSJJepz29EiP n+3w== X-Gm-Message-State: AGi0PuaVH7+48AYkqX6fSQyrQGsXutrx1mFkCSFI2Bqd0EWJelm+nnMj 2rovXjuFeXfarxu5vLVJpA7SYaA2/r+2EA9irw== X-Google-Smtp-Source: APiQypKrL7qhWDG9tl6yGDrBRgme+wAoUdYRL+Q7aGt98jmNPszhPGkd+chf6tN7f2ZyLQKVHnStIr0sQ6/Le2b91Ss= X-Received: by 2002:a2e:9cc6:: with SMTP id g6mr3753125ljj.56.1587046948255; Thu, 16 Apr 2020 07:22:28 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 16 Apr 2020 16:22:15 +0200 Message-ID: To: Gabriel Caruso Cc: PHP Internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Ensure correct magic methods' signatures when typed From: guilliam.xavier@gmail.com (Guilliam Xavier) On Sun, Apr 5, 2020 at 4:02 PM Gabriel Caruso wrote: > > Hello, internals. > > Hereby you can find the RFC Document that I want to discuss as suggested > via https://externals.io/message/109416 and > https://externals.io/message/107990: > > https://wiki.php.net/rfc/magic-methods-signature > > Best regards, > > -- Gabriel Caruso Hello, Thank you, this seems a sensible thing to add. Just an interrogation: the following magic methods (from the documentation) aren't mentioned at all in the RFC: - `__sleep(): array` - `__wakeup(): void` - `__unserialize(array $data): void` - (`__invoke` is basically untyped) - `__set_state(array $properties): object` - `__debugInfo(): array` Is there a reason for leaving them out? Related, the RFC mentions that `__serialize` and `__toString` already have a *runtime* check that they respectively return an `array` and a `string` (when called), but why not check their signature (if typed) at *compile time* too (i.e. make https://3v4l.org/ZPrVi an error)? Regards, -- Guilliam Xavier