Why is it possible to have an interface without a return type in PHP?
- by streetparade
Why is it possible to create an interface without specifying a return type? Why doesn't this make this interface unusable?
This makes it more Clear:
Interface run
{
public function getInteger();
}
class MyString implements run
{
public function myNumber()
{
}
public function getInteger()
{
return "Not a number";
}
}
In Java every Interface has a return type like Integer, String or Void
I know that PHP is unfortunately a loosely typed Language but isn't there a Solution to that Problem?
Is it possible to define an Interface with a return type like Integer?