thekid/rfc — Issue #100: RFC 0100: IllegalArgumentException for Type hints
Author: thekid
Created: 2011-10-09 15:05:40+00:00
State: open

Scope of Change
====
Methods declared with type hints will throw an IllegalArgumentException when
type mismatches occur.

Rationale
====
Fatal error prevention.

Functionality
====

What happens currently
----

```
$ php5 -r 'class Test { static function x(Object $o) { }} Test::x();'

Fatal error: Argument 1 passed to Test::x() must be an object of class
Object, called in Command line code on line 1 and defined in Command
line code on line 1

```

How to fix it
----
Prepending this:

```php

```
... to the above code will yield in an uncaught exception instead of
a fatal error.

Security considerations
====
n/a

Speed impact
====
n/a

Dependencies
====
- This RFC will bump the version number to 5.3.0

Related documents
====
- http://xp-framework.net/rfc/contrib/rfc0100.diff
Patch for lang.base.php

- http://www.derickrethans.nl/erecoverableerror.php
E_RECOVERABLE_ERROR announce

Comments
====