|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-03-14 06:45 UTC] keryax at ya dot ru
Description:
------------
I've got strange error:
Catchable fatal error: Argument 1 passed to omg::lol() must be an instance of integer, integer given
When I've replaced "integer" to "int", I've got:
Catchable fatal error: Argument 1 passed to omg::lol() must be an instance of int, integer given
Test script:
---------------
class omg{
public static function lol(integer $A){
return true;
}
}
echo omg::lol(123);
Expected result:
----------------
calling the method
--
captain obvious
Actual result:
--------------
Catchable fatal error
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 23:00:02 2025 UTC |
PHP does not have scalar type hints. public static function lol(integer $A) That says that you want $A to be an instance of Class integer. That's completely distinct from the scalar integer type. Try this: class integer { } class omg{ public static function lol(integer $A){ return true; } } echo omg::lol(new integer);