|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-08-02 17:20 UTC] bwoebi@php.net
-Status: Open
+Status: Wont fix
[2015-08-02 17:20 UTC] bwoebi@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 15:00:01 2025 UTC |
Description: ------------ For PHP 5.3+ we have built a java-like scalar type encapsulation library to provide scalar type hinting. We designed the library to provide the full gamut of context related manipulations that the Java type classes do, as well. Basically, since the reserved words for the scalar types are case insensitive, our enpowered Float, Int, String, etc. classes aren't allowed, which would mean a full rewrite of our libraries. int =/= Int float =/= Float string =/= String Test script: --------------- <?php class Float { public $value; public function __construct (float $float) { $this->value = $float; } public function multiply(float $float): Float { $val = (float) $this->value * $float; return new Float($val); } } $val1 = new Float(2.5); echo $val1->multiply(3.2)->value; Expected result: ---------------- Output: 8 Actual result: -------------- Fatal error: Cannot use 'Float' as class name as it is reserved in /var/www/clients/client1/web1/web/test/test.php on line 2