diff options
Diffstat (limited to 'Zend/tests/traits')
-rw-r--r-- | Zend/tests/traits/bug60153.phpt | 2 | ||||
-rw-r--r-- | Zend/tests/traits/bug60217b.phpt | 2 | ||||
-rw-r--r-- | Zend/tests/traits/bug60217c.phpt | 2 | ||||
-rw-r--r-- | Zend/tests/traits/bugs/abstract-methods05.phpt | 2 | ||||
-rw-r--r-- | Zend/tests/traits/bugs/abstract-methods06.phpt | 2 | ||||
-rw-r--r-- | Zend/tests/traits/error_010.phpt | 8 | ||||
-rw-r--r-- | Zend/tests/traits/inheritance003.phpt | 2 | ||||
-rw-r--r-- | Zend/tests/traits/language014.phpt | 30 | ||||
-rw-r--r-- | Zend/tests/traits/language015.phpt | 17 | ||||
-rw-r--r-- | Zend/tests/traits/language016.phpt | 17 | ||||
-rw-r--r-- | Zend/tests/traits/language017.phpt | 17 | ||||
-rw-r--r-- | Zend/tests/traits/language018.phpt | 15 | ||||
-rw-r--r-- | Zend/tests/traits/language019.phpt | 15 |
13 files changed, 119 insertions, 12 deletions
diff --git a/Zend/tests/traits/bug60153.phpt b/Zend/tests/traits/bug60153.phpt index 8f01e72c2d..979eced1fb 100644 --- a/Zend/tests/traits/bug60153.phpt +++ b/Zend/tests/traits/bug60153.phpt @@ -16,4 +16,4 @@ class C implements IFoo { } --EXPECTF-- -Fatal error: Declaration of C::oneArgument() must be compatible with IFoo::oneArgument($a) in %s on line %d +Fatal error: Declaration of TFoo::oneArgument() must be compatible with IFoo::oneArgument($a) in %s on line %d diff --git a/Zend/tests/traits/bug60217b.phpt b/Zend/tests/traits/bug60217b.phpt index f03955020e..eb852a4fb4 100644 --- a/Zend/tests/traits/bug60217b.phpt +++ b/Zend/tests/traits/bug60217b.phpt @@ -23,4 +23,4 @@ $o = new CBroken; $o->foo(1); --EXPECTF-- -Fatal error: Declaration of TBroken1::foo($a) must be compatible with TBroken2::foo($a, $b = 0) in %s on line %d +Fatal error: Declaration of TBroken2::foo($a, $b = 0) must be compatible with TBroken1::foo($a) in %s on line %d diff --git a/Zend/tests/traits/bug60217c.phpt b/Zend/tests/traits/bug60217c.phpt index ce8980775f..baa4314a61 100644 --- a/Zend/tests/traits/bug60217c.phpt +++ b/Zend/tests/traits/bug60217c.phpt @@ -23,4 +23,4 @@ $o = new CBroken; $o->foo(1); --EXPECTF-- -Fatal error: Declaration of TBroken1::foo($a, $b = 0) must be compatible with TBroken2::foo($a) in %s on line %d +Fatal error: Declaration of TBroken2::foo($a) must be compatible with TBroken1::foo($a, $b = 0) in %s on line %d diff --git a/Zend/tests/traits/bugs/abstract-methods05.phpt b/Zend/tests/traits/bugs/abstract-methods05.phpt index e90ce39a32..9a1315f868 100644 --- a/Zend/tests/traits/bugs/abstract-methods05.phpt +++ b/Zend/tests/traits/bugs/abstract-methods05.phpt @@ -22,4 +22,4 @@ class TraitsTest1 { ?> --EXPECTF-- -Fatal error: Declaration of THelloB::hello() must be compatible with THelloA::hello($a) in %s on line %d
\ No newline at end of file +Fatal error: Declaration of THelloA::hello($a) must be compatible with THelloB::hello() in %s on line %d diff --git a/Zend/tests/traits/bugs/abstract-methods06.phpt b/Zend/tests/traits/bugs/abstract-methods06.phpt index 28ed672725..8569aefb38 100644 --- a/Zend/tests/traits/bugs/abstract-methods06.phpt +++ b/Zend/tests/traits/bugs/abstract-methods06.phpt @@ -23,4 +23,4 @@ class TraitsTest1 { ?> --EXPECTF-- -Fatal error: Declaration of THelloA::hello($a) must be compatible with THelloB::hello() in %s on line %d
\ No newline at end of file +Fatal error: Declaration of THelloB::hello() must be compatible with THelloA::hello($a) in %s on line %d diff --git a/Zend/tests/traits/error_010.phpt b/Zend/tests/traits/error_010.phpt index 8f3f7dddfd..de3741ea57 100644 --- a/Zend/tests/traits/error_010.phpt +++ b/Zend/tests/traits/error_010.phpt @@ -10,13 +10,9 @@ 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; } + use foo, c { c::test insteadof foo; } + use foo, c { c::test insteadof foo; } } $x = new bar; diff --git a/Zend/tests/traits/inheritance003.phpt b/Zend/tests/traits/inheritance003.phpt index a41c4e484a..22ff6e243c 100644 --- a/Zend/tests/traits/inheritance003.phpt +++ b/Zend/tests/traits/inheritance003.phpt @@ -35,4 +35,4 @@ $o->sayHello(array()); --EXPECTF-- World! -Fatal error: Declaration of MyHelloWorld::sayHello() must be compatible with Base::sayHello(array $a) in %s on line %d +Fatal error: Declaration of SayWorld::sayHello(Base $d) must be compatible with Base::sayHello(array $a) in %s on line %d diff --git a/Zend/tests/traits/language014.phpt b/Zend/tests/traits/language014.phpt new file mode 100644 index 0000000000..102b9aed41 --- /dev/null +++ b/Zend/tests/traits/language014.phpt @@ -0,0 +1,30 @@ +--TEST-- +Aliasing leading to conflict should result in error message +--FILE-- +<?php +error_reporting(E_ALL); + +trait Hello { + public function hello() { + echo 'Hello'; + } +} + +trait World { + public function world() { + echo ' World!'; + } +} + + +class MyClass { + use Hello, World { world as hello; } +} + +$o = new MyClass(); +$o->hello(); +$o->world(); + +?> +--EXPECTF-- +Fatal error: Trait method hello has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d diff --git a/Zend/tests/traits/language015.phpt b/Zend/tests/traits/language015.phpt new file mode 100644 index 0000000000..df1f744841 --- /dev/null +++ b/Zend/tests/traits/language015.phpt @@ -0,0 +1,17 @@ +--TEST-- +Invalid conflict resolution (unused trait as lhs of "insteadof") +--FILE-- +<?php +trait T1 { + function foo() {echo "T1\n";} +} +trait T2 { + function foo() {echo "T2\n";} +} +class C { + use T1 { + T2::foo insteadof T1; + } +} +--EXPECTF-- +Fatal error: Trait T2 is not used in %s on line %d diff --git a/Zend/tests/traits/language016.phpt b/Zend/tests/traits/language016.phpt new file mode 100644 index 0000000000..e9281198e5 --- /dev/null +++ b/Zend/tests/traits/language016.phpt @@ -0,0 +1,17 @@ +--TEST-- +Invalid conflict resolution (unused trait as rhs of "insteadof") +--FILE-- +<?php +trait T1 { + function foo() {echo "T1\n";} +} +trait T2 { + function foo() {echo "T2\n";} +} +class C { + use T1 { + T1::foo insteadof T2; + } +} +--EXPECTF-- +Fatal error: Trait T2 is not used in %s on line %d diff --git a/Zend/tests/traits/language017.phpt b/Zend/tests/traits/language017.phpt new file mode 100644 index 0000000000..56f9e2409c --- /dev/null +++ b/Zend/tests/traits/language017.phpt @@ -0,0 +1,17 @@ +--TEST-- +Invalid conflict resolution (unused trait as lhs of "as") +--FILE-- +<?php +trait T1 { + function foo() {echo "T1\n";} +} +trait T2 { + function foo() {echo "T2\n";} +} +class C { + use T1 { + T2::foo as private; + } +} +--EXPECTF-- +Fatal error: Trait T2 is not used in %s on line %d diff --git a/Zend/tests/traits/language018.phpt b/Zend/tests/traits/language018.phpt new file mode 100644 index 0000000000..ac36698e35 --- /dev/null +++ b/Zend/tests/traits/language018.phpt @@ -0,0 +1,15 @@ +--TEST-- +abstract alias +--FILE-- +<?php +trait T1 { + function foo() {} +} +class C1 { + use T1 { + T1::foo as abstract; + } +} +?> +--EXPECTF-- +Fatal error: Cannot use 'abstarct' as method modifier in %s on line %d diff --git a/Zend/tests/traits/language019.phpt b/Zend/tests/traits/language019.phpt new file mode 100644 index 0000000000..83318c58a2 --- /dev/null +++ b/Zend/tests/traits/language019.phpt @@ -0,0 +1,15 @@ +--TEST-- +final alias +--FILE-- +<?php +trait T1 { + function foo() {} +} +class C1 { + use T1 { + T1::foo as final; + } +} +?> +--EXPECTF-- +Fatal error: Cannot use 'final' as method modifier in %s on line %d |