php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #63837 Privater abstract functions
Submitted: 2012-12-22 19:47 UTC Modified: 2013-01-26 11:12 UTC
From: larry at ldrutlege dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.4.10 OS:
Private report: No CVE-ID: None
 [2012-12-22 19:47 UTC] larry at ldrutlege dot com
Description:
------------
From the page http://php.net/manual/en/migration51.oop.php


"Abstract private methods were supported between PHP 5.0.0 and PHP 5.0.4, but were then disallowed on the grounds that the behaviours of private and abstract are mutually exclusive."


This was true in PHP 5.3 and earlier since any method declared abstract private could not be accessed outside the declaring class and so the definition was without function.

In PHP 5.4 and later however, traits may have access to private methods of a class and so an abstract private definition may have a purpose. For instance, traits may have need of helper methods which may be needed only by the trait's methods and nowhere else. In those cases, an abstract private method may be the appropriate declaration to place in the trait to ensure the helper method is defined in the using class.

Abstract private methods however remain useless except within traits, so within traits is the only place they need to be permitted.

And as an aside, the word "behaviors" is misspelled on that page.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-12-22 19:51 UTC] larry at ldrutlege dot com
Actually not misspelled per se, but spelled according to British spelling whereas the English site seems to primarily use American spelling.
 [2013-01-26 11:12 UTC] krakjoe@php.net
-Status: Open +Status: Not a bug
 [2013-01-26 11:12 UTC] krakjoe@php.net
The page referenced concerns migration from 5.0 to 5.1

None of this is relevant.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 01 19:01:31 2024 UTC