Re: [RFC Proposal] var keyword deprecation/removal
| From: | Lester Caine | Date: | Thu, 03 Mar 2016 13:18:49 +0000 |
| Subject: | Re: [RFC Proposal] var keyword deprecation/removal | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-91481@lists.php.net to get a copy of this message | ||
On 03/03/16 13:04, Rowan Collins wrote:
> Colin O'Dell wrote on 03/03/2016 12:47:
>> If you're staying on PHP 5.x or 7.0, no changes would be needed. If
>> you're
>> upgrading to 7.1+, you would need to either hide deprecation notices or
>> take 30 seconds to run that script.
>
> This isn't quite true. At the moment, PHP has no mechanism for hiding
> notices within particular libraries, so if you're using a third-party
> library, you have to either persuade the maintainer to put out a new
> release, or maintain a fork, either of which may require significant
> effort.
Additionally we ARE still having to maintain older versions of these
same libraries ...
>> My understanding is that 'var' is simply an alias for 'public' so they
>> should behave identically. Could you please provide an example where
>> 'var'
>> is not replaceable by 'public'?
>
> I'm not sure what Lester had in mind, but in many cases legacy code
> which used "var" should actually be updated to mark properties as
> "protected" or "private" instead. Such properties are public only
> because PHP4 had no other visibility, and explicitly marking them all as
> "public" simply masks the real job, which is assessing which visibility
> each property should have.
>
> It occurs to me that if I saw "var", I would not think "that should be
> public", but "that needs assessing for visibility". I do the same with
> legacy code where methods are written as "function foo()" rather than
> "public function foo()" - I check whether it should actually be public,
> and also in that case whether it should be static.
Actually my problem is even more simple than that - although it may be
possible to further filter the lookup for 'var ' ( note the space ) many
of the results are simply not text that needs changing. Many previous
changes have been possible simply with a global replaceand pick up the
odd mistake. var is simply not a candidate for that so while many
results can simply be skipped, each has to be reviewed and at that point
one may want to use something other than just public.
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk