-
-
Notifications
You must be signed in to change notification settings - Fork 138
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
PhpStan fixes #364
base: master
Are you sure you want to change the base?
PhpStan fixes #364
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,8 @@ public function __construct(\mysqli_result $resultSet, bool $buffered) | |
*/ | ||
public function __destruct() | ||
{ | ||
if ($this->autoFree && $this->getResultResource()) { | ||
if ($this->autoFree) { | ||
$this->getResultResource(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. It is right. |
||
@$this->free(); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,7 +154,7 @@ public function translate(array $args): string | |
$sql = trim(implode(' ', $sql), ' '); | ||
|
||
if ($this->errors) { | ||
throw new Exception('SQL translate error: ' . trim(reset($this->errors), '*'), 0, $sql); | ||
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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. I reverted original condition but kept There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For nonempty |
||
} | ||
|
||
// apply limit | ||
|
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.
Parameter
$code
can beint
orstring
. In the case ofstring
theif
statements can be skipped (better performance and code readability).What do you think?
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.