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

double not recognised as as an alias of native float type from phpdoc blocks #214

Closed
ghost opened this issue Mar 31, 2017 · 5 comments
Closed

Comments

@ghost
Copy link

ghost commented Mar 31, 2017

I've got phpstan running checks on some code that uses the paypal php SDK & I'm getting what I think is an error that shouldn't be an error:

200 Parameter #1 $total of method PayPal\Api\Amount::setTotal() expects
string|PayPal\Api\double, float given.

(double) seems to be valid as a typecast, and is_double() is an alias of is_float(), so one would hope that this should be recognised as an alias of the system type float.

lib/PayPal/Api/Amount.php

    /**
     * Total amount charged from the payer to the payee. In case of a refund, this is the refunded amount to the original payer from the payee. 10 characters max with support for 2 decimal places.
     *
     * @param string|double $total
     * 
     * @return $this
     */
    public function setTotal($total)
    {

composer.lock snippet for the specific version:

        {
            "name": "paypal/rest-api-sdk-php",
            "version": "1.11.0",
            "source": {
                "type": "git",
                "url": "https://github.com/paypal/PayPal-PHP-SDK.git",
                "reference": "7e664f12be32b975575371e8ad3bc17b6b318851"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/paypal/PayPal-PHP-SDK/zipball/7e664f12be32b975575371e8ad3bc17b6b318851",
                "reference": "7e664f12be32b975575371e8ad3bc17b6b318851",
                "shasum": ""
            },
@ondrejmirtes
Copy link
Member

Hi, thanks for the report. I agree, I'll add it. If you want to, feel free to send a PR. It needs to be added here: https://github.com/phpstan/phpstan/blob/master/src/Type/TypehintHelper.php#L62 (and increase cache version in FileTypeMapper.php).

@ghost
Copy link
Author

ghost commented Apr 3, 2017

Work schedule is a bit crammed at the moment, I'm afraid.

@ondrejmirtes
Copy link
Member

Ok, I'll look into it. You can always vote with your money if you want the work done on your behalf 😊 I'd really appreciate your support.

@ondrejmirtes
Copy link
Member

Support for double added: 402c32a

@github-actions
Copy link

github-actions bot commented Jun 2, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant