PHP Classes
elePHPant
Icontem

Type Hint Class: Implement type hinting support for base PHP types

Recommend this page to a friend!
  Info   View files View files (13)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2007-10-24 (9 years ago) RSS 2.0 feedStarStarStarStar 60%Total: 772 This week: 1All time: 4,209 This week: 1,047Up
Version License PHP version Categories
typehintclass 1.0.0GNU Lesser Genera...5.1PHP 5, Language
Description Author

This package implements the support for type hinting that works with PHP base data types.

It works by replacing the current PHP error handler that performs enhanced type checking of the types of parameters when functions are called.

Several classes are provided to perform type checking of parameters of base types: boolean, float, integer, string, resource, callable.

There are additional classes for strict type checking of float and string values. These classes do not accept values of other types that could be promoted to types: integer float or string.

When the replacement error handler catches a recoverable error that corresponds to type checking mismatch, it checks the function declaration and calls the type checking class correspondent to the expected type of the parameter that triggered the error.

Innovation Award
PHP Programming Innovation award nominee
November 2007
Number 3


Prize: One copy of the Zend Studio
Type hinting is a feature introduced in PHP 5 that lets developers specify the type of the parameters expected by each function.

This way, application bugs may be detected earlier, when they pass function arguments of the wrong type.

Unfortunately, the current type hinting implementation only supports verification of parameters that are objects, and more recently arrays.

This package provides a solution to overcome this limitation by enabling also the verification of arguments of basic types like integer, string, float, etc..

This way type hinting can become more useful to detect bugs in broader range of applications with class functions that take basic type values as arguments.

Manuel Lemos
Picture of Martin Alterisio
Name: Martin Alterisio <contact>
Classes: 5 packages by
Country: Argentina Argentina
Innovation award
Innovation award
Nominee: 5x

  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file Bool.php Class Bool TypeHint
Accessible without login Plain text file Callable.php Class Callable TypeHint
Accessible without login Plain text file Float.php Class Float TypeHint
Accessible without login Plain text file Int.php Class Int TypeHint
Accessible without login Plain text file Resource.php Class Resource TypeHint
Accessible without login Plain text file StrictFloat.php Class StrictFloat TypeHint
Accessible without login Plain text file StrictInt.php Class StrictInt TypeHint
Accessible without login Plain text file StrictString.php Class StrictString TypeHint
Accessible without login Plain text file String.php Class String TypeHint
Accessible without login Plain text file TypeHint.php Class TypeHint Interface
Accessible without login Plain text file typehintclass.lib.php Aux. Library loader script.
Accessible without login Plain text file TypeHintHandler.php Class TypeHints handler.

 Version Control Reuses Unique User Downloads Download Rankings  
 0%1
Total:772
This week:1
All time:4,209
This week:1,047Up
 User Ratings  
 
 All time
Utility:89%StarStarStarStarStar
Consistency:82%StarStarStarStarStar
Documentation:-
Examples:78%StarStarStarStar
Tests:-
Videos:-
Overall:60%StarStarStarStar
Rank:1100