-
-
Notifications
You must be signed in to change notification settings - Fork 142
PhpStan fixes #364
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
base: master
Are you sure you want to change the base?
PhpStan fixes #364
Conversation
| if ($this->errors) { | ||
| throw new Exception('SQL translate error: ' . trim(reset($this->errors), '*'), 0, $sql); | ||
| if ($this->errors !== []) { | ||
| throw new Exception('SQL translate error: ' . trim((string) reset($this->errors), '*'), 0, $sql); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it changes behavior, can be null or empty array. And original code is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reverted original condition but kept (string) for PhpStan because function reset() can return mixed value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For nonempty string[]? I think it must be always string.
| if (in_array($code, [1216, 1217, 1451, 1452, 1701], true)) { | ||
| return new Dibi\ForeignKeyConstraintViolationException($message, $code, $sql); | ||
| if (is_int($code) === true) { | ||
| if (in_array($code, [1216, 1217, 1451, 1452, 1701], true)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no reason for this change, in_array checks type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in mysql driver it is always int.
| { | ||
| if ($this->autoFree && $this->getResultResource()) { | ||
| if ($this->autoFree) { | ||
| $this->getResultResource(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is right.
138139d to
81a66da
Compare
8db0534 to
cc3b09e
Compare
ebee17f to
9908f6f
Compare
b6a770f to
ab68077
Compare
4947fa5 to
04f006a
Compare
60c2108 to
514bd23
Compare
8157984 to
4ea907a
Compare


I fixed some PhpStan errors.
Resend #363.