Jump to content

Weak type declaration for integers


NotionCommotion

Recommended Posts

Is it possible to perform type declaration which allows either an integer or a string digit (i.e. ctype-digit) instead of the following?

function someFunction(int $id){}

Looking at functions.arguments.type-declaration, I expect not.  If not, would you recommend type casting before calling the function or removing type declaration from the function and performing the check manually within the function and throwing an applicable exception?

Thanks

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.