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

Corrected a few type-hints #8

Merged
merged 3 commits into from Mar 3, 2021
Merged

Corrected a few type-hints #8

merged 3 commits into from Mar 3, 2021

Conversation

addiks
Copy link
Contributor

@addiks addiks commented Feb 19, 2021

There are a few incorrect (return- and argument-) types defined in doc-blocks that differ from the actual PHP native types and thus cause problems for static analysis (psalm in my case). This PR should fix these issues.
There might be more such wrong types, I have only now corrected the few types that were offending in my case.

ERROR: InvalidMethodCall - php/Foo/Bar/Baz.php:123:456 - Cannot call method on float variable  (see https://psalm.dev/091)
            $this->chargeAmount->getAmount()->toReal()->toNative(),
ERROR: InvalidArgument - php/Foo/Bar/Baz.php:123:456 - Argument 1 of ValueObjects\Money\Money::__construct expects int, ValueObjects\Number\Integer provided (see https://psalm.dev/004)
            $lowestMoney = new Money(new Integer((int)$lowestPrice), new Currency($this->catalog->getCurrencyCode()));

```
ERROR: InvalidMethodCall - php/Foo/Bar/Baz.php:63:57 - Cannot call method on float variable  (see https://psalm.dev/091)
            $this->chargeAmount->getAmount()->toReal()->toNative(),
```
```
ERROR: InvalidArgument - php/Foo/Bar/Baz.php:564:38 - Argument 1 of ValueObjects\Money\Money::__construct expects int, ValueObjects\Number\Integer provided (see https://psalm.dev/004)
            $lowestMoney = new Money(new Integer((int)$lowestPrice), new Currency($this->catalog->getCurrencyCode()));
```
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 1414135 on addiks:master into 4b35857 on ytake:master.

@ytake ytake self-assigned this Mar 3, 2021
@ytake ytake merged commit 61f10ee into ytake:master Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants