Created
July 7, 2014 22:34
-
-
Save Hypnopompia/882fef819c919559eebb to your computer and use it in GitHub Desktop.
namespaces and typehinting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace foo; | |
class Foobar { | |
public function foo (\boolean $barf) { // Catchable fatal error: Argument 1 passed to foo\Foobar::foo() must be an instance of boolean, boolean given | |
echo $barf ? "yep" : "nope"; | |
} | |
public function bar (boolean $barf) { // Catchable fatal error: Argument 1 passed to foo\Foobar::bar() must be an instance of foo\boolean, boolean given | |
echo $barf ? "yep" : "nope"; | |
} | |
} | |
$foobar = new Foobar(); | |
$foobar->foo(true); | |
$foobar->bar(true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment