1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 23:18:13 +02:00
Commit Graph

48 Commits

Author SHA1 Message Date
Máté Kocsis 7850c10389 Add support for readonly classes (#7305)
RFC: https://wiki.php.net/rfc/readonly_classes
2022-05-16 20:40:23 +02:00
Nikita Popov b0ec6223e2 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Implement Stringable automatically for internal classes
2021-11-05 10:23:23 +01:00
Nikita Popov b302bfabe7 Implement Stringable automatically for internal classes
Requiring all internal classes (including those from 3rd-party
extensions) to implement Stringable if they provide __toString()
is too error prone. Case in point, our _ZendTestClass test class
was not doing so, resulting in preloading test failures after
recent changes.

Instead we automatically implement Stringable, the same as we do
for userland classes. We still allow explicit implementations,
but ignore them (normally they would result in an error due to
duplicate interface implementation). Finally, we need to be
careful about not trying to implement Stringable on Stringable
itself.

In some cases this changes the interface order, in particular the
automatic Stringable implementation will now come first.
2021-11-05 10:22:04 +01:00
Máté Kocsis 194f1f095f Revert unintended tentative return type change
I accidentally made the return type of all Reflection*::getAttributes() methods tentative, even though they have already been declared natively.
2021-09-02 17:06:19 +02:00
Máté Kocsis 78ecd4a5f0 Declare tentative return types for ext/reflection
Closes GH-7011
2021-05-23 15:59:57 +02:00
Máté Kocsis 533a6bcb29 Get rid of private final methods (#6892) 2021-04-21 10:08:25 +02:00
Ilija Tovilo 269c8dac1d Implement enums
RFC: https://wiki.php.net/rfc/enumerations

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>

Closes GH-6489.
2021-03-17 19:08:03 +01:00
Nikita Popov 2ccf630917 Used typed properties for reflection $name and $class
These are read-only properties, and Reflection makes sure to assign
only strings.
2021-02-15 12:09:18 +01:00
Máté Kocsis 47bbfe1fc0 Require stubs to declare return types for magic methods when possible
Closes GH-6376
2020-10-23 16:33:16 +02:00
Remi Collet 91f47ee263 don't display default value for variadic 2020-10-07 16:30:18 +02:00
Máté Kocsis 351776eae5 Make the $filter parameter of ReflectionClass::get*Constants() nullable 2020-09-29 11:04:10 +02:00
Máté Kocsis 8107a1da5a Use ZPP instead of custom type checks
We can add these types as a native type declaration to stubs as a side-effect. Closes GH-6068
2020-09-04 14:32:34 +02:00
Máté Kocsis 0d330e1a02 Add a few missing parameter types in stubs
Related to GH-5627
2020-07-30 14:26:45 +02:00
Máté Kocsis 8664ff7ae1 Cleanup argument handling in ext/reflection
Closes GH-5850
2020-07-24 17:47:42 +02:00
Gabriel Caruso 7439941d55 Add $filter parameter for ReflectionClass::(getConstants|getReflectionConstants)
This solves [#79628](https://bugs.php.net/79628).

Similar to `ReflectionClass::getMethods()` and `ReflectionClass::getProperties()`,
this new `$filter` argument allows the filtering of constants defined in a class by
their visibility.

For that, we create three new constants for `ReflectionClassConstant`:

  * `IS_PUBLIC`
  * `IS_PROTECTED`
  * `IS_PRIVATE`

Closes GH-5649.
2020-06-07 15:57:48 +02:00
Benjamin Eberlei a7908c2d11 Add Attributes
Co-authored-by: Martin Schröder <m.schroeder2007@gmail.com>
2020-06-04 18:19:49 +02:00
Máté Kocsis 3709e74b5e Store default parameter values of internal functions in arg info
Closes GH-5353. From now on, PHP will have reflection information
about default values of parameters of internal functions.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-04-08 18:37:51 +02:00
Nikita Popov 184fdac7c2 Remove <default> prefix from reflection dump
This really doesn't add anything, and only makes for confusing
terminology. Only marking properties as dynamic is sufficient.
2020-04-02 11:25:41 +02:00
Nikita Popov 083b0c38a0 Display property default value in reflection dumps 2020-04-02 11:21:48 +02:00
Nicolas Grekas 9e775db025 Define Stringable with __toString():string method 2020-03-02 15:25:32 +01:00
Máté Kocsis 4f89211810 Remove the deprecated reflection export methods
Closes GH-5188
2020-02-19 13:19:37 +01:00
Christoph M. Becker 7d0102dfa7 Revert "Replace @param annotations with type declarations"
This reverts commit c31029f335.
2020-02-17 08:55:18 +01:00
Christoph M. Becker c31029f335 Replace @param annotations with type declarations 2020-02-16 23:43:38 +01:00
Thomas Gerbet c9fc076a75 Add stubs for ext-reflection 2019-10-26 12:32:12 +02:00
Nikita Popov 36db71df47 Merge branch 'PHP-7.4' 2019-07-22 12:28:40 +02:00
Nikita Popov 3121b7174f Deprecate Reflection export() methods
And remove the Reflector::export() interface method.
2019-07-22 11:39:52 +02:00
Gabriel Caruso 35db1ccdd1 Fix variadic arginfos for Reflection functions
Fix arginfos of required arguments for some Reflection methods
2019-02-10 14:29:08 -02:00
Nikita Popov d0fd2be642 Revert removal of private __clone() methods
I thought these were redundant, because we already NULL out the
clone_obj object handler. However, it turns out that reflection is
using private __clone() to determine clonability (isCloneable) for
the case where we only have a class, rather than an object.

As such, removing these methods would be a BC break.

This reverts commit e7131a4e9f.
This reverts commit 55bd88ce0d.
2019-01-14 09:19:30 +01:00
Nikita Popov 55bd88ce0d Remove redundant __clone() methods from Reflection
Reflection classes already use NULLed clone_obj to signal that they
cannot be cloned, so it's not necessary to additionally declare a
throwing __clone() method.
2018-11-26 14:00:42 +01:00
Dmitry Stogov 0fbd2e6a16 Renumber ZEND_ACC_... flags 2018-09-11 17:21:17 +03:00
Gabriel Caruso ded3d984c6 Use EXPECT instead of EXPECTF when possible
EXPECTF logic in run-tests.php is considerable, so let's avoid it.
2018-02-20 21:53:48 +01:00
Gabriel Caruso ce1d69a1f6 Use int instead of integer in type errors
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".
2018-02-04 19:08:23 +01:00
Michael Moravec f70ca770b6 Revert BC break caused by fixing bug #74035
This reverts commit 9ffc6ca62f.
2017-11-06 17:52:17 -05:00
Sara Golemon c1500f8519 Rename ReflectionClass::isIterateable() to isIterable()
Iterateable is not a word.
Add the correct spelling, but keep the original one around
for BC purposes.

Perhaps we can add ZEND_ACC_DEPRECATED at some later date
and even remove it from PHP 8.
2017-05-31 12:08:07 -07:00
Nikita Popov 57817eb72f Merge branch 'PHP-7.0' into PHP-7.1 2017-02-03 18:30:32 +01:00
andrewnester 9ffc6ca62f Fixed bug #74035 2017-02-03 18:29:39 +01:00
Dmitry Stogov a75c195000 Implemented the RFC Support Class Constant Visibility.
Squashed commit of the following:

commit f11ca0e7a5
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue Dec 8 12:38:42 2015 +0300

    Fixed test expectation

commit 211f873f54
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue Dec 8 12:28:38 2015 +0300

    Embed zend_class_constant.flags into zend_class_constants.value.u2.access_flags

commit 51deab84b2
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon Dec 7 11:18:55 2015 +0300

    Fixed issues found by Nikita

commit 544dbd5b47
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Sat Dec 5 02:41:05 2015 +0300

    Refactored immplementation of https://wiki.php.net/rfc/class_const_visibility
    @reeze created an RFC here and I emailed internals here and didn't get any responses positive/negative.
2015-12-08 12:40:42 +03:00
krakjoe 49608e0608 Rebase Joe's anon classes implementation 2015-04-26 15:04:22 +02:00
Guilherme Blanco 094d409b3d Removed ZEND_ACC_FINAL_CLASS which is unnecessary. This also fixed some currently defined classes as final which were just not being considered as such before. 2014-12-12 17:29:54 +01:00
Tjerk Meesters 87afa6bdc9 Fixes missing Reflector interface constraints being enforced by the engine 2014-08-16 17:34:56 +08:00
Sebastian Bergmann ebddf8a975 Revert r322390. 2012-01-17 13:46:31 +00:00
Sebastian Bergmann e76c1cc03c Implement ReflectionClass::setFinal() and ReflectionMethod::setFinal().
Patch by Jan Dolecek <juzna.cz@gmail.com>.
2012-01-17 12:59:33 +00:00
Sebastian Bergmann a70240637d Close #55490. 2011-08-26 07:40:31 +00:00
Felipe Pena f10c7890c2 - Fix test 2010-06-03 00:13:27 +00:00
Johannes Schlüter 4158f7e122 - More trait reflection work
#- I'm not happy about ReflectionClass::getTraitAliases, yet
2010-05-30 01:00:45 +00:00
Johannes Schlüter 19afc82e28 - Make reflection aware of traits 2010-05-29 20:40:58 +00:00
Felipe Pena 6504d84a0b - Fix some arginfos (thanks Philip)
- Added arginfo info. for void params
2009-10-03 20:45:29 +00:00
Ant Phillips ddb2c05841 Reflection tests: checked on PHP 5.2.6, 5.3 and 6.0 (Windows, Linux and Linux 64 bit). 2008-11-18 15:37:57 +00:00