Roave / StrictPhp

:no_entry_sign: :sparkles: :heavy_exclamation_mark: AOP-based strict type checks for PHP
MIT License
261 stars 8 forks source link

#11 - strict public method parameter checking #20

Closed Ocramius closed 9 years ago

Ocramius commented 9 years ago

Apologies for the branch name: I'm sleepy.

This PR introduces following behavior (providing implementation for #11)

class Bar {}
class Foo {
    /** @param $foo \Bar[] */
    public function doFoo(array $foo) {}
}

This will work:

$foo = new Foo();
$foo->doFoo([]);
$foo->doFoo([new Bar, new Bar]);

This will fail:

$foo = new Foo();
$foo->doFoo([123, 456]); // crash

Tests and SoC are still to be addressed, this is just a PoC.

@malukenho please review :D

TODOs:

malukenho commented 9 years ago

:beers: