Skip to content

Commit 01ae6e9

Browse files
GH-16067: test current output
So that it is clear what changes
1 parent 531b943 commit 01ae6e9

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

Zend/tests/abstract_implicit.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Abstract methods not allowed in classes that are not abstract (GH-16067)
3+
--FILE--
4+
<?php
5+
6+
// Still allowed via trait
7+
trait TraitWithAbstract {
8+
abstract public function foo();
9+
}
10+
class TraitWorks {
11+
use TraitWithAbstract;
12+
}
13+
14+
class NotAbstract {
15+
abstract public function bar();
16+
}
17+
?>
18+
--EXPECTF--
19+
Fatal error: Class NotAbstract contains 1 abstract method and must therefore be declared abstract or implement the remaining method (NotAbstract::bar) in %s on line %d

Zend/tests/anon/gh16067.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Compiler prevents explicit `abstract` methods on anonymous classes
3+
--FILE--
4+
<?php
5+
6+
$c = new class {
7+
abstract public function f();
8+
}
9+
?>
10+
--EXPECTF--
11+
Fatal error: Class class@anonymous must implement 1 abstract method (class@anonymous::f) in %s on line 3

0 commit comments

Comments
 (0)