I have a stupid question. I want to learn PHP after 2-3 years of C#.
And like in C#
public enum SimpleEnum{
One,
Two,
Three
}
public interface ISimple
{
int Id;
SimpleEnum SimpleType;
}
What I did in PHP:
final class SimpleEnum {
const ONE = 1;
const TWO = 2;
const THREE = 3;
}
interface ISimple {
public $value1;
SimpleEnum $myEnum;
}
But the error occurred from SimpleEnum in ISimple.
Maybe is not possible but I want to ask you how to use SimpleEnum as type in interface ?
Thank you
Not possible but if you need $myEnum to specifically be SimpleEnum, then just require it in the contract (interface) so any exhibiting classes will HAVE TO follow suit. You can do this by type-hinting