Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108007 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 19733 invoked from network); 6 Jan 2020 17:06:40 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Jan 2020 17:06:40 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E1B24180533 for ; Mon, 6 Jan 2020 07:11:34 -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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, 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-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (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 ; Mon, 6 Jan 2020 07:11:34 -0800 (PST) Received: by mail-ed1-f41.google.com with SMTP id f8so4126276edv.2 for ; Mon, 06 Jan 2020 07:11:34 -0800 (PST) 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=DjKwqBQLuTaVK1sVn7W1ouTYNk9lKUdgxr2QCOrEfLk=; b=DN23rbVir14OHfPBDDYBzFaiFYPSLK9nw1Ko0GAJSy23/f3FbfR7+/OeeEXwBQKwck nYjl/yhe7qPh0JsHroAaMetjL5MP2+tDmkj3UKi2uT5HZpnM3HIfmj9yHbRp6Wb/e/MP 5r/YnLLao09p9VVlGni0fy09Uf81pVVTnpF7qimQFiCBvLEMF2FHwa4aqXT45CbtDb+2 cOAMZI7PgYvHjKJRCog7QyYcQsYbhsw4S3apn8kcq8ktnPVokseYDvW7hu5q/sIhnQwX ydFolTpQVt2HQgOlCVk9dsIeJC2gS1OQWkc/fWatJTdJWuusSDxWTFwCuQ/ATBiw7+hI gwdg== 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=DjKwqBQLuTaVK1sVn7W1ouTYNk9lKUdgxr2QCOrEfLk=; b=Tj8IRgr6j0Z+VnNham33S+tXra9atnMDKiC6lisB5qMQdYJF6wN4u1gCd38bldt+Da DxhQN9rQWCGkG9uHazblhX5dKqXLZ5f+whl417kbYXR+PRGj2yEBv258Rc65Y60a2oBs CxZ4viDU/MVEfDLUyTku4Izo56OxKWfOQ30XGPpy2MK5CZdW7R3er913+/ZYqdQCht5j cMnpnvU6x5E5UE79eVfvHpZ7ORiHqduoe9tGlHZQtwCa42udnOXkLNkhuUO5HUs6a2Lm gQjJ2jR96qVDiwkS022+YquNcG9LVAPc6aCrYw3patVYTsGUquIIb3TF28ejP/W3q0/0 1SAg== X-Gm-Message-State: APjAAAVy7r/hkQoOQt0gqnEz0uOXW/5txO+krggGrDkhfdlhvmMmMbKl 4ZtP+I/h4JpzgEdzKzCSfddBwpao7rGuMpiDqJ0= X-Google-Smtp-Source: APXvYqy2Wc+z07vFXvo6xUAlPYfoYt4/SatltQ4QngnnXvLWIZos3DYTW9ncX5+oRQFsug3xp1efccVPNZkuEwAEhwg= X-Received: by 2002:a17:907:43c1:: with SMTP id i1mr106029971ejs.138.1578323491814; Mon, 06 Jan 2020 07:11:31 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 6 Jan 2020 16:10:53 +0100 Message-ID: To: Gabriel Caruso Cc: PHP Internals Content-Type: multipart/alternative; boundary="000000000000120251059b7a13cb" Subject: Re: [PHP-DEV] Ensure correct signatures for PHP magic methods From: george.banyard@gmail.com ("G. P. B.") --000000000000120251059b7a13cb Content-Type: text/plain; charset="UTF-8" On Mon, 6 Jan 2020 at 10:29, Gabriel Caruso wrote: > Hello George > > On Mon, 6 Jan 2020 at 01:28, G. P. B. wrote: > >> On Sun, 5 Jan 2020 at 18:44, Gabriel Caruso >> wrote: >> >>> Hello Internals, >>> >>> I have a PR proposing to start checking the signatures for PHP magic >>> methods in the next major version of PHP: >>> https://github.com/php/php-src/pull/4177. The idea for this PR came from >>> https://bugs.php.net/bug.php?id=69718. >>> >>> I'd like to hear your opinion before putting more effort into this :) >>> >>> Best regards. >>> >> >> Hello Gabriel, >> >> I do like the idea, but I would agree that I'd want void as the return >> type instead of a no return compile error. >> Other than that +1 from my side. >> > > > The reason why I didn't want to go with `__construct(): void`, for > example, is because some articles that I've read say that Constructors and > Destructors do not return anything: > > - https://www.geeksforgeeks.org/php-constructors-and-destructors/ > - https://docs.phpdoc.org/references/phpdoc/tags/return.html > - https://stackoverflow.com/questions/11904255/constructor-returning-value > > Also, the community has pushing this standard, as it can be seen in > https://github.com/slevomat/coding-standard#slevomatcodingstandardtypehintsreturntypehint- > . > > Best regards, > Well the void return type means no return or an early return, so I would say that "no return" is a stronger requirement then void, but I think adding the void return type is a massive BC break as all code which doesn't define the magic methods as void break ... I didn't think that through as it seems the no return thing doesn't have that problem, so seems fine by me however this is done. Best regards George P. Banyard --000000000000120251059b7a13cb--