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 up datetime PHPStan error. #1947

Merged
merged 1 commit into from
Jan 23, 2023
Merged

Fix up datetime PHPStan error. #1947

merged 1 commit into from
Jan 23, 2023

Conversation

dereuromark
Copy link
Contributor

and fix some PHPStan issues of level 7

Copy link
Contributor

@mringler mringler left a comment

Choose a reason for hiding this comment

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

Nice!

@@ -49,6 +49,7 @@ public function getDataObject()
*/
public function fetchColumn($index = null)
{
/** @var array|null $next */
Copy link
Contributor

Choose a reason for hiding this comment

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

I think fetch() returns false if there are no more columns to fetch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, we could check on this. I just thought in this context it seems impossible (theoretical problem).

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the check happens in the next line:

        if (!$next) {
            return null;
        }

Copy link
Contributor Author

@dereuromark dereuromark Jan 20, 2023

Choose a reason for hiding this comment

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

Documented is array|bool|null

The bool true is the problem here
And instead of just checking on this, I simplified to the expected outcome as docblock.

@dereuromark dereuromark merged commit 5aec365 into master Jan 23, 2023
@dereuromark dereuromark deleted the fixes-date branch January 23, 2023 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants