summaryrefslogtreecommitdiff
path: root/ext/reflection
Commit message (Collapse)AuthorAgeFilesLines
* Implement enumsIlija Tovilo2021-03-1721-13/+876
| | | | | | | | RFC: https://wiki.php.net/rfc/enumerations Co-authored-by: Nikita Popov <nikita.ppv@gmail.com> Closes GH-6489.
* Merge branch 'PHP-8.0'Felipe Pena2021-02-251-0/+9
|\
| * Merge branch 'PHP-7.4' into PHP-8.0Felipe Pena2021-02-251-0/+9
| |\
| | * Fix memleak on ReflectionFunction and ReflectionGenerator classes when ↵Felipe Pena2021-02-251-0/+9
| | | | | | | | | | | | calling __construct after instantiation
* | | Generate class entries from stubs for com, standard, xmlreader, xmlwriter, ↵Máté Kocsis2021-02-221-5/+5
| | | | | | | | | | | | | | | | | | xsl, zip, Zend Closes GH-6706
* | | Fix static variable behavior with inheritanceNikita Popov2021-02-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a method is inherited, the static variables will now always use the initial values, rather than the values at the time of inheritance. As such, behavior no longer depends on whether inheritance happens before or after a method has been called. This is implemented by always keeping static_variables as the original values, and static_variables_ptr as the modified copy. Closes GH-6705.
* | | Improve class entry generationMáté Kocsis2021-02-161-20/+19
| | | | | | | | | | | | Related to GH-6701
* | | Used typed properties for reflection $name and $classNikita Popov2021-02-153-44/+32
| | | | | | | | | | | | | | | These are read-only properties, and Reflection makes sure to assign only strings.
* | | Generate class entries from stubs for phar, posix, pspell, readline, ↵Máté Kocsis2021-02-153-91/+340
| | | | | | | | | | | | | | | | | | reflection, session, shmop Closes GH-6692
* | | Deprecate passing null to non-nullable arg of internal functionNikita Popov2021-02-1112-16/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This deprecates passing null to non-nullable scale arguments of internal functions, with the eventual goal of making the behavior consistent with userland functions, where null is never accepted for non-nullable arguments. This change is expected to cause quite a lot of fallout. In most cases, calling code should be adjusted to avoid passing null. In some cases, PHP should be adjusted to make some function arguments nullable. I have already fixed a number of functions before landing this, but feel free to file a bug if you encounter a function that doesn't accept null, but probably should. (The rule of thumb for this to be applicable is that the function must have special behavior for 0 or "", which is distinct from the natural behavior of the parameter.) RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg Closes GH-6475.
* | | Added Inheritance Cache.Dmitry Stogov2021-02-091-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a new transparent technology that eliminates overhead of PHP class inheritance. PHP classes are compiled and cached (by opcahce) separately, however their "linking" was done at run-time - on each request. The process of "linking" may involve a number of compatibility checks and borrowing methods/properties/constants form parent and traits. This takes significant time, but the result is the same on each request. Inheritance Cache performs "linking" for unique set of all the depending classes (parent, interfaces, traits, property types, method types involved into compatibility checks) once and stores result in opcache shared memory. As a part of the this patch, I removed limitations for immutable classes (unresolved constants, typed properties and covariant type checks). So now all classes stored in opcache are "immutable". They may be lazily loaded into process memory, if necessary, but this usually occurs just once (on first linking). The patch shows 8% improvement on Symphony "Hello World" app.
* | | Avoid modification of trait infoDmitry Stogov2021-01-191-2/+23
| | |
* | | Replace zend_bool uses with boolNikita Popov2021-01-151-23/+23
|/ / | | | | | | | | | | | | We're starting to see a mix between uses of zend_bool and bool. Replace all usages with the standard bool type everywhere. Of course, zend_bool is retained as an alias.
* | Fix buildChristoph M. Becker2021-01-011-1/+1
| | | | | | | | We cannot `RETURN_THROWS()` here, since `return_value` is not defined.
* | Use RETURN_THROWS() in a few placesMáté Kocsis2021-01-011-3/+3
| |
* | Fix ReflectionClass::getConstants() stubChristoph M. Becker2021-01-013-4/+3
| | | | | | | | | | | | | | If `zval_update_constant_ex()` fails, an exception has already been thrown, so we clarify that in the implementation as well. Closes GH-6557.
* | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-11-242-2/+20
|\ \ | |/ | | | | | | * PHP-7.4: Fix usage of casted string in ReflectionParameter ctor
| * Fix usage of casted string in ReflectionParameter ctorNikita Popov2020-11-242-2/+20
| | | | | | | | Fixes oss-fuzz #27755.
* | Fixed bug #80370: Segmentation fault reflecting attributes of dynamic propertyBenjamin Eberlei2020-11-172-0/+21
| | | | | | | | Closes GH-6428.
* | Fix reflection getDefaultValue() with user arg infoNikita Popov2020-11-122-1/+17
| | | | | | | | | | The default value is part of the op_array in that case, but we have no way to access it. Fail gracefully.
* | FIxed bug #80299Nikita Popov2020-10-301-0/+15
| | | | | | | | The must_wrap was leaking across iterations.
* | Revert "Make ReflectionUnionType final"Nikita Popov2020-10-263-3/+2
| | | | | | | | | | | | | | This reverts commit ef6adb4e27853eb19bf50bad6486311920d6af7b. Per Ondrej's comment, this is already being used by BetterReflection adaptors, ugh.
* | Make ReflectionUnionType finalMáté Kocsis2020-10-253-2/+3
| | | | | | | | Closes GH-6384
* | Require stubs to declare return types for magic methods when possibleMáté Kocsis2020-10-233-146/+148
| | | | | | | | Closes GH-6376
* | don't display default value for variadicRemi Collet2020-10-072-2/+2
| |
* | Fixed bug #80190Nikita Popov2020-10-062-0/+70
| |
* | Update ext/standard parameter namesNikita Popov2020-09-291-1/+1
| | | | | | | | Closes GH-6214.
* | Make the $filter parameter of ReflectionClass::get*Constants() nullableMáté Kocsis2020-09-294-15/+23
| |
* | Reflection param renames amendmentMáté Kocsis2020-09-293-11/+9
| | | | | | | | Closes GH-6230
* | Honor strict_types=1 for attributes, improve backtracesNikita Popov2020-09-271-15/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make ReflectionAttribute::newInstance() respect the strict_types=1 declaration at the attribute use-site. More generally, pretend that we are calling the attribute constructor from the place where the attribute is used, which also means that the attribute location will show up properly in backtraces and inside "called in" error information. This requires us to store the attributes strict_types scope (as flags), as well as the attribute line number. The attribute filename can be recovered from the symbol it is used on. We might want to expose the attribute line number via reflection as well. See also https://externals.io/message/111915. Closes GH-6201.
* | Add support for `@implementation-alias` in stubsMáté Kocsis2020-09-212-9/+9
| | | | | | | | Closes GH-6170
* | Consolidate the usage of "either" and "one of" in error messagesMáté Kocsis2020-09-202-2/+2
| | | | | | | | Closes GH-6173
* | Run tidyNikita Popov2020-09-182-4/+4
| | | | | | | | | | This should fix most of the remaining issues with tabs and spaces being mixed in tests.
* | Check `ReflectionReference::fromArrayElement` with union typesGabriel Caruso2020-09-154-16/+15
| | | | | | | | | | | | | | ReflectionReference::fromArrayElement(array $array, int|string $key): ?ReflectionReference is going to be its official signature for PHP 8.0. Closes GH-5651
* | Update array parameter names for named parametersLarry Garfield2020-09-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * The array "subject" of a function gets called $array. * Further parameters should be self-descriptive if used as a named parameter, and a full word, not an abbreviation. * If there is a "bunch more arrays" variadic, it gets called $arrays (because that's what was already there). * A few functions have a variadic "a bunch more arrays, and then a callable", and were already called $rest. I left those as is and died a little inside. * Any callable provided to an array function that acts on the array is called $callback. (Nearly all were already, I just fixed the one or two outliers.) * array_multisort() is beyond help so I ran screaming.
* | Consolidate new union type ZPP macro namesMáté Kocsis2020-09-111-7/+7
| | | | | | | | | | | | | | They will now follow the canonical order of types. Older macros are left intact due to maintaining BC. Closes GH-6112
* | Refactor ReflectionMethod::__construct()Máté Kocsis2020-09-117-71/+72
| | | | | | | | Closes GH-6098
* | Make array_multisort() signature more variadicNikita Popov2020-09-091-9/+1
| | | | | | | | | | | | | | The second and third arguments are not always the sort_order and sort_flags -- they can also be in reverse order, or be arrays altogether. Move them into the variadic parameter to avoid awkward error messages.
* | Improve error messages mentioning parameters instead of argumentsMáté Kocsis2020-09-0916-33/+33
| | | | | | | | Closes GH-5999
* | Use ZPP instead of custom type checksMáté Kocsis2020-09-045-23/+17
| | | | | | | | We can add these types as a native type declaration to stubs as a side-effect. Closes GH-6068
* | Merge branch 'PHP-7.4'Nikita Popov2020-08-312-0/+18
|\ \ | |/ | | | | | | * PHP-7.4: Fix leak on consteval exception in ReflectionClass::__toString()
| * Fix leak on consteval exception in ReflectionClass::__toString()Nikita Popov2020-08-312-0/+18
| |
* | Merge branch 'PHP-7.4'Nikita Popov2020-08-312-1/+22
|\ \ | |/ | | | | | | * PHP-7.4: Check update constant failure in ReflectionClassConstant::__toString()
| * Check update constant failure in ReflectionClassConstant::__toString()Nikita Popov2020-08-312-1/+22
| |
* | Fix fetching default value of internal function with userland arginfoNikita Popov2020-08-312-1/+20
| | | | | | | | | | | | "Fix" in the sense of "not crash". We aren't able to actually display the default value for this case, as there's no way to fetch the relevant information right now.
* | fix test expectationRemi Collet2020-08-131-1/+1
| |
* | Rename standard array function parameters to $arrayTyson Andre2020-08-111-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is targeting 8.0. `$arg` seems like a poor choice of a name, especially if the function were to have arguments added. In many cases, the php.net documentation already has $array for these functions. E.g. https://www.php.net/manual/en/function.array-intersect.php I'd assume that since named arguments was added to 8.0 near the feature freeze, PHP's maintainers had planned to make the names consistent and gradually use the same name for docs and implementation.
* | Add many missing closing PHP tags to testsMáté Kocsis2020-08-098-0/+8
| | | | | | | | Closes GH-5958
* | Accept zend_object* in zend_update_propertyNikita Popov2020-08-071-1/+1
| |
* | Accept zend_object in zend_read_propertyNikita Popov2020-08-071-1/+1
| |