php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #38569 override keyword requested
Submitted: 2006-08-23 15:24 UTC Modified: 2016-07-17 16:00 UTC
Votes:9
Avg. Score:4.4 ± 0.7
Reproduced:8 of 8 (100.0%)
Same Version:3 (37.5%)
Same OS:4 (50.0%)
From: psykora at gmail dot com Assigned:
Status: Open Package: *General Issues
PHP Version: 5.1.5 OS: Irrelevant
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: psykora at gmail dot com
New email:
PHP Version: OS:

 

 [2006-08-23 15:24 UTC] psykora at gmail dot com
Description:
------------
The override keyword (f.e. like C#.NET has) could be usefull for specifing to compiler, that current method is overriding parent's class method.

Compiler then should throw Fatal Error when there is no parent's method for override.

This could resolve common mistakes when developer changes (or removes) abstract method from parent's class.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-12 19:52 UTC] michael at dmgx dot com
Agreed.  Currently I use a comment to place the word there just to help myself out visually. I.E.

public /*override*/ function foo () {}

Override shouldn't be required per se - but if used it should throw an error when the parent method doesn't exist.

BTW, this has been added to Actionscript 3 which is where I first saw it. Adobe mentions having the keyword helps out their compiler - so maybe the Zend Engine could make use of the keyword as well.
 [2012-10-26 16:12 UTC] dagguh at gmail dot com
This is a valid feature request.

If this change is implemented, the override keyword SHOULD be mandatory for 
overridden methods, but this way backwards compatibility would be broken.
 [2016-07-17 16:00 UTC] cmb@php.net
-Package: Feature/Change Request +Package: *General Issues
 [2016-07-17 16:00 UTC] cmb@php.net
> This is a valid feature request.

Albeit one that requires an RFC, see
<https://wiki.php.net/rfc/howto>.
 [2024-06-28 12:10 UTC] josh459martino at gmail dot com
Your insights are incredibly valuable and thought-provoking. Thank you for sharing such a well-written post. (https://github.com)(https://www.health-insurancemarket.com)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC