Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use "numeric-string" type for some MySQLi functions
- Loading branch information
1 parent
b58d93e
commit 9dee296
Showing
3 changed files
with
23 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace MySQLiStmt; | ||
|
||
use mysqli; | ||
use function PHPStan\Testing\assertType; | ||
|
||
final class Foo { | ||
public function bar(): void | ||
{ | ||
$mysqli = new mysqli(); | ||
$stmt = $mysqli->prepare('SELECT x FROM z;'); | ||
$stmt->execute(); | ||
assertType('int<0, max>|numeric-string', $stmt->num_rows); | ||
|
||
$stmt = $mysqli->prepare('DELETE FROM z;'); | ||
$stmt->execute(); | ||
assertType('int<-1, max>|numeric-string', $stmt->affected_rows); | ||
} | ||
} |