PHP currently does not support type hinting for function/method arguments or return values. Adding them is currently up for discussion in this PHP RFC (which lists the options) The current accepted practice is to use phpdoc comments to indicate the "contract" is present Does something. * @return int **/ public function getInteger() { return 1; } If the code violates the "contract," I suggest finding the original coder and having them fix it and/or filing a bug and/or fixing it yourself if it's in your own codebase.
PHP currently does not support type hinting for function/method arguments or return values. Adding them is currently up for discussion in this PHP RFC (which lists the options). The current accepted practice is to use phpdoc comments to indicate the "contract" is present.
/** * Does something. * @return int **/ public function getInteger() { return 1; } If the code violates the "contract," I suggest finding the original coder and having them fix it and/or filing a bug and/or fixing it yourself if it's in your own codebase.
No, there is not. You said the reason yourself: PHP is loosly typed. You can have hints in PHPDoc, or check the type in the function you use the interface's functions and throw an InvalidArgumentException if you get something else but an integer.
In and of itself what you want is not possible... In short: If you really need to enforce return types in your code contracts, use a statically typed language. But thanks to the magic of __get, __set, __call and friends, you could define a base class that enforces type safety (I wouldn't recommend this for anything other than research/playtime) but that will still not help you define type safe interfaces.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.