Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow final modifier when using a method from a trait (#11394)
Fixes GH-11388. Following https://wiki.php.net/rfc/horizontalreuse which introduced traits, this should be allowed. The implementation was refactored in 3f8c729. That commit is the first time the "final" check appears AFAICT, but no reason was given for why. That commit seems to have landed in 5.4.11 and the NEWS for that version doesn't seem to mention something relevant to the behaviour change. This patch removes the restriction of the final modifier. Closes GH-11394.
- Loading branch information
Showing
5 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--TEST-- | ||
final alias - positive test variation | ||
--FILE-- | ||
<?php | ||
trait T1 { | ||
function foo() { | ||
echo "Done\n"; | ||
} | ||
} | ||
class C1 { | ||
use T1 { | ||
T1::foo as final; | ||
} | ||
} | ||
class C2 extends C1 { | ||
public function bar() {} | ||
} | ||
(new C2)->foo(); | ||
?> | ||
--EXPECT-- | ||
Done |
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