Commit Graph

72 Commits

Author SHA1 Message Date
Máté Kocsis
f41220fe5d Implement ReflectionMethod::createFromMethodName() 2023-07-18 12:59:21 +02:00
Ilija Tovilo
7b355e8d34
Revert "Merge branch 'PHP-8.2'"
This reverts commit 45a3f178dc, reversing
changes made to b2a54bc6af.
2023-07-04 09:18:49 +02:00
Máté Kocsis
45a3f178dc
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-9967 Add support for generating custom function, class const, and property attributes in stubs

Closes GH-10170
2023-07-03 11:17:08 +02:00
Máté Kocsis
414f71a902
Typed class constants (#10444)
RFC: https://wiki.php.net/rfc/typed_class_constants

Co-Authored-By: Ben <7127204+moliata@users.noreply.github.com>
Co-Authored-By: Bob Weinand <3154871+bwoebi@users.noreply.github.com>
Co-Authored-By: Ilija Tovilo <ilija.tovilo@me.com>
2023-04-16 22:20:26 +02:00
Ilija Tovilo
ab99072608
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix segfault when using ReflectionFiber (fixes #10439)
2023-02-23 23:28:31 +01:00
Ilija Tovilo
f1818d726f
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix segfault when using ReflectionFiber (fixes #10439)
2023-02-23 23:27:55 +01:00
Daniil Gentili
8d1c0a1403
Fix segfault when using ReflectionFiber (fixes #10439)
Closes GH-10478
2023-02-23 23:20:27 +01:00
Máté Kocsis
016160800c
Fix GH-10259 ReflectionClass::getStaticProperties doesn't need null return type (#10418) 2023-01-24 22:26:52 +01:00
Arnaud Le Blanc
dcde9b85a6 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [ci skip] NEWS
  [ci skip] NEWS
  Add tests
  Fix GH-8932: Provide a way to get the called-scope of closures (#9299)
2022-09-02 13:55:57 +02:00
Arnaud Le Blanc
409baac29c Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  [ci skip] NEWS
  Add tests
  Fix GH-8932: Provide a way to get the called-scope of closures (#9299)
2022-09-02 13:53:14 +02:00
Nicolas Grekas
93f11d8429
Fix GH-8932: Provide a way to get the called-scope of closures (#9299)
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2022-09-02 13:32:50 +02:00
Máté Kocsis
e4d79ce24c
Declare ext/reflection constants in stubs (#9111) 2022-07-23 12:59:30 +02:00
Sam
2ce2aff50e
Better return types for getBackingType (#8687)
The only backing types for Enums are int and string. The proper return type for ReflectionEnum::getBackingType() is thus null|ReflectionNamedType.

See also https://github.com/php/doc-en/pull/1608

Closes GH-8687
2022-06-02 18:13:21 +02:00
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
Ollie Read
f590782b60
Add ReflectionMethod::hasPrototype method
Closes GH-8487.
2022-05-09 16:48:54 +02:00
Nicolas Grekas
be11bcb0b1
Add ReflectionFunction::isAnonymous()
Closes GH-8499.
2022-05-09 12:56:10 +02:00
Máté Kocsis
10a2079b13
Remove extra space before return type
For consistency and searchability reasons
2021-10-18 14:28:46 +02:00
sasezaki
e286313fa7 Fix bug #81474: Make ReflectionAttribute non-final
This backports GH-7520 to PHP 8.0.

Closes GH-7545.
2021-10-04 14:39:46 +02:00
Nikita Popov
f2ae8a3357 Fix bug #81474: Make Reflection(Attribute|Enum|EnumBackedCase) non-final
BetterReflection would like to extend these classes to provide
adaptors. As our other Reflector classes are non-final, I think
it makes sense to make these non-final as well.

Closes GH-7520.
2021-09-28 09:38:03 +02: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
2378f35787
Use single line phpdoc in stubs where possible 2021-07-20 13:16:56 +02:00
Joe Watkins
27bb57356c
Merge branch 'master' of github.com:php/php-src
* 'master' of github.com:php/php-src:
  Implement readonly properties
2021-07-20 12:32:51 +02:00
Joe Watkins
570d9b63e9
Not serializable flag permeation 2021-07-20 12:28:35 +02:00
Nikita Popov
6780aaa532 Implement readonly properties
Add support for readonly properties, for which only a single
initializing assignment from the declaring scope is allowed.

RFC: https://wiki.php.net/rfc/readonly_properties_v2

Closes GH-7089.
2021-07-20 12:05:46 +02:00
Máté Kocsis
fc0d8983d3
Fix some smaller formatting inconsistencies in stubs 2021-07-20 00:52:26 +02:00
Benjamin Eberlei
bc39abe8c3 Fix #80097: Have ReflectionAttribute implement Reflector and __toString
Implement printing for ReflectionAttribute. Attributes aren't
printed as part of reflection output for other structures (classes
etc) yet.

Closes GH-6117.
2021-07-07 12:42:04 +02:00
Máté Kocsis
a5360e80c2
Add support for final class constants
RFC: https://wiki.php.net/rfc/final_class_const

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-07-06 21:42:38 +02:00
George Peter Banyard
069a9fa5e4
Pure Intersection types (#6799)
Implement pure intersection types RFC

RFC: https://wiki.php.net/rfc/pure-intersection-types

Co-authored-by: Nikita Popov <nikic@php.net>
Co-authored-by: Ilija Tovilo <ilutov@php.net>
2021-07-05 14:11:03 +02:00
Joe Watkins
aad0d26816
Fix bug #81200 ReflectionMethod::isStatic belongs on ReflectionFunctionAbstract 2021-06-28 09:49:30 +02:00
Máté Kocsis
fccb7274e8
Do not verify the signature of ReflectionEnumUnitCase::getValue()
This method legally have a different return type (UnitEnum) from its parent's return type (mixed).
2021-05-26 12:38:04 +02:00
Máté Kocsis
78ecd4a5f0
Declare tentative return types for ext/reflection
Closes GH-7011
2021-05-23 15:59:57 +02:00
Joe Watkins
b227a72285
ReflectionFunctionAbstract::getClosureUsedVariables
Make a distinction at compile time between bind types for static
  variables

  getStaticVariables remains unchanged

  Fixes #80071
2021-05-21 15:25:35 +02:00
Máté Kocsis
532c60cb92
Add support for tentative return types of internal methods
RFC: https://wiki.php.net/rfc/internal_method_return_types

Closses GH-6971
2021-05-14 15:55:25 +02:00
Nikita Popov
50b4a7adf9 Property handle unset name on ReflectionClassConstant
While the typed property ensures that the value is a string,
we should make sure that we handle an unset property gracefully.

Do this by throwing the same error we would normally throw if
you access an uninitializde typed property.
2021-05-07 12:39:17 +02:00
Aaron Piotrowski
c276c16b66
Implement Fibers
RFC: https://wiki.php.net/rfc/fibers

Closes GH-6875.
2021-04-26 11:07:06 -05: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
Máté Kocsis
bf0f6aaf18
Improve class entry generation
Related to GH-6701
2021-02-16 13:09:56 +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
5b5bfd6be4
Generate class entries from stubs for phar, posix, pspell, readline, reflection, session, shmop
Closes GH-6692
2021-02-15 00:11:22 +01:00
Christoph M. Becker
82f9e004da Fix ReflectionClass::getConstants() stub
If `zval_update_constant_ex()` fails, an exception has already been
thrown, so we clarify that in the implementation as well.

Closes GH-6557.
2021-01-01 14:46:28 +01:00
Nikita Popov
7f462c97f9 Revert "Make ReflectionUnionType final"
This reverts commit ef6adb4e27.

Per Ondrej's comment, this is already being used by BetterReflection
adaptors, ugh.
2020-10-26 08:51:06 +01:00
Máté Kocsis
ef6adb4e27
Make ReflectionUnionType final
Closes GH-6384
2020-10-25 20:14:07 +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
Máté Kocsis
351776eae5
Make the $filter parameter of ReflectionClass::get*Constants() nullable 2020-09-29 11:04:10 +02:00
Máté Kocsis
e19599287e
Reflection param renames amendment
Closes GH-6230
2020-09-29 11:04:10 +02:00
Máté Kocsis
64af12d13b
Add support for @implementation-alias in stubs
Closes GH-6170
2020-09-21 10:08:45 +02:00
Gabriel Caruso
1a8936cde3
Check ReflectionReference::fromArrayElement with union types
ReflectionReference::fromArrayElement(array $array, int|string $key): ?ReflectionReference
is going to be its official signature for PHP 8.0.

Closes GH-5651
2020-09-15 12:56:10 +02:00
Máté Kocsis
a59923befd
Refactor ReflectionMethod::__construct()
Closes GH-6098
2020-09-11 10:59:13 +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