User verified types
C PHP M4 JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
tests
.travis.yml
README.md
config.m4
config.w32
php_utypes.h
utypes.c

README.md

utypes

Build Status

utypes allows the user to hook into type verification at function entry (params) and exit (return) and handle the verification in user land.

Additionally, utypes allows the verification of a function against an interface (Functional Interfaces).

Hook

function utypes\handler(callable $handler) : bool;

Calling utypes\handler shall install the handler for the user, the prototype for the handler should be:

function (string $type, $value) : bool;

The handler should return true if execution should continue (type verification passed), or false if the engine should run normal verification.

Functional Interfaces

function utypes\verify(callable $value, string $interface) : bool;

Should be called by handler to verify that the value conforms to the interface provided: The interface should be functional (have a single method).

Examples

See tests.