diff options
author | MichaĆ Brzuchalski <michal.brzuchalski@gmail.com> | 2017-06-25 21:43:25 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2017-06-25 21:49:41 +0200 |
commit | 8e10c9d37398f0f3eece85fca713f19d11cdfb32 (patch) | |
tree | 5dcdd7318877b435cd09fcfaa6a692ec0bb7035c /tests | |
parent | dd15b34018db8a5ba48a79981f7915fd02092b9d (diff) | |
download | php-git-8e10c9d37398f0f3eece85fca713f19d11cdfb32.tar.gz |
Implement object type annotation
RFC: https://wiki.php.net/rfc/object-typehint
Diffstat (limited to 'tests')
-rw-r--r-- | tests/classes/array_access_001.phpt | 80 | ||||
-rw-r--r-- | tests/classes/array_access_002.phpt | 80 | ||||
-rw-r--r-- | tests/classes/array_access_003.phpt | 14 | ||||
-rw-r--r-- | tests/classes/array_access_004.phpt | 14 |
4 files changed, 94 insertions, 94 deletions
diff --git a/tests/classes/array_access_001.phpt b/tests/classes/array_access_001.phpt index feed3fb8d9..784a886126 100644 --- a/tests/classes/array_access_001.phpt +++ b/tests/classes/array_access_001.phpt @@ -2,7 +2,7 @@ ZE2 ArrayAccess --FILE-- <?php -class object implements ArrayAccess { +class ObjectOne implements ArrayAccess { public $a = array('1st', 1, 2=>'3rd', '4th'=>4); @@ -24,7 +24,7 @@ class object implements ArrayAccess { } } -$obj = new Object; +$obj = new ObjectOne; var_dump($obj->a); @@ -95,75 +95,75 @@ array(4) { int(4) } ===EMPTY=== -object::offsetExists(0) -object::offsetGet(0) +ObjectOne::offsetExists(0) +ObjectOne::offsetGet(0) bool(false) -object::offsetExists(1) -object::offsetGet(1) +ObjectOne::offsetExists(1) +ObjectOne::offsetGet(1) bool(false) -object::offsetExists(2) -object::offsetGet(2) +ObjectOne::offsetExists(2) +ObjectOne::offsetGet(2) bool(false) -object::offsetExists(4th) -object::offsetGet(4th) +ObjectOne::offsetExists(4th) +ObjectOne::offsetGet(4th) bool(false) -object::offsetExists(5th) +ObjectOne::offsetExists(5th) bool(true) -object::offsetExists(6) +ObjectOne::offsetExists(6) bool(true) ===isset=== -object::offsetExists(0) +ObjectOne::offsetExists(0) bool(true) -object::offsetExists(1) +ObjectOne::offsetExists(1) bool(true) -object::offsetExists(2) +ObjectOne::offsetExists(2) bool(true) -object::offsetExists(4th) +ObjectOne::offsetExists(4th) bool(true) -object::offsetExists(5th) +ObjectOne::offsetExists(5th) bool(false) -object::offsetExists(6) +ObjectOne::offsetExists(6) bool(false) ===offsetGet=== -object::offsetGet(0) +ObjectOne::offsetGet(0) string(3) "1st" -object::offsetGet(1) +ObjectOne::offsetGet(1) int(1) -object::offsetGet(2) +ObjectOne::offsetGet(2) string(3) "3rd" -object::offsetGet(4th) +ObjectOne::offsetGet(4th) int(4) -object::offsetGet(5th) +ObjectOne::offsetGet(5th) Notice: Undefined index: 5th in %sarray_access_001.php on line %d NULL -object::offsetGet(6) +ObjectOne::offsetGet(6) Notice: Undefined offset: 6 in %sarray_access_001.php on line %d NULL ===offsetSet=== WRITE 1 -object::offsetSet(1,Changed 1) -object::offsetGet(1) +ObjectOne::offsetSet(1,Changed 1) +ObjectOne::offsetGet(1) string(9) "Changed 1" WRITE 2 -object::offsetSet(4th,Changed 4th) -object::offsetGet(4th) +ObjectOne::offsetSet(4th,Changed 4th) +ObjectOne::offsetGet(4th) string(11) "Changed 4th" WRITE 3 -object::offsetSet(5th,Added 5th) -object::offsetGet(5th) +ObjectOne::offsetSet(5th,Added 5th) +ObjectOne::offsetGet(5th) string(9) "Added 5th" WRITE 4 -object::offsetSet(6,Added 6) -object::offsetGet(6) +ObjectOne::offsetSet(6,Added 6) +ObjectOne::offsetGet(6) string(7) "Added 6" -object::offsetGet(0) +ObjectOne::offsetGet(0) string(3) "1st" -object::offsetGet(2) +ObjectOne::offsetGet(2) string(3) "3rd" -object::offsetSet(6,changed 6) -object::offsetGet(6) +ObjectOne::offsetSet(6,changed 6) +ObjectOne::offsetGet(6) string(9) "changed 6" string(9) "changed 6" ===unset=== @@ -181,10 +181,10 @@ array(6) { [6]=> string(9) "changed 6" } -object::offsetUnset(2) -object::offsetUnset(4th) -object::offsetUnset(7) -object::offsetUnset(8th) +ObjectOne::offsetUnset(2) +ObjectOne::offsetUnset(4th) +ObjectOne::offsetUnset(7) +ObjectOne::offsetUnset(8th) array(4) { [0]=> string(3) "1st" diff --git a/tests/classes/array_access_002.phpt b/tests/classes/array_access_002.phpt index 68640c83f5..5e101914c0 100644 --- a/tests/classes/array_access_002.phpt +++ b/tests/classes/array_access_002.phpt @@ -2,7 +2,7 @@ ZE2 ArrayAccess::offsetSet without return --FILE-- <?php -class object implements ArrayAccess { +class ObjectOne implements ArrayAccess { public $a = array('1st', 1, 2=>'3rd', '4th'=>4); @@ -24,7 +24,7 @@ class object implements ArrayAccess { } } -$obj = new Object; +$obj = new ObjectOne; var_dump($obj->a); @@ -95,75 +95,75 @@ array(4) { int(4) } ===EMPTY=== -object::offsetExists(0) -object::offsetGet(0) +ObjectOne::offsetExists(0) +ObjectOne::offsetGet(0) bool(false) -object::offsetExists(1) -object::offsetGet(1) +ObjectOne::offsetExists(1) +ObjectOne::offsetGet(1) bool(false) -object::offsetExists(2) -object::offsetGet(2) +ObjectOne::offsetExists(2) +ObjectOne::offsetGet(2) bool(false) -object::offsetExists(4th) -object::offsetGet(4th) +ObjectOne::offsetExists(4th) +ObjectOne::offsetGet(4th) bool(false) -object::offsetExists(5th) +ObjectOne::offsetExists(5th) bool(true) -object::offsetExists(6) +ObjectOne::offsetExists(6) bool(true) ===isset=== -object::offsetExists(0) +ObjectOne::offsetExists(0) bool(true) -object::offsetExists(1) +ObjectOne::offsetExists(1) bool(true) -object::offsetExists(2) +ObjectOne::offsetExists(2) bool(true) -object::offsetExists(4th) +ObjectOne::offsetExists(4th) bool(true) -object::offsetExists(5th) +ObjectOne::offsetExists(5th) bool(false) -object::offsetExists(6) +ObjectOne::offsetExists(6) bool(false) ===offsetGet=== -object::offsetGet(0) +ObjectOne::offsetGet(0) string(3) "1st" -object::offsetGet(1) +ObjectOne::offsetGet(1) int(1) -object::offsetGet(2) +ObjectOne::offsetGet(2) string(3) "3rd" -object::offsetGet(4th) +ObjectOne::offsetGet(4th) int(4) -object::offsetGet(5th) +ObjectOne::offsetGet(5th) Notice: Undefined index: 5th in %sarray_access_002.php on line %d NULL -object::offsetGet(6) +ObjectOne::offsetGet(6) Notice: Undefined offset: 6 in %sarray_access_002.php on line %d NULL ===offsetSet=== WRITE 1 -object::offsetSet(1,Changed 1) -object::offsetGet(1) +ObjectOne::offsetSet(1,Changed 1) +ObjectOne::offsetGet(1) string(9) "Changed 1" WRITE 2 -object::offsetSet(4th,Changed 4th) -object::offsetGet(4th) +ObjectOne::offsetSet(4th,Changed 4th) +ObjectOne::offsetGet(4th) string(11) "Changed 4th" WRITE 3 -object::offsetSet(5th,Added 5th) -object::offsetGet(5th) +ObjectOne::offsetSet(5th,Added 5th) +ObjectOne::offsetGet(5th) string(9) "Added 5th" WRITE 4 -object::offsetSet(6,Added 6) -object::offsetGet(6) +ObjectOne::offsetSet(6,Added 6) +ObjectOne::offsetGet(6) string(7) "Added 6" -object::offsetGet(0) +ObjectOne::offsetGet(0) string(3) "1st" -object::offsetGet(2) +ObjectOne::offsetGet(2) string(3) "3rd" -object::offsetSet(6,changed 6) -object::offsetGet(6) +ObjectOne::offsetSet(6,changed 6) +ObjectOne::offsetGet(6) string(9) "changed 6" string(9) "changed 6" ===unset=== @@ -181,10 +181,10 @@ array(6) { [6]=> string(9) "changed 6" } -object::offsetUnset(2) -object::offsetUnset(4th) -object::offsetUnset(7) -object::offsetUnset(8th) +ObjectOne::offsetUnset(2) +ObjectOne::offsetUnset(4th) +ObjectOne::offsetUnset(7) +ObjectOne::offsetUnset(8th) array(4) { [0]=> string(3) "1st" diff --git a/tests/classes/array_access_003.phpt b/tests/classes/array_access_003.phpt index 3e631125e7..8924d1575f 100644 --- a/tests/classes/array_access_003.phpt +++ b/tests/classes/array_access_003.phpt @@ -4,7 +4,7 @@ ZE2 ArrayAccess::offsetGet ambiguties error_reporting=4095 --FILE-- <?php -class object implements ArrayAccess { +class ObjectOne implements ArrayAccess { public $a = array('1st', 1, 2=>'3rd', '4th'=>4); @@ -37,7 +37,7 @@ class object implements ArrayAccess { } } -$obj = new Object; +$obj = new ObjectOne; var_dump($obj[1]); var_dump($obj[2]); @@ -47,13 +47,13 @@ var_dump($obj[2]); ?> ===DONE=== --EXPECTF-- -object::offsetGet(1) +ObjectOne::offsetGet(1) string(6) "fooBar" -object::offsetGet(2) +ObjectOne::offsetGet(2) int(1) -object::offsetGet(2) +ObjectOne::offsetGet(2) -Notice: Indirect modification of overloaded element of object has no effect in %sarray_access_003.php on line 39 -object::offsetGet(2) +Notice: Indirect modification of overloaded element of ObjectOne has no effect in %sarray_access_003.php on line 39 +ObjectOne::offsetGet(2) int(1) ===DONE=== diff --git a/tests/classes/array_access_004.phpt b/tests/classes/array_access_004.phpt index 787496707c..22566937f2 100644 --- a/tests/classes/array_access_004.phpt +++ b/tests/classes/array_access_004.phpt @@ -2,7 +2,7 @@ ZE2 ArrayAccess::offsetGet ambiguties --FILE-- <?php -class object implements ArrayAccess { +class ObjectOne implements ArrayAccess { public $a = array('1st', 1, 2=>'3rd', '4th'=>4); @@ -35,7 +35,7 @@ class object implements ArrayAccess { } } -$obj = new Object; +$obj = new ObjectOne; var_dump($obj[1]); var_dump($obj[2]); @@ -45,13 +45,13 @@ var_dump($obj[2]); ?> ===DONE=== --EXPECTF-- -object::offsetGet(1) +ObjectOne::offsetGet(1) string(6) "fooBar" -object::offsetGet(2) +ObjectOne::offsetGet(2) int(1) -object::offsetGet(2) +ObjectOne::offsetGet(2) -Notice: Indirect modification of overloaded element of object has no effect in %sarray_access_004.php on line 39 -object::offsetGet(2) +Notice: Indirect modification of overloaded element of ObjectOne has no effect in %sarray_access_004.php on line 39 +ObjectOne::offsetGet(2) int(1) ===DONE=== |