Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for PHP 7.1 nullable type #300

Closed
dereckson opened this issue Dec 25, 2016 · 3 comments
Closed

Support for PHP 7.1 nullable type #300

dereckson opened this issue Dec 25, 2016 · 3 comments
Assignees
Labels

Comments

@dereckson
Copy link
Contributor

PHP 7.1 introduced a nullable type ?Foo, for argument and return values, to designate a value which can be either fo the type Foo, either null.

PHP-Parser handles this token through the PhpParser\Node\NullableType class.

When I run phpdox on a codebase using this, I got this output (timestamps are from Ant output):

[phpdox] [25.12.2016 - 03:00:59] The following file(s) had errors during processing and were excluded:
[phpdox] [25.12.2016 - 03:00:59] - /app/notifications-center/app/Phabricator/ProjectsMap.php (Object of class PhpParser\Node\NullableType could not be
converted to string)

So, documentation generation works but excludes the class.

To reproduce this, a minimal test case could be:

class A {}

class B {
    function foo (?A a) {}
}
@theseer theseer self-assigned this Dec 27, 2016
@theseer
Copy link
Owner

theseer commented Jun 15, 2017

Fixed with 0.10.0

@theseer theseer closed this as completed Jun 15, 2017
@NoelLH
Copy link

NoelLH commented Jul 1, 2017

@theseer I'm seeing this same output with v0.10.0 - am I missing something or is this a more specific edge case?

phpDox 0.10.0 ...
[exec] [01.07.2017 - 06:11:26] The following file(s) had errors during processing and were excluded:
[exec] [01.07.2017 - 06:11:26] - .../File.php (Object of class PhpParser\Node\NullableType could not be converted to string)

The class it refers to is abstract and the constructor has the following:

    /**
     * @param Request           $request
     * @param array             $roles
     * @param Router            $router
     * @param FacebookHelper    $facebookHelper
     * @param string            $targetRoute
     * @param Logger|null       $logger
     *
     * @see Other:fn()
     */
    public function __construct(
        Request $request,
        array $roles,
        Router $router,
        FacebookHelper $facebookHelper,
        string $targetRoute = 'facebook_check',
        ?Logger $logger = null
    ) {
        parent::__construct($roles);
...

theseer added a commit that referenced this issue Jul 2, 2017
This should also fix #300.
@theseer
Copy link
Owner

theseer commented Jul 2, 2017

Hmpf. Should be fixed with 0.10.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants