-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stubs for
mysqli
and mysqli_result
classes
- Loading branch information
1 parent
d25b897
commit e3023e0
Showing
6 changed files
with
75 additions
and
3 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,15 @@ | ||
<?php | ||
|
||
namespace MySqlAffectedRowsType; | ||
|
||
use mysqli; | ||
use function PHPStan\Testing\assertType; | ||
|
||
final class Foo { | ||
public function bar(): void | ||
{ | ||
$mysqli = new mysqli(); | ||
$mysqli->query('UPDATE x SET y = 0;'); | ||
assertType('int<-1, max>|numeric-string', $mysqli->affected_rows); | ||
} | ||
} |
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,15 @@ | ||
<?php | ||
|
||
namespace MySQLiResultNumRowsType; | ||
|
||
use mysqli; | ||
use function PHPStan\Testing\assertType; | ||
|
||
final class Foo { | ||
public function bar(): void | ||
{ | ||
$mysqli = new mysqli(); | ||
$mysqliResult = $mysqli->query('SELECT x FROM z;'); | ||
assertType('int<0, max>|numeric-string', $mysqliResult->num_rows); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
tests/PHPStan/Analyser/data/mysql-stmt.php → ...ysqli-stmt-affected-rows-and-num-rows.php
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