PHP Classes
Icontem

Class: Type Hint Class


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Martin Alterisio  >  Type Hint Class  >  Download  >  Support forum Support forum (1)  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: Type Hint Class Support forum
Base name: typehintclass
Description: Implement type hinting support for base PHP types
Related top rated classes: ,
Version: 1.0.0
Required PHP version: 5.1
License: GNU Lesser General Public License (LGPL)
All time users: 602 users
All time rank: 3361
Week users: 5 users
Week rank: 1471
 
  Author   Group folder image Groups   Detailed description  
  Rate classes User ratings   Dependents   Trackback   Applications   Files Files  

Author

Picture of Martin Alterisio
Name: Martin Alterisio <e-mail contact>
Published packages: 5 Browse this author's classes Browse this author's classes
Country: Argentina Argentina - PHP jobs in Argentina
Home page: http://mundogris.wordpress.com/
Age: 26
All time rank: 714
Week rank: 590

Innovation Award

PHP Programming Innovation award nominee
November 2007
Number 3
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

Groups

Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Language Constructs to assist in the language control View top rated classes

Detailed description

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.

User ratings

Ratings
Utility
Consistency
Documentation
Examples
Tests
Videos
Overall
Rank
All time:
Perfect (100.0%)
Good (83.3%)
-
Good (83.3%)
-
-
Sufficient (66.7%)
306
Month:
Not yet rated by the users

Packages that need this class

Class Dependency Why it is needed
Generic Array
Recommended
Nice addition to create arrays of native types (eg: ArrayOfInt)

Trackback links

Link Description
10 Tipps für sichere Software Wie zuvor schon am letzten Tag des Monats 10 nützliche Tipps für Anfänger und Fortgeschrittene....

Applications that use this class

No application links were specified for this class.
Add link image If you know an application of this package, send a message to the author to add a link here.

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.
Download all files: typehintclass.tar.gz typehintclass.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products