if only PHP had proper typehinting :(