|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54532 class_alias and type hint
Submitted: 2011-04-14 14:52 UTC Modified: 2011-04-19 21:48 UTC
From: david at grudl dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.3.6 OS:
Private report: No CVE-ID: None
 [2011-04-14 14:52 UTC] david at grudl dot com
class_alias() is not taken into account by type hints.

Test script:

class A
	function foo(A $param) {


class_alias('A', 'AliasA');

	class B extends A
		function foo(AliasA $param) {


Expected result:
no error

Actual result:
Strict Standards: Declaration of B::foo() should be compatible with that of A::foo() 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-04-14 15:25 UTC]
-Status: Open +Status: Bogus
 [2011-04-14 15:25 UTC]
This is an error in parsing-time, the alias in this point was not created yet... So we cannot use the alias name in the type hint.
 [2011-04-14 17:13 UTC] david at grudl dot com
No, alias was created, I have used eval(). Or put second class in extra file and 
use include, result is the same.
 [2011-04-19 21:48 UTC] david at grudl dot com
Please, re-open this bug.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 00:01:33 2024 UTC