Bug #81192 [Opn->Ver]: "Declaration should be compatible with" gives incorrect line number with traits

From: Date: Tue, 29 Jun 2021 01:53:40 +0000
Subject: Bug #81192 [Opn->Ver]: "Declaration should be compatible with" gives incorrect line number with traits
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234677@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81192&edit=1 ID: 81192 Updated by: twosee@php.net Reported by: iggyvolz at gmail dot com Summary: "Declaration should be compatible with" gives incorrect line number with traits -Status: Open +Status: Verified Type: Bug Package: *General Issues Operating System: Ubuntu 20.04.2 LTS PHP Version: 8.1.0alpha1 Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2021-06-22 21:44:01] iggyvolz at gmail dot com Description: ------------ When encountering a "Declaration of x must be compatible with y" error with a function used by a trait, the file number references the class while the line number references the trait. Additionally tested this on PHP 7.4 and the error persists. Test script: --------------- https://gist.github.com/iggyvolz/c1d34e3e0997d9c0b2d9d37512d872ff Expected result: ---------------- 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 Actual result: -------------- Fatal error: Declaration of myTrait::foo(): string must be compatible with a::foo(): int in .../b.php on line 19 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81192&edit=1

« previous php.bugs (#234677) next »