Created
February 15, 2018 14:46
-
-
Save telless/657df088cdf3eff026a5247c85cc8481 to your computer and use it in GitHub Desktop.
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 | |
class FooParent | |
{ | |
} | |
class Foo extends FooParent | |
{ | |
} | |
class FooChild extends Foo | |
{ | |
} | |
class Bar | |
{ | |
public function func(Foo $test): Foo | |
{ | |
// implementation | |
} | |
} | |
class BarBadChild extends Bar | |
{ | |
public function func(FooChild $test, int $yetAnotherBadArgument): FooParent | |
{ | |
// implementation | |
} | |
} | |
class BarGoodChild extends Bar | |
{ | |
public function func(FooParent $test, int $yetAnotherGoodArgument = null): FooChild | |
{ | |
// implementation | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment