forked from datastax/php-driver
-
-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomersquestionFurther information is requestedFurther information is requested
Milestone
Description
I found an issue when using the Cassandra\Float class as a return type hint in PHP 8.0.9
Using the class name directly causes the following error:
PHP Fatal error: Cannot use Cassandra\Float as Float because 'Float' is a special class name
Even when aliased, the compiler still throws an error, albeit a different one:
PHP Fatal error: Cannot use 'Cassandra\Float' as class name as it is reserved
Example code
use Cassandra\Float as CassandraFloat;
class Test {
public function getFloat(float $float): CassandraFloat
{
return new CassandraFloat($float);
}
}
Removing the return type hint solves the problem, but shouldn't be required.
To be honest, this feels like it might be a PHP bug rather than an issue with the Cassandra extension, but it may be something that should be addressed here anyway; "float" is a reserved word and the class name may need to be changed to avoid issues in the future
As far as I can tell the only other "type" that might be an issue is Cassandra\Numeric, but that is only "soft" reserved
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomersquestionFurther information is requestedFurther information is requested