Skip to content

Commit 9b8b714

Browse files
committed
Fix tests
1 parent fb01af8 commit 9b8b714

File tree

2 files changed

+174
-108
lines changed

2 files changed

+174
-108
lines changed

ext/mysqli/mysqli.stub.php

Lines changed: 115 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ public function set_charset(?string $charset);
247247
*
248248
* @return bool
249249
*/
250-
public function options(?int $option, ?mixed $value);
250+
public function options(?int $option, $value);
251251

252252
/**
253253
* @param ?int $mysql_option
@@ -398,11 +398,11 @@ public function free_result();
398398

399399
class mysqli_stmt
400400
{
401-
/**
402-
* @param mysqli $mysqli_link
403-
* @param string $statement
404-
*/
405-
public function __construct(mysqli $mysqli_link, string $statement);
401+
/**
402+
* @param $mysqli_link
403+
* @param string $statement
404+
*/
405+
public function __construct();
406406

407407
/**
408408
* @param int $attr
@@ -425,14 +425,14 @@ public function attr_set(int $attr, int $mode_in);
425425
*
426426
* @return bool
427427
*/
428-
public function bind_param(string $types, mixed &...$vars);
428+
public function bind_param(string $types, &...$vars);
429429

430430
/**
431431
* @param mixed &...$vars
432432
*
433433
* @return bool
434434
*/
435-
public function bind_result(mixed &...$vars);
435+
public function bind_result(&...$vars);
436436

437437
/**
438438
* @return bool
@@ -521,21 +521,31 @@ class mysqli_sql_exception extends RuntimeException
521521
{
522522
}
523523

524-
function mysqli_affected_rows(mysqli $mysql_link): int {}
524+
function mysqli_affected_rows(mysqli $mysql_link): int|bool {}
525525

526526
function mysqli_autocommit(mysqli $mysql_link, bool $mode): bool {}
527527

528528
function mysqli_begin_transaction(mysqli $mysql_link, int $flags = 0, string $name = ''): bool {}
529529

530530
function mysqli_change_user(mysqli $mysql_link, string $user, string $password, ?string $database): bool {}
531531

532-
function mysqli_character_set_name(mysqli $mysql_link): string {}
532+
function mysqli_character_set_name(mysqli $mysql_link): string|bool {}
533533

534534
function mysqli_close(mysqli $mysql_link): bool {}
535535

536536
function mysqli_commit(mysqli $mysql_link, int $flags = 0, string $name = ''): bool {}
537537

538-
function mysqli_connect(?string $host = null, ?string $user = null, ?string $password = null, ?string $database = null, ?int $port = null, ?string $socket = null): mysqli {}
538+
/**
539+
* @param ?string $host
540+
* @param ?string $user
541+
* @param ?string $password
542+
* @param ?string $database
543+
* @param ?int $port
544+
* @param ?int $flags
545+
*
546+
* @return mysqli|bool
547+
*/
548+
function mysqli_connect(?string $host = null, ?string $user = null, ?string $password = null, ?string $database = null, ?int $port = null, ?string $socket = null) {}
539549

540550
function mysqli_connect_errno(): int {}
541551

@@ -547,9 +557,9 @@ function mysqli_dump_debug_info(mysqli $mysql_link): bool {}
547557

548558
function mysqli_debug(string $debug): bool {}
549559

550-
function mysqli_errno(mysqli $mysql_link): int {}
560+
function mysqli_errno(mysqli $mysql_link): int|bool {}
551561

552-
function mysqli_error(mysqli $mysql_link): string {}
562+
function mysqli_error(mysqli $mysql_link): string|bool {}
553563

554564
function mysqli_error_list(mysqli $mysql_link): array {}
555565

@@ -559,57 +569,62 @@ function mysqli_execute(mysqli_stmt $mysql_stmt): bool {}
559569

560570
function mysqli_fetch_field(mysqli_result $mysql_result): object|false {}
561571

562-
function mysqli_fetch_fields(mysqli_result $mysql_result): array {}
572+
function mysqli_fetch_fields(mysqli_result $mysql_result): array|bool {}
563573

564574
function mysqli_fetch_field_direct(mysqli_result $mysql_result, int $offset): object|false {}
565575

566576
function mysqli_fetch_lengths(mysqli_result $mysql_result): array|false {}
567577

568578
function mysqli_fetch_all(mysqli_result $mysql_result, int $mode = MYSQLI_NUM): array|false {}
569579

570-
function mysqli_fetch_array(mysqli_result $mysql_result, int $fetchtype = MYSQLI_BOTH): array|false {}
580+
function mysqli_fetch_array(mysqli_result $mysql_result, int $fetchtype = MYSQLI_BOTH): array|false|null {}
571581

572-
function mysqli_fetch_assoc(mysqli_result $mysql_result): array {}
582+
function mysqli_fetch_assoc(mysqli_result $mysql_result): array|bool|null {}
573583

574-
function mysqli_fetch_object(mysqli_result $mysqli_result, string $class_name = 'stdClass', array $params = []): object {}
584+
function mysqli_fetch_object(mysqli_result $mysqli_result, string $class_name = 'stdClass', array $params = []): object|bool|null {}
575585

576-
function mysqli_fetch_row(mysqli_result $mysqli_result): array {}
586+
function mysqli_fetch_row(mysqli_result $mysqli_result): array|bool|null {}
577587

578-
function mysqli_field_count(mysqli_result $mysqli_result): int {}
588+
function mysqli_field_count(mysqli $mysqli_link): int|bool {}
579589

580590
function mysqli_field_seek(mysqli_result $mysqli_result, int $field_nr): bool {}
581591

582-
function mysqli_field_tell(mysqli_result $mysqli_result): int {}
592+
function mysqli_field_tell(mysqli_result $mysqli_result): int|bool {}
583593

584-
function mysqli_free_result(mysqli_result $mysqli_result): void {}
594+
/**
595+
* @param mysqli_result $mysqli_result
596+
*
597+
* @return void
598+
*/
599+
function mysqli_free_result(mysqli_result $mysqli_result) {}
585600

586601
function mysqli_get_connection_stats(mysqli $mysqli_link): array {}
587602

588-
function mysqli_get_client_stats(mysqli $mysqli_link): array {}
603+
function mysqli_get_client_stats(): array {}
589604

590-
function mysqli_get_charset(mysqli $mysqli_link): object {}
605+
function mysqli_get_charset(mysqli $mysqli_link): object|bool {}
591606

592607
function mysqli_get_client_info(): string {}
593608

594609
function mysqli_get_client_version(): int {}
595610

596611
function mysqli_get_links_stats(mysqli $mysqli_link): array {}
597612

598-
function mysqli_get_host_info(mysqli $mysqli_link): string {}
613+
function mysqli_get_host_info(mysqli $mysqli_link): string|bool {}
599614

600-
function mysqli_get_proto_info(mysqli $mysqli_link): int {}
615+
function mysqli_get_proto_info(mysqli $mysqli_link): int|bool {}
601616

602-
function mysqli_get_server_info(mysqli $mysqli_link): string {}
617+
function mysqli_get_server_info(mysqli $mysqli_link): string|bool {}
603618

604-
function mysqli_get_server_version(mysqli $mysqli_link): int {}
619+
function mysqli_get_server_version(mysqli $mysqli_link): int|bool {}
605620

606621
function mysqli_get_warnings(mysqli $mysqli_link): mysqli_warning {}
607622

608623
function mysqli_init(): mysqli {}
609624

610-
function mysqli_info(mysqli $mysqli_link): string {}
625+
function mysqli_info(mysqli $mysqli_link): string|bool|null {}
611626

612-
function mysqli_insert_id(mysqli $mysqli_link): int|string {}
627+
function mysqli_insert_id(mysqli $mysqli_link): int|bool|string {}
613628

614629
function mysqli_kill(mysqli $mysqli_link, int $processid): bool {}
615630

@@ -619,15 +634,22 @@ function mysqli_multi_query(mysqli $mysqli_link, string $query): bool {}
619634

620635
function mysqli_next_result(mysqli $mysqli_link): bool {}
621636

622-
function mysqli_num_fields(mysqli $mysqli_link): int {}
637+
function mysqli_num_fields(mysqli_result $mysql_result): int|bool {}
623638

624-
function mysqli_num_rows(mysqli $mysqli_link): int|string {}
639+
function mysqli_num_rows(mysqli_result $mysqli_result): int|string|bool {}
625640

626-
function mysqli_options(mysqli $mysqli_link, int $mysql_option, mixed $mysql_value): bool {}
641+
/**
642+
* @param mysqli $mysqli_link
643+
* @param int $mysql_option
644+
* @param mixed $mysql_value
645+
*
646+
* @return bool
647+
*/
648+
function mysqli_options(mysqli $mysqli_link, int $mysql_option, $mysql_value): bool {}
627649

