Skip to content

Instantly share code, notes, and snippets.

@Hypnopompia
Created July 7, 2014 22:34
Show Gist options
  • Save Hypnopompia/882fef819c919559eebb to your computer and use it in GitHub Desktop.
Save Hypnopompia/882fef819c919559eebb to your computer and use it in GitHub Desktop.
namespaces and typehinting
<?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