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

Fix PHPStan (and Psalm) issues #64

Merged
merged 2 commits into from Oct 3, 2022
Merged

Conversation

hussainweb
Copy link
Contributor

Description

PHPStan reports errors when run manually or during a CI run. I saw this first when working on #58 but then I reproduced this on the main branch as well. That is the reason I am creating a new issue and a PR.

Motivation and context

The issue is described in #63.

How has this been tested?

I ran this manually on my machine using composer dev:analyze:phpstan and composer dev:analyze:psalm.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

PR checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING.md document.
  • I have added tests to cover my changes.

@hussainweb
Copy link
Contributor Author

After my first set of changes, I noticed that the fix I needed to do to solve a PHPStan error resulted in a Psalm error. I think the Psalm error is a false positive and it happens because it (probably) cannot detect the logic within the if (is_int(...)) block. However, rather than suppressing the error, I stored the value in a temporary variable as you can see.

If you prefer the suppression instead, let me know.

Copy link
Owner

@ramsey ramsey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks!

@ramsey ramsey merged commit 75d47b3 into ramsey:main Oct 3, 2022
@hussainweb hussainweb deleted the phpstan-fix branch October 3, 2022 21:30
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

2 participants