Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86425 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23074 invoked from network); 28 May 2015 17:38:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 May 2015 17:38:55 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.175 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.223.175 mail-ie0-f175.google.com Received: from [209.85.223.175] ([209.85.223.175:36199] helo=mail-ie0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 45/12-01144-EA257655 for ; Thu, 28 May 2015 13:38:54 -0400 Received: by iepj10 with SMTP id j10so43916829iep.3 for ; Thu, 28 May 2015 10:38:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=NZgEOotcJI9l168a4Q5bIdDTXtUwVADhI75rYchlPbI=; b=zdyoWJ4kzHxsz0R7IK8NWyCBOHLdNb5/CFxA/L2jnTuOhsvPipw0snvXGFcWpNHTmO orwDMFUulOKNu+w9m33QQFYKymeQTAliscN3ZFFea+6Xi082aFvW4X3tScSyNsfjAgEC a+vY/4LEn4d6tZjyZSYGutyIDeiSjSQdhCfIdkugpTlC9kvR2gFqRZrrMKBif1t/e6/z FzcKhdflDrBkseieLR93FOuCxxQrKrOZQ9reBlGKYqcuAhhN9xToGz3tc9r7d6e4yOcb MSuK73b7E8l+IjfikM0QY8kPJlMUfJTcUYskCFvXHOq9kvnpYShvG2jJ4rMaSKsWT5MB NC8g== MIME-Version: 1.0 X-Received: by 10.42.132.6 with SMTP id b6mr10767452ict.8.1432834732468; Thu, 28 May 2015 10:38:52 -0700 (PDT) Sender: morrison.levi@gmail.com Received: by 10.79.98.67 with HTTP; Thu, 28 May 2015 10:38:52 -0700 (PDT) In-Reply-To: <5566BE78.20605@gmail.com> References: <5566BE78.20605@gmail.com> Date: Thu, 28 May 2015 11:38:52 -0600 X-Google-Sender-Auth: uRDNMeYqNfLwFvxuNOiabPjngu4 Message-ID: To: Stanislav Malyshev Cc: PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] return/parameter types for magic functions From: levim@php.net (Levi Morrison) On Thu, May 28, 2015 at 1:06 AM, Stanislav Malyshev wrote: > Hi! > > Since we now allow defining return value types for functions, one can > also create definition for magic functions that make no sense, such as > __toString() : float or __isset() : Closure. I think we should restrict > such definitions - either to types that makes sense or in case of > methods that aren't supposed to return anything useful, completely. We > already do this for ctors, dtors and __clone but not consistently for > other magics. Also some values for parameter types make no sense. My original patch for return types did not allow return types for ctors, dtors, and __clone. It seems you did not preserve this? In any case no RFC is needed because this was outlined in the RFC: https://wiki.php.net/rfc/return_types#methods_which_cannot_declare_return_types The only one that should allow anything for now is __toString which would be permitted to declare a return type of string.