Skip to content

Commit

Permalink
Merge pull request #9547 from phansys/mysqli
Browse files Browse the repository at this point in the history
[mysql] Add stubs for `mysqli`, `mysqli_result` and `mysqli_stmt` classes
  • Loading branch information
orklah authored Mar 27, 2023
2 parents 6ca2f09 + b65a038 commit b908f44
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions stubs/extensions/mysqli.phpstub
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
<?php

class mysqli
{
/**
* @var int<-1, max>|numeric-string
*/
public int|string $affected_rows;
}

/**
* @template TValue
*
* @template-implements Traversable<int, TValue>
*/
class mysqli_result implements Traversable
{
/**
* @var int<0, max>|numeric-string
*/
public int|string $num_rows;

/**
* @psalm-taint-sink callable $class
*
Expand All @@ -18,6 +31,44 @@ class mysqli_result implements Traversable
function fetch_object(string $class = stdClass::class, array $constructor_args = []): object|false|null {}
}

class mysqli_stmt
{
/**
* @var int<-1, max>|numeric-string
*/
public int|string $affected_rows;

public int $errno;

/**
* @var list<array{errno: int, sqlstate: string, error: string}>
*/
public $error_list;

public string $error;

/**
* @var 0|positive-int
*/
public int $field_count;

public int|string $insert_id;

/**
* @var int<0,max>|numeric-string
*/
public int|string $num_rows;

/**
* @var 0|positive-int
*/
public int $param_count;

/**
* @var non-empty-string
*/
public string $sqlstate;
}

/**
* @psalm-taint-sink callable $class
Expand Down

0 comments on commit b908f44

Please sign in to comment.