JOSN encoder decoder with typecast using type annotations in the phpDoc comment