php.net |  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
35 - 11 = ?
Subscribe to this entry?

 
 [2011-04-14 14:52 UTC] david at grudl dot com
Description:
------------
class_alias() is not taken into account by type hints.

Test script:
---------------
<?php

class A
{
	function foo(A $param) {
	}

}

class_alias('A', 'AliasA');

eval(' 
	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() 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-04-14 15:25 UTC] felipe@php.net
-Status: Open +Status: Bogus
 [2011-04-14 15:25 UTC] felipe@php.net
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: Fri Apr 26 05:01:30 2024 UTC