Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89334 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77682 invoked from network); 23 Nov 2015 15:31:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Nov 2015 15:31:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.53 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.53 mail-wm0-f53.google.com Received: from [74.125.82.53] ([74.125.82.53:36452] helo=mail-wm0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 20/B4-47837-D3133565 for ; Mon, 23 Nov 2015 10:31:10 -0500 Received: by wmww144 with SMTP id w144so101268645wmw.1 for ; Mon, 23 Nov 2015 07:31:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=kg+Sd+jxk/4M+fUpti5ntRRW3QsAY8q/Ea4fmrDRy9k=; b=Ph0W53cG+XqEnZfvkThAKtxkcFYZVd53PDiaLH3sT3aSl50rZQNKm1fqpNQUA4dhWb fn89fNYq6teV6z9J3LOalOTyQnHwUtaaTfYkbyIQPY56XKd1t7lEUtmIWxAH5fj4i9rH RaNEi8tof7dyjXXd28Iie0Hftnu9fJeajLO2MWW5Pt1vY09yeVGQazpRoLYHTVCcMjUV 8rMkpX810EAQ7hUenj6Cmeq2yEK4cBlFkgU7hp8TLmrCjv9RLTAxR+hq958sjWJe6WSa 9Mrcyqd+3KCz7yAKvYx5E1eSlewfPGnOS7+KlO0ScToIuYYBEyOgp6i+bJ0KQypNrzjC DKow== X-Received: by 10.194.232.230 with SMTP id tr6mr36536733wjc.21.1448292666737; Mon, 23 Nov 2015 07:31:06 -0800 (PST) Received: from [192.168.0.147] ([93.188.182.58]) by smtp.googlemail.com with ESMTPSA id bg10sm13759568wjb.46.2015.11.23.07.31.05 for (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Nov 2015 07:31:05 -0800 (PST) To: internals@lists.php.net References: <56429DAB.6010005@dasprids.de> <56455965.60101@gmail.com> <5645C1E9.8000206@php.net> <5652728F.5060201@dasprids.de> Message-ID: <5653310E.406@gmail.com> Date: Mon, 23 Nov 2015 15:30:22 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <5652728F.5060201@dasprids.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Resource typehint and return type From: rowan.collins@gmail.com (Rowan Collins) Ben Scholzen 'DASPRiD' wrote on 23/11/2015 01:57: > On 13.11.2015 12:59, Bob Weinand wrote: >> The alternative is replacing the resources by proper objects, without >> methods and public properties. >> Then we could integrate it into our object hierarchy in a very >> lightweight way with proper typing. >> >> Having special syntax doesn't really improve it much... >> >> Bob > > I just looked at this again, and I don't know how I could miss this > for so long, but we already have SplFileObject. Wouldn't it make sense > to let fopen() and complementary functions use that? > I believe the blocker on just rushing to convert existing resources into objects is that there are functions like is_resource() and getttype() which will start behaving differently. Functions which accept a resource as a parameter could easily be extended to accept either a resource or an object, but anything currently returning a resource cannot be changed without declaring a breaking change. And if you're changing fgets but not fopen, you might as well just build a new API, which SplFileObject already has most of (for some reason, it appears to include fputcsv but not fputs). Regards, -- Rowan Collins [IMSoP]