PHP Classes

PHP Typification Class: Check the types of parameters passed to a function

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 580 All time: 5,324 This week: 660Up
Version License Categories
typevalidator 1.0GNU Free Document...Language
Description 

Author

This class can be used to check the types of the parameters passed to a function at run time.

It is meant to help detecting eventual bugs caused by passing function parameters of the wrong type.

It can take the list of function arguments values and verify whether they match a function argument type specification defined by a string.

If the type of one or more arguments does not match the expected type, the class triggers an error by dumping all the information about the class and the line of the function being called.

Innovation Award
PHP Programming Innovation award nominee
November 2005
Number 8
PHP is a loose typed language. This means that it is not required to declare types of variables and function arguments before they are used, like with strong typed languages.

While loose typed languages are more flexible, they have the inconvenient of not allowing to detect bugs caused by mistakes of passing function argument values of the wrong type.

This class provides a solution for verifying the correct type of function arguments at runtime. It can help detecting bugs that otherwise would go unnoticed.

Manuel Lemos
Picture of Dmitry Sheiko
Name: Dmitry Sheiko <contact>
Classes: 9 packages by
Country: Belarus Belarus
Age: 50
All time rank: 701 in Belarus Belarus
Week rank: 164 Down2 in Belarus Belarus Down
Innovation award
Innovation award
Nominee: 5x

Winner: 1x

  Files folder image Files (2)  
File Role Description
Accessible without login Plain text file sample.php Example Example
Plain text file typification.class.php Class Typification Class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:580
This week:0
All time:5,324
This week:660Up
User Comments (1)
Excellent
15 years ago (kishore kumar)
70%StarStarStarStar