628650
function mysqli_ping(mysqli $mysqli_link): bool {}
629651

630-
function mysqli_poll(?array &$read, ?array &$write, ?array &$error, int $sec, int $usec = 0): int {}
652+
function mysqli_poll(?array &$read, ?array &$write, ?array &$error, int $sec, int $usec = 0): int|bool {}
631653

632654
/**
633655
* @param mysqli $mysqli_link
@@ -648,9 +670,20 @@ function mysqli_report(int $flags): bool {}
648670
*/
649671
function mysqli_query(mysqli $mysqli_link, string $query, int $resultmode = MYSQLI_STORE_RESULT) {}
650672

651-
function mysqli_real_connect(mysqli $mysqli_link, ?string $host = null, ?string $user = null, ?string $password = null, ?string $database = null, ?int $port = null, ?int $flags = null): mysqli {}
673+
/**
674+
* @param mysqli $mysqli_link
675+
* @param ?string $host
676+
* @param ?string $user
677+
* @param ?string $password
678+
* @param ?string $database
679+
* @param ?int $port
680+
* @param ?int $flags
681+
*
682+
* @return mysqli|bool
683+
*/
684+
function mysqli_real_connect(mysqli $mysqli_link, ?string $host = null, ?string $user = null, ?string $password = null, ?string $database = null, ?int $port = null, ?int $flags = null) {}
652685

653-
function mysqli_real_escape_string(mysqli $mysqli_link, string $escapestr): string {}
686+
function mysqli_real_escape_string(mysqli $mysqli_link, string $escapestr): string|bool {}
654687

655688
function mysqli_real_query(mysqli $mysqli_link, string $query): bool {}
656689

@@ -671,15 +704,28 @@ function mysqli_select_db(mysqli $mysqli_link, string $dbname): bool {}
671704

672705
function mysqli_set_charset(mysqli $mysqli_link, string $cs_name): bool {}
673706

674-
function mysqli_stmt_affected_rows(mysqli_stmt $mysql_stmt): int {}
707+
function mysqli_stmt_affected_rows(mysqli_stmt $mysql_stmt): int|bool {}
675708

676709
function mysqli_stmt_attr_get(mysqli_stmt $mysql_stmt, int $attr): int|false {}
677710

678711
function mysqli_stmt_attr_set(mysqli_stmt $mysql_stmt, int $attr, int $mode_in): bool {}
679712

680-
function mysqli_stmt_bind_param(mysqli_stmt $mysql_stmt, string $types, mixed &...$vars): bool {}
713+
/**
714+
* @param mysqli_stmt $mysql_stmt
715+
* @param string $types
716+
* @param mixed &...$vars
717+
*
718+
* @return bool
719+
*/
720+
function mysqli_stmt_bind_param(mysqli_stmt $mysql_stmt, string $types, &...$vars): bool {}
681721

682-
function mysqli_stmt_bind_result(mysqli_stmt $mysql_stmt, mixed &...$vars): bool {}
722+
/**
723+
* @param mysqli_stmt $mysql_stmt
724+
* @param mixed &...$vars
725+
*
726+
* @return bool
727+
*/
728+
function mysqli_stmt_bind_result(mysqli_stmt $mysql_stmt, &...$vars): bool {}
683729

684730
function mysqli_stmt_close(mysqli_stmt $mysql_stmt): bool {}
685731

@@ -691,17 +737,22 @@ function mysqli_stmt_close(mysqli_stmt $mysql_stmt): bool {}
691737
*/
692738
function mysqli_stmt_data_seek(mysqli_stmt $mysql_stmt, int $offset) {}
693739

694-
function mysqli_stmt_errno(mysqli_stmt $mysql_stmt): int {}
740+
function mysqli_stmt_errno(mysqli_stmt $mysql_stmt): int|bool {}
695741

696-
function mysqli_stmt_error(mysqli_stmt $mysql_stmt): string {}
742+
function mysqli_stmt_error(mysqli_stmt $mysql_stmt): string|bool {}
697743

698744
function mysqli_stmt_error_list(mysqli_stmt $mysql_stmt): array {}
699745

700-
function mysqli_stmt_fetch(mysqli_stmt $mysql_stmt): bool {}
746+
function mysqli_stmt_fetch(mysqli_stmt $mysql_stmt): bool|null {}
701747

702-
function mysqli_stmt_field_count(mysqli_stmt $mysql_stmt): int {}
748+
function mysqli_stmt_field_count(mysqli_stmt $mysql_stmt): int|bool {}
703749

704-
function mysqli_stmt_free_result(mysqli_stmt $mysql_stmt): void {}
750+
/**
751+
* @param mysqli_stmt $mysql_stmt
752+
*
753+
* @return void
754+
*/
755+
function mysqli_stmt_free_result(mysqli_stmt $mysql_stmt) {}
705756

706757
/**
707758
* @param mysqli_stmt $mysql_stmt
@@ -710,7 +761,12 @@ function mysqli_stmt_free_result(mysqli_stmt $mysql_stmt): void {}
710761
*/
711762
function mysqli_stmt_get_result(mysqli_stmt $mysql_stmt) {}
712763

713-
function mysqli_stmt_get_warnings(mysqli_stmt $mysql_stmt): mysqli_warning {}
764+
/**
765+
* @param mysqli_stmt $mysql_stmt
766+
*
767+
* @return mysqli_warning|bool
768+
*/
769+
function mysqli_stmt_get_warnings(mysqli_stmt $mysql_stmt) {}
714770

715771
/**
716772
* @param mysqli $mysql_link
@@ -719,15 +775,15 @@ function mysqli_stmt_get_warnings(mysqli_stmt $mysql_stmt): mysqli_warning {}
719775
*/
720776
function mysqli_stmt_init(mysqli $mysql_link) {}
721777

722-
function mysqli_stmt_insert_id(mysqli_stmt $mysql_stmt): int {}
778+
function mysqli_stmt_insert_id(mysqli_stmt $mysql_stmt): int|bool {}
723779

724780
function mysqli_stmt_more_results(mysqli_stmt $mysql_stmt): bool {}
725781

726782
function mysqli_stmt_next_result(mysqli_stmt $mysql_stmt): bool {}
727783

728-
function mysqli_stmt_num_rows(mysqli_stmt $mysql_stmt): int {}
784+
function mysqli_stmt_num_rows(mysqli_stmt $mysql_stmt): int|bool {}
729785

730-
function mysqli_stmt_param_count(mysqli_stmt $mysql_stmt): int {}
786+
function mysqli_stmt_param_count(mysqli_stmt $mysql_stmt): int|bool {}
731787

732788
function mysqli_stmt_prepare(mysqli_stmt $mysql_stmt, string $query): bool {}
733789

@@ -744,9 +800,9 @@ function mysqli_stmt_send_long_data(mysqli_stmt $mysql_stmt, int $param_nr, stri
744800

745801
function mysqli_stmt_store_result(mysqli_stmt $mysql_stmt): bool {}
746802

747-
function mysqli_stmt_sqlstate(mysqli_stmt $mysql_stmt): string {}
803+
function mysqli_stmt_sqlstate(mysqli_stmt $mysql_stmt): string|bool {}
748804

749-
function mysqli_sqlstate(mysqli $mysqli_link): string {}
805+
function mysqli_sqlstate(mysqli $mysqli_link): string|bool {}
750806

751807
function mysqli_ssl_set(mysqli $mysql_link, string $key, string $cert, string $certificate_authority, string $certificate_authority_path, string $cipher): bool {}
752808

@@ -760,7 +816,7 @@ function mysqli_stat(mysqli $mysql_link): string|false {}
760816
*/
761817
function mysqli_store_result(mysqli $mysql_link, int $flags = 0) {}
762818

763-
function mysqli_thread_id(mysqli $mysql_link): int {}
819+
function mysqli_thread_id(mysqli $mysql_link): int|bool {}
764820

765821
function mysqli_thread_safe(): bool {}
766822

@@ -771,10 +827,17 @@ function mysqli_thread_safe(): bool {}
771827
*/
772828
function mysqli_use_result(mysqli $mysql_link) {}
773829

774-
function mysqli_warning_count(mysqli $mysql_link): int {}
830+
function mysqli_warning_count(mysqli $mysql_link): int|bool {}
775831

776832
function mysqli_refresh(mysqli $mysqli_link, int $options): bool {}
777833

778834
function mysqli_escape_string(mysqli $mysqli_link, string $escapestr): string {}
779835

780-
function mysqli_set_opt(mysqli $mysqli_link, int $mysql_option, mixed $mysql_value): bool {}
836+
/**
837+
* @param mysqli $mysqli_link
838+
* @param int $mysql_option
839+
* @param mixed $mysql_value
840+
*
841+
* @return bool
842+
*/
843+
function mysqli_set_opt(mysqli $mysqli_link, int $mysql_option, $mysql_value): bool {}

0 commit comments

Comments
 (0)