-
-
Save iggyvolz/c1d34e3e0997d9c0b2d9d37512d872ff 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
Run php b.php; returns: | |
Fatal error: Declaration of myTrait::foo(): string must be compatible with a::foo(): int in .../b.php on line 19 | |
Should return something like: | |
Fatal error: Declaration of myTrait::foo(): string must be compatible with a::foo(): int in .../b.php on line 5 | |
Or: | |
Fatal error: Declaration of myTrait::foo(): string must be compatible with a::foo(): int in .../myTrait.php on line 19 | |
Or: | |
Fatal error: Declaration of myTrait::foo(): string must be compatible with a::foo(): int in .../b.php on line 5, from trait on .../myTrait.php on line 19 |
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 a { | |
public function foo(): int {return 2;} | |
} |
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 | |
require_once "a.php"; | |
require_once "myTrait.php"; | |
class b extends a { | |
use myTrait; | |
} |
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 | |
// there | |
// are | |
// some | |
// lines | |
// here | |
// to | |
// show | |
// that | |
// the | |
// error | |
// uses | |
// this | |
// file's | |
// line | |
// number | |
trait myTrait | |
{ | |
public function foo(): string {return "oops";} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment