Skip to content

Commit

Permalink
[mysql] Add stubs for mysqli, mysqli_stmt and mysqli_result cla…
Browse files Browse the repository at this point in the history
…sses
  • Loading branch information
phansys committed Mar 21, 2023
1 parent 0af503a commit b65a038
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 b65a038

Please sign in to comment.