PHP 7 Type Hinting Issues

Viewed 1493
<?php
namespace XYZ\Model;

interface user{
public function getName() : string;
}

?>

Now, what happens is that string is assumed to be the type XYZ\Model\string and hence, any classes I make implementing the interface don't match up (in different namespaces).

If however I do a \string, the code fails with Scalar type declaration must be unqualified.

Besides, how many types of boolean can there be? After removing some hints, I got: Return value of xxxxx::save() must be an instance of boolean, boolean returned in xxxxxx.php:41

2 Answers
Related