Commit graph

91 commits

Author SHA1 Message Date
Derick Rethans
717335ec63 Fixed macro generation for variadics, which don't have a default value 2023-03-09 11:39:22 +00:00
Tyson Andre
0fab520ded
Fix zend_register_internal_class_ex alias generation (#8091)
This wouldn't work for creating aliases in a namespace.

It would create the class alias "MyNS_ClassName" instead of
"MyNS\\ClassName"
2022-02-14 17:58:26 -05:00
Máté Kocsis
62e4ac9439
Add support for custom property links
Closes GH-7892
2022-01-07 08:28:26 +01:00
Máté Kocsis
0462719999
Fix class synopsis generation
Closes GH-7891
2022-01-06 18:31:21 +01:00
Máté Kocsis
baac970817
Add the --generate-optimizer-info option to the help of gen_stub.php 2021-11-17 10:56:27 +01:00
Nikita Popov
68ca3879d7 Fix generation of property with class union type
The generated type was missing the UNION bit. Add a ZEND_TYPE_INIT_UNION
macro to hide the implementation details.
2021-11-15 11:04:48 +01:00
Nikita Popov
dd0ec7a554 Update PHP-Parser version in gen_stub
This should address the octal issue encountered in #7610.
2021-11-03 12:41:26 +01:00
Máté Kocsis
8168d312f9
Fix a few more classsynopsis generation issues
Closes GH-7480
2021-09-22 23:09:43 +02:00
Máté Kocsis
ea9f943d33
Change gen-stub.php to gen_stub.php in help text 2021-09-12 17:09:56 +02:00
Máté Kocsis
73063db5c8
Fix documentation generation when legacy arginfo is generated
When legacy arginfo is generated, all the type info gets lost. Since this task is performed before any other additional functionalities of gen_stub.php (e.g. verification, method synopsis and class synopsis generation), these fail as they would require the missing type information.

The issue is fixed by deep cloning the file info objects (albeit only their affected properties), so that we use those for legacy arginfo generation, leaving the original ones untouched.
2021-09-12 11:42:22 +02:00
Máté Kocsis
4c9892d1e3
Fix class synopsis generation for interfaces
We have to generate <ooclass> elements for interfaces (rather than <oointerface>) in a number of places: directly inside the <classsynopsis> element and in the extends list.
2021-09-08 12:23:00 +02:00
Máté Kocsis
f588764292
Improve class synopsis root element generation
Besides classrefs, we also have exceptionrefs. Also, the 4th capture group replacement used to be unintentionally duplicated.
2021-09-08 10:40:14 +02:00
Máté Kocsis
4483ecf5a9
Properly escape the default value of string properties and enum cases 2021-09-02 16:53:31 +02:00
Máté Kocsis
edf2947a5d
Remove unused variable from property generation code 2021-08-31 14:44:41 +02:00
Máté Kocsis
39ede67e17
Fix typo in method name in gen_stub.php 2021-08-31 14:43:11 +02:00
Nikita Popov
32d48212ea Support generating internal enum decl from stubs 2021-08-31 14:19:37 +02:00
Go Kudo
eaac77f4e7
Fix nested namespaced typed property in gen_stub.php (#7418)
Property escape namespaced class name in property types.
2021-08-31 11:56:39 +02:00
Nikita Popov
52d3af1790 Minor cleanup in gen_stubs
Unshare the stmt flag handling code, as this does not always
generalize (e.g. to enum cases, which have no visibility or flags
at all).
2021-08-31 11:44:14 +02:00
Nikita Popov
c1c1822e8c Fix type hint in gen_stub.php
There is no ClassType class, only SimpleType.

[ci skip]
2021-08-31 10:11:15 +02:00
Máté Kocsis
a57b713d66
Fix typo in gen_stub.php 2021-08-30 16:09:10 +02:00
Máté Kocsis
c19e4b9997
Generate optimizer func info from stubs for ext/standard - part 3 (#7426) 2021-08-30 15:56:47 +02:00
Máté Kocsis
8e6e9838b0
Add support for generating MAY_BE_ARRAY_OF_REF func info flag (#7416) 2021-08-30 13:50:34 +02:00
Nikita Popov
fab1222128 Ensure stub files are processed in predictable order
The zend_func_infos.h file was generated in a different order for
me.
2021-08-30 10:28:22 +02:00
Peter Cowburn
36e88a0066
Use &Properties; entity in xpointer for inherited properties in class synopses (#7400)
This changes ClassInfo::createIncludeElement() such that it takes the $query
argument as-is for the xpointer attribute value. Special characters, like
" and &, are used as-is so be careful not to break the resulting XML.
2021-08-25 12:14:03 +02:00
Máté Kocsis
4a7a414735
Fix callable and iterable handling 2021-08-25 10:37:43 +02:00
Máté Kocsis
d0897b3602
Clean up function map production slightly
There's no need to iterate over $fileInfos again while generating the class map
2021-08-24 19:30:00 +02:00
Máté Kocsis
e35a7fe919
Fix function map production 2021-08-24 18:45:31 +02:00
Máté Kocsis
2141bee69d
Add more specific array type hints 2021-08-24 18:40:36 +02:00
Máté Kocsis
b1822899fc
Add support for generating optimizer function info from stubs (#7367) 2021-08-24 16:35:33 +02:00
Máté Kocsis
076f2899ba
Add support for replacing class synopses based on stubs (#7340) 2021-08-13 15:03:31 +02:00
Máté Kocsis
ac17b3646d
Add support for generating classynopses from stubs
Closes GH-7310
2021-08-02 17:56:22 +02:00
Máté Kocsis
fc56de113c
Add support for generating readonly properties via stubs (#7297) 2021-07-22 11:09:10 +02:00
Máté Kocsis
23b1c4a982
Migrate to PHP-Parser 4.12.0 and regenerate some arginfos 2021-07-22 09:40:16 +02:00
Nikita Popov
814a932734 Add ZEND_ACC_NOT_SERIALIZABLE flag
This prevents serialization and unserialization of a class and its
children in a way that does not depend on the zend_class_serialize_deny
and zend_class_unserialize_deny handlers that will be going away
in PHP 9 together with the Serializable interface.

In stubs, `@not-serializable` can be used to set this flag.

This patch only uses the new flag for a handful of Zend classes,
converting the remainder is left for later.

Closes GH-7249.
Fixes bug #81111.
2021-07-19 15:59:11 +02:00
Máté Kocsis
553574165a
Add support for the never type in gen_stub.php 2021-07-14 15:21:15 +02:00
Máté Kocsis
0192fd20cc
Merge branch 'PHP-8.0' 2021-07-12 10:32:07 +02:00
Máté Kocsis
80e5ad5a29
Various ext/spl stub fixes
Closes GH-7215
2021-07-12 10:27:05 +02:00
Tyson Andre
e748dcacad
Allow build/gen_stub.php to process multiple CLI file args (#7179)
E.g. `build/gen_stub.php *.stub.php` will generate `*_arginfo.h`
from multiple files.

Previously, gen_stub.php would silently ignore files after the first file.

Invoking gen_stub.php with no arguments will continue to process the entire
directory.
2021-06-20 15:14:01 -04: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
Máté Kocsis
803779e84b
Add support for generating properties with union type of multiple classes
Closes GH-6701
2021-02-16 15:50:13 +01:00
Máté Kocsis
cad66533f0
Generate class entries from stubs for ldap, libxml, mbstring and mysqli
Closes GH-6684
2021-02-16 14:46:19 +01:00
Máté Kocsis
bf0f6aaf18
Improve class entry generation
Related to GH-6701
2021-02-16 13:09:56 +01:00
Máté Kocsis
99b08ac281
Implicitly enable function entry generation when class entry generation is enabled
Closes GH-6675
2021-02-09 13:37:24 +01:00
Tyson Andre
5e06dad411 Properly render 2+ namespaces functions in build/gen_stub.php
Affects ZEND_NS_FE

Add test cases of the global function

Backported to php 8.0 from GH-6664
2021-02-06 14:17:14 -05:00
Tyson Andre
b4c6d5f799 Properly render 2+ namespaces functions in build/gen_stub.php
Affects both INIT_NS_CLASS_ENTRY and ZEND_NS_FE

Add test cases of the global function and namespaced values

Closes GH-6664
2021-02-06 14:09:25 -05:00
Máté Kocsis
1954e59758
Add support for generating class entries from stubs
Closes GH-6289

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-01-26 11:50:36 +01:00
Nikita Popov
a9efcb1561 gen_stub: Also verify implementation-alias
This makes --verify also check @implementation-alias. Failures are
ignored using @no-verify instead. Some mistakes have been made that
would have been caught by this...

Closes GH-6615.
2021-01-19 09:48:33 +01:00
Nikita Popov
f0d6151918 gen_stub: Don't use $aliasMap during verification
Some functions have multiple aliases, while the $aliasMap can
only record one.

Methodsynopsis generation probably shouldn't use it either, but
at least that case seems to only be interested in whether there
is an alias at all.
2021-01-18 16:04:14 +01:00
Nikita Popov
496e4741a3 gen_stub: Compare phpdoc return type in --verify 2021-01-18 14:41:53 +01:00
Nikita Popov
85bfa2243a gen_stub: Allow additional text after @return
In case the stub file also contains documentation.
2021-01-18 13:13:32 +01:00