Commit graph

190 commits

Author SHA1 Message Date
Gina Peter Banyard
be2401ab61
[skip ci] gen_stub: Fix final comment text generation 2023-11-07 16:37:35 +00:00
Gina Peter Banyard
5d98069456
[skip ci] gen_stub: Generate useful methodsynopsises for new functions/methods (#12330)
Co-authored-by: Máté Kocsis <kocsismate@woohoolabs.com>
2023-10-31 19:45:34 +00:00
Máté Kocsis
60a33af3c4
Fix validation of CLI arguments when a target manual directory has to be provided
Additionally, let's make sure that we don't try to process the stub files in the
manual target directory. This comes with a slight performance benefit.
2023-10-31 12:14:03 +01:00
Máté Kocsis
500490ddd5
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12558 Escape \N in generated stubs
2023-10-31 10:11:27 +01:00
Máté Kocsis
98e8e277b5
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12558 Escape \N in generated stubs
2023-10-31 10:09:22 +01:00
Máté Kocsis
d4e40dc0e1
Fix GH-12558 Escape \N in generated stubs (#12562) 2023-10-31 10:06:56 +01:00
Máté Kocsis
cc2a68e588
Fix predefined constant page synchonization 2023-09-12 18:52:38 +02:00
Máté Kocsis
2cb4d00693
Improve detection of predefined constants
In order to include constants documented at https://www.php.net/manual/en/reserved.constants.php, as well as constants which share the same varlistentry (just like what
https://www.php.net/manual/en/class.datetimeinterface.php#datetimeinterface.constants.atom does). In the same time, special constants like
true, false, null are excluded, since the manual uses their entity (&true;, &false, &null;, respectively), and gen_stub.php couldn't detect
them.
2023-09-07 10:00:55 +02:00
Máté Kocsis
0363dbfef4 Add support for verifying and syncronizing predefined constants with the manual 2023-09-05 08:09:24 +02:00
Máté Kocsis
c5fb8b6a6b
Align class name detection to the new class synopsis format 2023-09-01 14:15:36 +02:00
Máté Kocsis
597aeb1246
Fix the class synopsis of Throwable
"ooexception" is rendered as a class, therefore interfaces should be marked up as "oointerface".
2023-08-30 08:24:45 +02:00
Remi Collet
13d3564a51
Fix #12063 convert PHP single-quote to C double-quote string 2023-08-28 14:48:49 +02:00
Máté Kocsis
c934e24197 Fix GH-9967 Add support for generating custom function, class const, and property attributes in stubs 2023-08-26 21:35:31 +02:00
Ayesh Karunaratne
e6627ccb52
gen_stub: fix regexps with unintentional range due to - character placement (#12004) 2023-08-20 14:20:56 +02:00
Máté Kocsis
566cf37ec3
Use new class synopsis generating markup (#11809) 2023-07-28 15:42:32 +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
Ilija Tovilo
ef4f08832c
Revert "Fix GH-9967 Add support for generating custom function, class const, and property attributes in stubs"
This reverts commit d7ab0ff0c8.
2023-07-04 09:11:14 +02:00
Máté Kocsis
4db4f0ba00
Display the readonly modifier for readonly classes 2023-07-03 16:02:25 +02:00
Máté Kocsis
3c6590a391
Add support for extending multiple interfaces in the manual
After https://github.com/php/phd/pull/75/
2023-07-03 16:02:25 +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
d7ab0ff0c8
Fix GH-9967 Add support for generating custom function, class const, and property attributes in stubs 2023-07-03 08:32:58 +02:00
Máté Kocsis
3906bccc00 Add support for typed class constants in stubs 2023-07-01 11:50:04 +02:00
Máté Kocsis
6dd62fb3d6
Upgrade to PHP-Parser 5.0
Since it supports typed class constants. Using the alpha 3 version for now.
2023-06-25 22:54:01 +02:00
Máté Kocsis
281669aeb4 Add support for true standalone type when generating methodsynopsis 2023-05-07 19:34:09 +02:00
Derick Rethans
78937c93ef Merge branch 'PHP-8.2' 2023-03-09 13:39:31 +00:00
Derick Rethans
a45bef0ac6 Merge branch 'PHP-8.1' into PHP-8.2 2023-03-09 13:37:19 +00:00
Derick Rethans
717335ec63 Fixed macro generation for variadics, which don't have a default value 2023-03-09 11:39:22 +00:00
Máté Kocsis
368febbf89
Remove unnecessary workaround for the true type 2023-03-07 09:08:16 +01:00
Bob Weinand
145602f38e Fix bug in zend_test assuming null not being the first type
(I agree that null should come last, but then it should rather throw with a proper message than emit an undefined key warning.)

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2023-02-28 12:01:41 +01:00
Bob Weinand
81abd8dc37 Allow gen_stub.php to parse and ignore extended docblock types
Extended docblock types, according to psalm or phpstan conventions may include array shapes, callable signatures etc.. These are now ignored by ignoring any nested parenthesized expression (followed by optional :type) at the end of the type.
2023-02-27 17:30:28 +01:00
Máté Kocsis
a981ad7ad2
Merge branch 'PHP-8.2'
* PHP-8.2:
  Add support for generating namespaced constant
2023-02-23 10:49:40 +01:00
SATO Kentaro
7fccdf72a4
Add support for generating namespaced constant
Closes GH-10552
2023-02-23 10:05:30 +01:00
Bob Weinand
cf1d21edbd Add a couple clarifying comments 2023-01-22 21:24:54 +01:00
Bob Weinand
1fbe855971 Honor constant expressions instead of just taking the last constant encountered in stubs
As an example:
should be translated to:
ZVAL_LONG(&attribute_Attribute_class_test_arg0, ZEND_ATTRIBUTE_TARGET_FUNCTION | ZEND_ATTRIBUTE_TARGET_METHOD);
2023-01-22 21:24:54 +01:00
Máté Kocsis
c90c944126
Merge branch 'PHP-8.2'
* PHP-8.2:
  Better document constructors
  Do not display non-existent constructors
  Do not list private constructors as inherited
2023-01-01 10:49:39 +01:00
Máté Kocsis
7b08fe9f2d Do not list private constructors as inherited 2023-01-01 10:47:16 +01:00
Máté Kocsis
38e138798d Do not display non-existent constructors 2023-01-01 10:47:16 +01:00
Máté Kocsis
eebf3bc0ba Better document constructors
Until https://github.com/php/php-src/pull/10098 default constructors were sometimes documented, sometimes omitted. The above PR made adding documentation for constructor of all non-abstract classes required. However, this is not desired when such a class inherits a constructor from its parent. The current PR fixes the behavior the following way:
- documents inherited constructors (along with destructors)
- makes it possible to generate/replace the methodsynopsis of implicit default constructors which don't have a stub counterpart
2023-01-01 10:47:16 +01:00
Máté Kocsis
dc54e04ed4
Merge branch 'PHP-8.2'
* PHP-8.2:
  Only include the default constructor for non-abstract class synopses
2022-12-16 17:03:22 +01:00
Máté Kocsis
d832125b8e
Only include the default constructor for non-abstract class synopses 2022-12-16 17:02:35 +01:00
Máté Kocsis
8afc55870e
Merge branch 'PHP-8.2'
* PHP-8.2:
  Replace another root XML element format to the "canonical" one
  Remove the superfluous closing parentheses from class synopsis page includes
  Always include the constructor on the class manual pages
  Backport methodsynopsis role attributes changes from master
2022-12-16 13:21:39 +01:00
Máté Kocsis
6aa5e58414 Backport methodsynopsis role attributes changes from master
Commits 93605f286d and d6651426f4
2022-12-16 13:18:12 +01:00
Máté Kocsis
0fc60fab72 Always include the constructor on the class manual pages 2022-12-16 13:18:12 +01:00
Máté Kocsis
b4df038cee Remove the superfluous closing parentheses from class synopsis page includes 2022-12-16 13:18:12 +01:00
Máté Kocsis
60cf9fbee0 Replace another root XML element format to the "canonical" one 2022-12-16 13:18:12 +01:00
Máté Kocsis
d6651426f4
Escape the role attribute of namespaced classes (#9952) 2022-11-15 18:13:29 +01:00
Máté Kocsis
93605f286d
Make the usage of the role attribute more clear (#9901)
Currently, the role attribute is mainly used to differentiate OO and procedural "aliases" when they are documented on the same page (e.g. https://www.php.net/manual/en/datetime.diff.php). However, these function-method counterparts are not always aliases in fact according to the stubs (#9491). That's why sometimes the usage of the role attribute is ambiguous, thus syncing the manual with the stubs results in false positive diffs.

This change fixes the problem by a very obtrusive way: by changing the value of all role="oop" attributes to the actual class name, like role="DateTime", and by getting rid of all role="procedural" attributes as they became unnecessary. This way, class synopsis pages can clearly reference methods, and skip functions. Additionally, gen_stub.php will be able to generate the correct methodsynopsis role even though a single page describes multiple methods, like `DateTime/DateTimeImmutable/DateTimeInterface::diff()`.
2022-11-10 08:35:46 +01:00
Máté Kocsis
a14e125baf
Merge branch 'PHP-8.2'
* PHP-8.2:
  Do not display the value of UNKNOWN constants in the manual (#9843)
2022-10-30 14:58:58 +01:00
Máté Kocsis
721e604a69
Do not display the value of UNKNOWN constants in the manual (#9843) 2022-10-30 14:58:16 +01:00
Máté Kocsis
aba11b670c
Merge branch 'PHP-8.2'
* PHP-8.2:
  Generate constant declarations with the CONST_CS flag for PHP 7.x
2022-10-10 11:13:00 +02:00