Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80097 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76065 invoked from network); 2 Jan 2015 14:27:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jan 2015 14:27:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=j.boggiano@seld.be; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=j.boggiano@seld.be; sender-id=pass Received-SPF: pass (pb1.pair.com: domain seld.be designates 74.125.82.180 as permitted sender) X-PHP-List-Original-Sender: j.boggiano@seld.be X-Host-Fingerprint: 74.125.82.180 mail-we0-f180.google.com Received: from [74.125.82.180] ([74.125.82.180:64411] helo=mail-we0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7F/A2-61219-5EAA6A45 for ; Fri, 02 Jan 2015 09:27:50 -0500 Received: by mail-we0-f180.google.com with SMTP id w62so4531289wes.25 for ; Fri, 02 Jan 2015 06:27:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=WdO9LD4gJhOQTsB1znPhxS1MYUhsG+2e8fFin4fUJaE=; b=RMrCzNnajCeLFXSsLvNBNq2z+01MGD61Qmt1GON+oAmXs41YZ2IqXmz1LXT8q2jpNX B9PRAheCqiuv4wwKtbbIu7wieHmK9qJ/0tK1Cej2QTfF28nbfaqV65NuJvKJmjyuCfGz izHAdIv9NVwpsgf7wjud680l7BmP0FscKsOxdBZdGROi1W9yHApbfiZqpXrhc+Y7QP8+ KQO35k07YfRrnlgXb8wsDBP3gx+7sds3JpgalOfpmv4n0c6AOmNdNDG8ZZ0tGfnknSxl rtsKEPgj2i9GldI3AeGU1iPtKc8d1iuozFy39JM+iJPXeuKzSkbC/xEGlPEvOrXYLb4u oLeQ== X-Gm-Message-State: ALoCoQnUQJwC40SFgeU95UhXjoPue8EAQwThKziBw9qKWdo9qQJnAYmHuv6eDr59p9lALjN1zj5G X-Received: by 10.194.77.201 with SMTP id u9mr146140031wjw.41.1420208864997; Fri, 02 Jan 2015 06:27:44 -0800 (PST) Received: from [192.168.0.169] (90.31.14.46.dynamic.wline.lns.sme.cust.swisscom.ch. [46.14.31.90]) by mx.google.com with ESMTPSA id o16sm31368955wjw.7.2015.01.02.06.27.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Jan 2015 06:27:44 -0800 (PST) Message-ID: <54A6AAE8.6000202@seld.be> Date: Fri, 02 Jan 2015 14:27:52 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Marco Pivetta CC: PHP Internals List References: <41D5BB0B-73AF-488E-968D-90B2878E3178@ajf.me> <54A5DF14.7000105@gmail.com> <54A678EA.4070706@fischer.name> <54A6A4D3.9070808@seld.be> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints From: j.boggiano@seld.be (Jordi Boggiano) On 02/01/2015 14:06, Marco Pivetta wrote: > Regardless if this RFC gets through or not, changing the signature of a > method IS a BC break in any case, so you shouldn't just move your `int` > declaration from the docblocks into the method signature. On public methods yes although a lot of internal public methods are probably safe-ish, or would only affect people extending/overriding. Private methods though could still benefit from this perfectly safely, but if the public methods route params to private methods with strict hints you still get issues. > I'm actually already using https://github.com/beberlei/assert for that, > and I'd like to get rid of it for simpler types. Interesting, I didn't know about this, and it's a cool way to get more specialized assertions than plain type hints allow. IMO with the RFC as it stands you could still get rid of it for simple types though because it's not your job to validate user input. You need an int ask for an int and get an int. If users like convenience they can skip validation, if they like strictness they can do their own layer of Assertion::foo calls in their controllers. Cheers -- Jordi Boggiano @seldaek - http://nelm.io/jordi