Skip to content

Instantly share code, notes, and snippets.

@Danack
Created March 29, 2020 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Danack/f2ae3f3b0b75c01d48fbfe44de47d4d4 to your computer and use it in GitHub Desktop.
Save Danack/f2ae3f3b0b75c01d48fbfe44de47d4d4 to your computer and use it in GitHub Desktop.
asdasd
class A {
public function bar() : int {}
}
class B extends A {
public function bar() : void {}
}
function foo(A $bar) {
// prepare to be surprised when $bar is instance of B
$value = $bar->bar();
}
if (rand(0, 1)){
$object = new A();
}
else {
$object = new B();
}
foo($object);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment