php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #56621 Functionality to make a class inerit a class / implement an interface
Submitted: 2005-10-29 02:06 UTC Modified: 2011-10-27 07:16 UTC
From: sebastian@php.net Assigned: sebastian (profile)
Status: Closed Package: runkit (PECL)
PHP Version: 5_1 CVS-2005-10-29 (dev) OS: Irrelevant
Private report: No CVE-ID: None
 [2005-10-29 02:06 UTC] sebastian@php.net
Description:
------------
Two new functions that make a class inherit from another class (if it does not have a parent class, yet) and implement an interface (if it implements the required methods), respectively, would be nice.

Reproduce code:
---------------
<?php
class ParentClass {}
class ChildClass {}

runkit_inherit_class('ChildClass', 'ParentClass');

interface I {public function doSomething();}
class C {public function doSomething() {}}

runkit_implement_interface('C', 'I');
?>

Expected result:
----------------
<?php
class ChildClass extends ParentClass {}
class C implements I {public function doSomething() {}}
?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-29 17:13 UTC] pollita@php.net
http://www.php.net/runkit_class_adopt

Implementing interfaces can go on the to-do though...
 [2011-10-27 07:16 UTC] sebastian@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: sebastian
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 00:01:27 2024 UTC