Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gabrieljmj/phptypehinting
Quick fix for type hinting
https://github.com/gabrieljmj/phptypehinting
Last synced: about 2 months ago
JSON representation
Quick fix for type hinting
- Host: GitHub
- URL: https://github.com/gabrieljmj/phptypehinting
- Owner: gabrieljmj
- License: other
- Created: 2015-04-18T06:35:49.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-18T20:43:05.000Z (over 9 years ago)
- Last Synced: 2024-05-09T23:08:59.771Z (8 months ago)
- Language: PHP
- Size: 125 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
TypeHinting
===========
Quick fix for type hinting with PHP.## Install
Composer:
```json
"gabrieljmj/phptypehinting": "dev-master"
```## Usage
```php
use Gabrieljmj\PhpTypeHinting\TypeHinting;TypeHinting::init();
function hello(string $name) {
echo 'Hello ' . $name;
}hello('Gabriel');
```will return
```
Hello Gabriel
```
but
```php
hello(87);
```
will get
```
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Argument 1 passed to hello() must be string type, integer given' ...
```