-
-
Save cursosdesarrolloweb/6c47f4ffd2f0e7a29106df84206df521 to your computer and use it in GitHub Desktop.
This file contains 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 | |
class Foo { | |
public function run(): string { | |
return __CLASS__; | |
} | |
} | |
class Bar { | |
public function run(): string { | |
return __CLASS__; | |
} | |
} | |
class FooBar { | |
public function execute(Foo|Bar $executable): string|int { | |
return $executable->run(); | |
} | |
} | |
$fooBar = new FooBar; | |
echo $fooBar->execute(new Foo); | |
echo $fooBar->execute(new Bar); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment