Skip to content
This repository was archived by the owner on Aug 24, 2021. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions Zend/tests/traits/bug75449.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
--TEST--
Bug #75449 (Ignored return type for abstract methods, defined in traits)
--CREDIT--
KCPHPUG TestFest 2017 - Eric Poe
--FILE--
<?php

trait T {
abstract static function values() : array;
}

class A {
use T;
static function values() : string {
return "I'm a string, not an array!";
}
}

echo A::values() . PHP_EOL;

abstract class B {
use T;
}

class C extends B {
static function values() : string {
return "I'm a string, not an array!";
}
}

echo C::values();
?>
--XFAIL--
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We won't accept XFAIL tests 😕

Bug 75449 - Currently classes that use an abstract function in a trait do not pay attention to return types (neither strict nor non-strict)
--EXPECTF--
Fatal error: Declaration of A::values(): string must be compatible with T::values(): array in %s on line %d
Fatal error: Declaration of C::values(): string must be compatible with B::values(): array in %s on line %d