Skip to content

Instantly share code, notes, and snippets.

@iggyvolz

iggyvolz/README Secret

Last active June 22, 2021 21:34
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 iggyvolz/c1d34e3e0997d9c0b2d9d37512d872ff to your computer and use it in GitHub Desktop.
Save iggyvolz/c1d34e3e0997d9c0b2d9d37512d872ff to your computer and use it in GitHub Desktop.
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
<?php
class a {
public function foo(): int {return 2;}
}
<?php
require_once "a.php";
require_once "myTrait.php";
class b extends a {
use myTrait;
}
<?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