Re: [PHP] Seemingly incorrect strict standard.

[email protected] (Matijn Woudt)
Newsgroups php.general
Message-ID <CAC_gtuOLEEfNo6CC3a4BiVQ0cQsbdpRbrcwN5XWO1e4nBxpt9A@mail.gmail.com>
On Mon, Jun 3, 2013 at 7:24 PM, Richard Quadling <[email protected]>wrote:

> Hi.
>
> I've got an abstract class which requires one of the concrete descendants
> to implement a static function.
>
> The base class will call it using static:: rather than self::.
>
> But I'm getting an error at runtime.
>
> Static function should not be abstract.
>
> It doesn't SEEM right to inhibit this.
>
> Am I missing something?
>
> I'm on PHP 5.4.15 (Mac and Centos).
>
>
Hi Richard,

This change is done on purpose.
From the PHP manual:
"Dropped abstract static class functions. Due to an oversight, PHP 5.0.x
and 5.1.x allowed abstract static functions in classes. As of PHP 5.2.x,
only interfaces can have them."

I believe you could make yourself in trouble when using it, and that's why
there is a warning with strict.

It does make sense, because overloading is something that works on classes,
and static functions do not reference classes.

- Matijn
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.