summaryrefslogtreecommitdiff
path: root/Zend/tests/return_types
Commit message (Collapse)AuthorAgeFilesLines
* Rename zend-test to zend_testNikita Popov2021-01-193-3/+3
| | | | | | | | | | | The extension name should match the name of the ext/ directory, otherwise it will not get picked up by run-tests. It would be possible to remap this in run-tests, but I think it's better to rename the extension to follow the standard format. Other extensions also use underscore instead of hyphen (e.g. pdo_mysql and not pdo-mysql). Of course, the ./configure option remains hyphenated. Closes GH-6613.
* Don't disable opcache for generic testsNikita Popov2020-11-043-6/+0
| | | | | Even if the original issue only reproduces without opcache, we should still allow running them with and without opcache.
* Run tidyNikita Popov2020-09-183-3/+3
| | | | | This should fix most of the remaining issues with tabs and spaces being mixed in tests.
* Add many missing closing PHP tags to testsMáté Kocsis2020-08-0943-0/+43
| | | | Closes GH-5958
* Ensure correct signatures for magic methodsGabriel Caruso2020-08-0213-2/+158
|
* JIT internal functions with return type in debug modeNikita Popov2020-07-271-0/+2
| | | | | | | | | The return type check is just a debug assertion, it's okay if it is not performed in JIT mode. We already don't perform all the argument validation in that case. Just disable the one test that checks for this. This removes an annoying discrepancy between debug&release mode.
* Unify magic method return type checksNikita Popov2020-07-202-2/+2
|
* Improve type error messages when an object is givenMáté Kocsis2020-05-2615-16/+16
| | | | | | | From now on, we always display the given object's type instead of just reporting "object". Additionally, make the format of return type errors match the format of argument errors. Closes GH-5625
* Allow generators to have a real return type of `mixed` or `object`Tyson Andre2020-05-263-3/+33
| | | | | | | | | | Fixes an edge case overlooked in https://github.com/php/php-src/pull/5313 Generators are objects, so `object` should have also been allowed in addition to `iterable` and `Traversable` Closes GH-5626
* Make type error messages more consistentMáté Kocsis2020-02-1715-15/+15
| | | | Closes GH-5092
* Reindent phpt filesNikita Popov2020-02-0312-31/+31
|
* Implement union typesNikita Popov2019-11-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | According to RFC: https://wiki.php.net/rfc/union_types_v2 The type representation now makes use of both the pointer payload and the type mask at the same time. Additionall, zend_type_list is introduced as a new kind of pointer payload, which is used to store multiple class types. Each of the class types is a tagged pointer, which may be either a class name or class entry. The latter is only used for typed properties, while arguments/returns will instead use cache slots. A type list can contain a mix of both names and CEs at the same time, as not all classes may be resolvable. One thing this is missing is support for union types in arginfo and stubs, which I want to handle separately. I've also dropped the special object code from the JIT implementation for now -- I plan to add this back in a different form at a later time. For now I did not want to include non-trivial JIT changes together with large functional changes. Another possible piece of follow-up work is to implement "iterable" as an internal alias for "array|Traversable". I believe this will eliminate quite a few special-cases that had to be implemented. Closes GH-4838.
* Merge branch 'PHP-7.4'Nikita Popov2019-07-221-1/+1
|\
| * Deprecate Reflection export() methodsNikita Popov2019-07-221-1/+1
| | | | | | | | And remove the Reflector::export() interface method.
* | Merge branch 'PHP-7.4'Nikita Popov2019-05-245-12/+28
|\ \ | |/
| * Implement basic variance supportNikita Popov2019-05-245-12/+28
| | | | | | | | | | | | | | This is a minimal variance implementation: It does not support any cyclic type dependencies. Additionally the preloading requirements are much more restrictive than necessary. Hopefully we can relax these in the future.
* | Always generate fatal error for LSP failuresNikita Popov2019-05-071-9/+1
| | | | | | | | RFC: https://wiki.php.net/rfc/lsp_errors
* | Merge branch 'PHP-7.4'Nikita Popov2019-03-277-7/+7
|\ \ | |/
| * Make line numbers for inheritance errors more preciseNikita Popov2019-03-277-7/+7
| | | | | | | | | | Use the line of the conflicting child method, rather than either the first or last line of the class.
* | Remove support for legacy constructorsNikita Popov2019-01-291-12/+0
|/ | | | | This has been deprecated in PHP 7.0 by https://wiki.php.net/rfc/remove_php4_constructors.
* Sync leading and final newlines in *.phpt sectionsPeter Kokot2018-10-1547-95/+2
| | | | | | | | | | | | | | | | | | | | | | | This patch adds missing newlines, trims multiple redundant final newlines into a single one, and trims redundant leading newlines in all *.phpt sections. According to POSIX, a line is a sequence of zero or more non-' <newline>' characters plus a terminating '<newline>' character. [1] Files should normally have at least one final newline character. C89 [2] and later standards [3] mention a final newline: "A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character." Although it is not mandatory for all files to have a final newline fixed, a more consistent and homogeneous approach brings less of commit differences issues and a better development experience in certain text editors and IDEs. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206 [2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2 [3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
* Trim trailing whitespace in *.phptPeter Kokot2018-10-141-1/+1
|
* Sync leading and final newlines in source code filesPeter Kokot2018-10-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | This patch adds missing newlines, trims multiple redundant final newlines into a single one, and trims redundant leading newlines. According to POSIX, a line is a sequence of zero or more non-' <newline>' characters plus a terminating '<newline>' character. [1] Files should normally have at least one final newline character. C89 [2] and later standards [3] mention a final newline: "A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character." Although it is not mandatory for all files to have a final newline fixed, a more consistent and homogeneous approach brings less of commit differences issues and a better development experience in certain text editors and IDEs. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206 [2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2 [3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
* Give a reason why the test was skippedGabriel Caruso2018-07-303-3/+3
|
* Add test for void return type on internal functionNikita Popov2018-06-301-0/+11
|
* Use EXPECT instead of EXPECTF when possibleGabriel Caruso2018-02-203-3/+3
| | | | EXPECTF logic in run-tests.php is considerable, so let's avoid it.
* Use int instead of integer in type errorsGabriel Caruso2018-02-044-4/+4
| | | | | | | PHP requires integer typehints to be written "int" and does not allow "integer" as an alias. This changes type error messages to match the actual type name and avoids confusing messages like "must be of the type integer, integer given".
* Remove superfluous SKIPIF sections in Zend testsGabriel Caruso2018-02-031-5/+1
|
* Use %d when expecting line number in testsGabriel Caruso2018-02-024-4/+4
|
* zend-test extension to house code that is required for testing internal ↵Nikita Popov2017-03-122-15/+10
| | | | APIs, but that we would not want to expose for regular builds
* Remove obsolete version checks from testsNikita Popov2017-02-021-5/+2
|
* Revert "Reorder the oplines" (Break Zend/tests/return_types/bug71092.phpt)Xinchen Hui2016-12-211-3/+8
| | | | This reverts commit a12f43ee2c3d27a7eb9a3c873901643df5f7197e.
* Reorder the oplinesXinchen Hui2016-12-171-8/+3
| | | | | | | | | 1. we should only do the return type checking when it is really about to return 2. for 029.php, actually, the exception threw should be discard while it jmp into finally(it could be observed by change the return to return an array) 3. after this fix, the test 029.phpt behavior consistently with 7.0 4. good for optimizer too
* Show "or null" in TypeErrors for nullable arg_infosAndrea Faulds2016-08-111-1/+1
|
* Merge branch 'master' into iterableAaron Piotrowski2016-07-033-5/+5
|\
| * More explicit errors for return; vs return null;Nikita Popov2016-06-041-1/+1
| | | | | | | | | | Both for "return null" in a void function and "return" in a nullable return function.
| * Forbid "return;" for typed returns already at compile-timeNikita Popov2016-06-042-4/+4
| | | | | | | | | | These would otherwise generate a "none returned" error at runtime. Catch them early.
* | Fix generator test; add covariance testsAaron Piotrowski2016-06-041-1/+1
|/
* Fixed bug #72213 (Finally leaks on nested exceptions).Dmitry Stogov2016-05-251-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Squashed commit of the following: commit 8461b0407fc9eab0869d43b84e6a92ba2fe06997 Author: Dmitry Stogov <dmitry@zend.com> Date: Wed May 25 00:34:42 2016 +0300 Rmoved zend_try_catch_element.parent and walk through op_array.try_catch_array backward from the current try_cacth_offset. commit 0c71e249649bed178bfbef30bb3e63c57f07af05 Author: Dmitry Stogov <dmitry@zend.com> Date: Wed May 25 00:04:53 2016 +0300 Move SAVE_OPLINE() to its original place commit 111432a4df738fcd65878a42f23194dc3c4983a2 Author: Dmitry Stogov <dmitry@zend.com> Date: Wed May 25 00:01:10 2016 +0300 Separate the common part of ZEND_HANDLE_EXCEPTION and FAST_RET into zend_dispatch_try_catch_finally_helper. commit 4f21c06c2ec17819a708bc037f318784554a6ecd Author: Nikita Popov <nikic@php.net> Date: Tue May 24 14:55:27 2016 +0200 Improve finally fix commit da5c7274997b8308e682b5bf280124e3a1483086 Author: Dmitry Stogov <dmitry@zend.com> Date: Tue May 24 10:36:08 2016 +0300 Fixed Zend/tests/try/bug70228_3.phpt and Zend/tests/try/bug70228_4.phpt commit cfcedf2fb4f4fc1f7de9f7d53a3037fed7795f19 Author: Dmitry Stogov <dmitry@zend.com> Date: Tue May 24 02:59:27 2016 +0300 Added test commit 4c6aa93d43da941eb4fda15b48154bfb104bdc04 Author: Dmitry Stogov <dmitry@zend.com> Date: Tue May 24 00:38:20 2016 +0300 Added tests commit 8a8f4704b0eca2e460d42c1f253a363b0db8e510 Author: Dmitry Stogov <dmitry@zend.com> Date: Mon May 23 23:27:34 2016 +0300 Fixed bug #72213 (Finally leaks on nested exceptions)
* Implement nullable return types.Dmitry Stogov2016-05-053-0/+51
|
* Merge branch 'PHP-7.0'Dmitry Stogov2016-04-061-0/+21
|\ | | | | | | | | * PHP-7.0: Fixed bug #71978 (Existence of return type hint affects other compatibility rules)
| * Fixed bug #71978 (Existence of return type hint affects other compatibility ↵Dmitry Stogov2016-04-061-0/+21
| | | | | | | | rules)
* | Merge branch 'PHP-7.0'Julien Pauli2015-12-243-3/+3
|\ \ | |/ | | | | | | * PHP-7.0: Remove mentions of "type hint" and "typehint"
| * Remove mentions of "type hint" and "typehint"Levi Morrison2015-12-243-3/+3
| |
* | Merge branch 'PHP-7.0'Xinchen Hui2015-12-112-0/+46
|\ \ | |/ | | | | | | Conflicts: NEWS
| * Fixed bug #71092 (Segmentation fault with return type hinting)Xinchen Hui2015-12-112-0/+46
| |
* | Add void return typeAndrea Faulds2015-11-184-0/+52
|/
* Fixed Bug #70557 (Memleak on return type verifying failed)Xinchen Hui2015-09-231-0/+19
|
* Fixed bug #70548 (Redundant information printed in case of uncaught engine ↵Xinchen Hui2015-09-231-1/+1
| | | | exception)
* Squashed commit of the following:Dmitry Stogov2015-07-103-88/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 03cf871f1576f08b2348c141b209894a7bf17a86 Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jul 10 02:45:31 2015 +0300 Revert "Fixed bug #62210 (Exceptions can leak temporary variables. As a part of the fix serious refactoring was done. op_array->brk_cont_array was removed, and replaced with more general and speed efficient op_array->T_liveliness. ZEND_GOTO opcode is always replaced by ZEND_JMP at compile time). (Bob, Dmitry, Laruence)" This reverts commit 5ee841325901a4b040cfea56292a24702fe224d9. commit 285a68227ce3d380e821a24fa389aa5239bd3fe1 Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jul 10 02:45:26 2015 +0300 Revert "Tuned off dubugging of live ranges" This reverts commit 404dc93d35f7061fc4b1b41ad6cb0721b9b52bcc. commit 93d9d11157301ee2ec99afb6f5744b126d17f637 Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jul 10 02:45:17 2015 +0300 Revert "Remove loop_var_stack" This reverts commit b3a4c05071c3786e27e1326fa1b4d5acad62fccd. commit ede68ebbc284aec79e3f719f2c8dbf9da6907752 Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jul 10 02:45:12 2015 +0300 Revert "ZEND_SEPARATE reuses temporaries" This reverts commit 1852f538b9f8d5e7d67fe5a4f6080396d8b10034. commit 96d8995dc1f517fb01b481736273767509f76c47 Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jul 10 02:45:10 2015 +0300 Revert "Add assertion in liveliness computation" This reverts commit ed14019e8c0c852480eebc6fc552d8c3d939dce1. commit 0649d7bfef152e6cc8e67b922534e9946c634d9c Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jul 10 02:45:07 2015 +0300 Revert "Fixed invalid live-range detection" This reverts commit 54f367ee2a2e4cb7c952b17915c226fdc56038ab. commit dfe8f3851f6b04595eb089323e3492115a59363e Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jul 10 02:45:04 2015 +0300 Revert "Add test guaranteeing that loop vars are only freed after potential return type exceptions" This reverts commit f5db5a558d550bf441373febebbb02f3884209d1. commit 52a94aad6f48a199358cc07f7e4f56bb73050504 Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jul 10 02:45:01 2015 +0300 Revert "Fixed exception habdling on "return" statement." This reverts commit 17c5315bdf8f8087979aeb55f6d3a512ba197cf5. commit 6e90ad7331901711e89c2ceb2bcab5023e5cee60 Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jul 10 02:44:58 2015 +0300 Revert "Fix too early terminated temporary range with break/cont/goto" This reverts commit cc876c04b420589cb1f62b650d0c0e24975dd4af. commit 7b766e44b1970e4031f75109c302c07ead2c05cb Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jul 10 02:44:55 2015 +0300 Revert "Fixed exception catching on break/continue" This reverts commit 8c3f701eebfa92d761bb368cfa8c2d1ccf821b9d.