--- /dev/null
+--TEST--
+Trying to exclude trait method multiple times
+--FILE--
+<?php
+
+trait foo {
+ public function test() { return 3; }
+}
+trait c {
+ public function test() { return 2; }
+}
+
+trait b {
+ public function test() { return 1; }
+}
+
+class bar {
+ use foo, c { c::test insteadof foo, b; }
+ use foo, c { c::test insteadof foo, b; }
+}
+
+$x = new bar;
+var_dump($x->test());
+
+?>
+--EXPECTF--
+Fatal error: Failed to evaluate a trait precedence (test). Method of trait foo was defined to be excluded multiple times in %s on line %d
--- /dev/null
+--TEST--
+Testing trait collisions
+--FILE--
+<?php
+
+trait foo {
+ public function test() { return 3; }
+}
+trait c {
+ public function test() { return 2; }
+}
+
+trait b {
+ public function test() { return 1; }
+}
+
+class bar {
+ use foo, c, b;
+}
+
+$x = new bar;
+var_dump($x->test());
+
+?>
+--EXPECTF--
+Warning: Trait method test has not been applied, because there are collisions with other trait methods on bar in %s on line %d
+
+Fatal error: Call to undefined method bar::test() in %s on line %d
--- /dev/null
+--TEST--
+Trying to access a protected trait method
+--FILE--
+<?php
+
+trait foo {
+ public function test() { return 3; }
+}
+
+class bar {
+ use foo { test as protected; }
+}
+
+$x = new bar;
+var_dump($x->test());
+
+?>
+--EXPECTF--
+Fatal error: Call to protected method bar::test() from context '' in %s on line %d
--- /dev/null
+--TEST--
+Trying to use static as method modifier
+--FILE--
+<?php
+
+trait foo {
+ public function test() { return 3; }
+}
+
+class bar {
+ use foo { test as static; }
+}
+
+$x = new bar;
+var_dump($x->test());
+
+?>
+--EXPECTF--
+Fatal error: Cannot use 'static' as method modifier in %s on line %d
--- /dev/null
+--TEST--
+Trying to override final method
+--FILE--
+<?php
+
+trait foo {
+ public function test() { return 3; }
+}
+
+class baz {
+ final public function test() { return 4; }
+}
+
+class bar extends baz {
+ use foo { test as public; }
+}
+
+$x = new bar;
+var_dump($x->test());
+
+?>
+--EXPECTF--
+Fatal error: Cannot override final method baz::test() in %s on line %d
--- /dev/null
+--TEST--
+Trying to add an alias to a trait method where there is another with same name
+--FILE--
+<?php
+
+trait foo {
+ public function test() { return 3; }
+}
+
+trait baz {
+ public function test() { return 4; }
+}
+
+class bar {
+ use foo, baz {
+ baz::test as zzz;
+ }
+}
+
+$x = new bar;
+var_dump($x->test());
+
+?>
+--EXPECTF--
+Fatal error: Failed to add aliased trait method (zzz) to trait table. Probably there is already a trait method with same name in %s on line %d