Is there a way to tell the php complier that I want a specific implicit conversion from one type to another?
A simple example:
class Integer
{
public $
PHP is not strongly typed.
You want something like, whenever you pass an hbool instance into a function that expects a bool it would convert automatically using your implicit conversor.
What happens is that no function "expects" a bool, it's all dynamically typed.
You can force an explicit conversion by calling (int)$something
but if that's the case you can then pass $something->to_otherthing()
instead for non-automatic conversions.
PS: I'm sure im not being clear here. I will try to edit this answer after I eat something :)