-
-
Notifications
You must be signed in to change notification settings - Fork 640
Description
Expected behavior
That a null default value is recognized as the global constant null, same with true.
And that an unqualified class constant with a import use statement for the class gets resolved to the correct class.
Actual behavior
null/true (and I suspect false) now gets annotated with a mouse-over as if it is a namespaced constant/class: <abbr title="\Project\NS\null">null</abbr>
And the unqualified class constant now gets turned into a fully qualified class constant in the global namespace, not the namespace it belongs to.
Steps to reproduce the problem
Given the following code:
namespace WpOrg\Requests\Auth;
class Basic implements Auth {
/**
* Constructor
*
* @since 2.0 Throws an `InvalidArgument` exception.
* @since 2.0 Throws an `ArgumentCount` exception instead of the Requests base `Exception.
*
* @param array|null $args Array of user and password. Must have exactly two elements
*
* @throws \WpOrg\Requests\Exception\InvalidArgument When the passed argument is not an array or null.
* @throws \WpOrg\Requests\Exception\ArgumentCount On incorrect number of array elements (`authbasicbadargs`).
*/
public function __construct($args = null) {
// Do something.
}
}And generating the docs like so:
phpDocumentor
... with the following quite plain config: https://github.com/WordPress/Requests/blob/babd303d2084cf2690db536aeb6eef58326ee3ff/phpdoc.dist.xml
With phpDocumentor 3.6.0, the output for the constructor would look like so:
Relevant example lines in committed generated docs:
- https://github.com/WordPress/Requests/blob/4f61e08e9dcd70e1f6565ba13b9fb5ba5f54fa8b/api-2.x/classes/WpOrg-Requests-Auth-Basic.html#L382
- https://github.com/WordPress/Requests/blob/4f61e08e9dcd70e1f6565ba13b9fb5ba5f54fa8b/api-2.x/classes/WpOrg-Requests-Auth-Basic.html#L393
PR showing the diff with the previously published docs: WordPress/Requests#982
The previously published docs were generated with phpDocumentor v3.6.0. The PR was generated using phpDocumentor 3.8.1.
While with phpDocumentor 3.9.0, the output looks like so:
Relevant example lines in committed generated docs:
- https://github.com/WordPress/Requests/blob/ce0de6de9d97650d1ae97fcb8931bd798724f693/api-2.x/classes/WpOrg-Requests-Auth-Basic.html#L382
- https://github.com/WordPress/Requests/blob/ce0de6de9d97650d1ae97fcb8931bd798724f693/api-2.x/classes/WpOrg-Requests-Auth-Basic.html#L393
PR showing the diff with the previously published docs: WordPress/Requests#991
The previously published docs were generated with phpDocumentor v3.6.0. The PR was generated using phpDocumentor 3.9.0.
Other examples
The same thing is happening in multiple places in the codebase.
Here is an example of the same happening with a true default value:
- Source: https://github.com/WordPress/Requests/blob/457dba4c597f2f8f689b33e87a5f1cff0c271159/src/Response.php#L155
- phpDocumentor 3.6.0 output:
- https://github.com/WordPress/Requests/blob/4f61e08e9dcd70e1f6565ba13b9fb5ba5f54fa8b/api-2.x/classes/WpOrg-Requests-Response.html#L755
- https://github.com/WordPress/Requests/blob/4f61e08e9dcd70e1f6565ba13b9fb5ba5f54fa8b/api-2.x/classes/WpOrg-Requests-Response.html#L768
- phpDocumentor 3.9.0 output:
- https://github.com/WordPress/Requests/blob/ce0de6de9d97650d1ae97fcb8931bd798724f693/api-2.x/classes/WpOrg-Requests-Response.html#L763
- https://github.com/WordPress/Requests/blob/ce0de6de9d97650d1ae97fcb8931bd798724f693/api-2.x/classes/WpOrg-Requests-Response.html#L776
And here is another weird one - the class constant Requests::GET used as a default value gets turned into \Requests::GET (incorrect), not \WpOrg\Requests\Requests::GET (correct):
- Source: https://github.com/WordPress/Requests/blob/457dba4c597f2f8f689b33e87a5f1cff0c271159/src/Session.php#L229
- phpDocumentor 3.6.0 output:
- https://github.com/WordPress/Requests/blob/4f61e08e9dcd70e1f6565ba13b9fb5ba5f54fa8b/api-2.x/classes/WpOrg-Requests-Session.html#L1252
- https://github.com/WordPress/Requests/blob/4f61e08e9dcd70e1f6565ba13b9fb5ba5f54fa8b/api-2.x/classes/WpOrg-Requests-Session.html#L1293
- phpDocumentor 3.9.0 output:
- https://github.com/WordPress/Requests/blob/ce0de6de9d97650d1ae97fcb8931bd798724f693/api-2.x/classes/WpOrg-Requests-Session.html#L1254
- https://github.com/WordPress/Requests/blob/ce0de6de9d97650d1ae97fcb8931bd798724f693/api-2.x/classes/WpOrg-Requests-Session.html#L1295
Your environment
- Version used: 3.9.0
- Install method: in GitHub Actions via setup-php
- PHP version: 8.1
- Operating system and version: Ubuntu 24.04 (GHA)
- Link to your project: https://github.com/WordPress/Requests