Skip to content

Commit 0b01d58

Browse files
authored
Declare tentative return types for ext/oci8 (php#7070)
1 parent 83916e8 commit 0b01d58

File tree

2 files changed

+90
-88
lines changed

2 files changed

+90
-88
lines changed

ext/oci8/oci8.stub.php

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -545,177 +545,177 @@ function oci_unregister_taf_callback($connection): bool {}
545545
class OCILob {
546546
/**
547547
* @alias oci_lob_save
548-
* @return bool
548+
* @tentative-return-type
549549
*/
550-
public function save(string $data, int $offset = 0) {}
550+
public function save(string $data, int $offset = 0): bool {}
551551

552552
/**
553553
* @alias oci_lob_import
554-
* @return bool
554+
* @tentative-return-type
555555
*/
556-
public function import(string $filename) {}
556+
public function import(string $filename): bool {}
557557

558558
/**
559559
* @alias oci_lob_import
560-
* @return bool
560+
* @tentative-return-type
561561
*/
562-
public function savefile(string $filename) {}
562+
public function savefile(string $filename): bool {}
563563

564564
/**
565565
* @alias oci_lob_load
566-
* @return string|false
566+
* @tentative-return-type
567567
*/
568-
public function load() {}
568+
public function load(): string|false {}
569569

570570
/**
571571
* @alias oci_lob_read
572-
* @return string|false
572+
* @tentative-return-type
573573
*/
574-
public function read(int $length) {}
574+
public function read(int $length): string|false {}
575575

576576
/**
577577
* @alias oci_lob_eof
578-
* @return bool
578+
* @tentative-return-type
579579
*/
580-
public function eof() {}
580+
public function eof(): bool {}
581581

582582
/**
583583
* @alias oci_lob_tell
584-
* @return int|false
584+
* @tentative-return-type
585585
*/
586-
public function tell() {}
586+
public function tell(): int|false {}
587587

588588
/**
589589
* @alias oci_lob_rewind
590-
* @return bool
590+
* @tentative-return-type
591591
*/
592-
public function rewind() {}
592+
public function rewind(): bool {}
593593

594594
/**
595595
* @alias oci_lob_seek
596-
* @return bool
596+
* @tentative-return-type
597597
*/
598-
public function seek(int $offset, int $whence = OCI_SEEK_SET) {}
598+
public function seek(int $offset, int $whence = OCI_SEEK_SET): bool {}
599599

600600
/**
601601
* @alias oci_lob_size
602-
* @return int|false
602+
* @tentative-return-type
603603
*/
604-
public function size() {}
604+
public function size(): int|false {}
605605

606606
/**
607607
* @alias oci_lob_write
608-
* @return int|false
608+
* @tentative-return-type
609609
*/
610-
public function write(string $data, ?int $length = null) {}
610+
public function write(string $data, ?int $length = null): int|false {}
611611

612612
/**
613613
* @alias oci_lob_append
614-
* @return bool
614+
* @tentative-return-type
615615
*/
616-
public function append(OCILob $from) {}
616+
public function append(OCILob $from): bool {}
617617

618618
/**
619619
* @alias oci_lob_truncate
620-
* @return bool
620+
* @tentative-return-type
621621
*/
622-
public function truncate(int $length = 0) {}
622+
public function truncate(int $length = 0): bool {}
623623

624624
/**
625625
* @alias oci_lob_erase
626-
* @return int|false
626+
* @tentative-return-type
627627
*/
628-
public function erase(?int $offset = null, ?int $length = null) {}
628+
public function erase(?int $offset = null, ?int $length = null): int|false {}
629629

630630
/**
631631
* @alias oci_lob_flush
632-
* @return bool
632+
* @tentative-return-type
633633
*/
634634
public function flush(int $flag = 0): bool {}
635635

636636
/**
637637
* @alias ocisetbufferinglob
638-
* @return bool
638+
* @tentative-return-type
639639
*/
640-
public function setbuffering(bool $mode) {}
640+
public function setbuffering(bool $mode): bool {}
641641

642642
/**
643643
* @alias ocigetbufferinglob
644-
* @return bool
644+
* @tentative-return-type
645645
*/
646-
public function getbuffering() {}
646+
public function getbuffering(): bool {}
647647

648648
/**
649649
* @alias oci_lob_export
650-
* @return bool
650+
* @tentative-return-type
651651
*/
652-
public function writetofile(string $filename, ?int $offset = null, ?int $length = null) {}
652+
public function writetofile(string $filename, ?int $offset = null, ?int $length = null): bool {}
653653

654654
/**
655655
* @alias oci_lob_export
656-
* @return bool
656+
* @tentative-return-type
657657
*/
658-
public function export(string $filename, ?int $offset = null, ?int $length = null) {}
658+
public function export(string $filename, ?int $offset = null, ?int $length = null): bool {}
659659

660-
/** @return bool */
661-
public function writetemporary(string $data, int $type = OCI_TEMP_CLOB) {}
660+
/** @tentative-return-type */
661+
public function writetemporary(string $data, int $type = OCI_TEMP_CLOB): bool {}
662662

663-
/** @return bool */
664-
public function close() {}
663+
/** @tentative-return-type */
664+
public function close(): bool {}
665665

666666
/**
667667
* @alias oci_free_descriptor
668-
* @return bool
668+
* @tentative-return-type
669669
*/
670-
public function free() {}
670+
public function free(): bool {}
671671
}
672672

673673
class OCICollection {
674674
/**
675675
* @alias oci_free_collection
676-
* @return bool
676+
* @tentative-return-type
677677
*/
678-
public function free() {}
678+
public function free(): bool {}
679679

680680
/**
681681
* @alias oci_collection_append
682-
* @return bool
682+
* @tentative-return-type
683683
*/
684-
public function append(string $value) {}
684+
public function append(string $value): bool {}
685685

686686
/**
687687
* @alias oci_collection_element_get
688-
* @return string|float|null|false
688+
* @tentative-return-type
689689
*/
690-
public function getElem(int $index) {}
690+
public function getElem(int $index): string|float|null|false {}
691691

692692
/**
693693
* @alias oci_collection_assign
694-
* @return bool
694+
* @tentative-return-type
695695
*/
696-
public function assign(OCICollection $from) {}
696+
public function assign(OCICollection $from): bool {}
697697

698698
/**
699699
* @alias oci_collection_element_assign
700-
* @return bool
700+
* @tentative-return-type
701701
*/
702-
public function assignelem(int $index, string $value) {}
702+
public function assignelem(int $index, string $value): bool {}
703703

704704
/**
705705
* @alias oci_collection_size
706-
* @return int|false
706+
* @tentative-return-type
707707
*/
708-
public function size() {}
708+
public function size(): int|false {}
709709

710710
/**
711711
* @alias oci_collection_max
712-
* @return int|false
712+
* @tentative-return-type
713713
*/
714-
public function max() {}
714+
public function max(): int|false {}
715715

716716
/**
717717
* @alias oci_collection_trim
718-
* @return bool
718+
* @tentative-return-type
719719
*/
720-
public function trim(int $num) {}
720+
public function trim(int $num): bool {}
721721
}

ext/oci8/oci8_arginfo.h

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: dc95519a7182bfc92aa84802c0086ae9f49579a8 */
2+
* Stub hash: e3443a72d951a32015cf1324f5234dc7c50fb2fa */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_define_by_name, 0, 3, _IS_BOOL, 0)
55
ZEND_ARG_INFO(0, statement)
@@ -438,106 +438,108 @@ ZEND_END_ARG_INFO()
438438

439439
#define arginfo_oci_unregister_taf_callback arginfo_oci_rollback
440440

441-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_save, 0, 0, 1)
441+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_save, 0, 1, _IS_BOOL, 0)
442442
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
443443
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 0, "0")
444444
ZEND_END_ARG_INFO()
445445

446-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_import, 0, 0, 1)
446+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_import, 0, 1, _IS_BOOL, 0)
447447
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
448448
ZEND_END_ARG_INFO()
449449

450450
#define arginfo_class_OCILob_savefile arginfo_class_OCILob_import
451451

452-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_load, 0, 0, 0)
452+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_OCILob_load, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
453453
ZEND_END_ARG_INFO()
454454

455-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_read, 0, 0, 1)
455+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_OCILob_read, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
456456
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
457457
ZEND_END_ARG_INFO()
458458

459-
#define arginfo_class_OCILob_eof arginfo_class_OCILob_load
459+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_eof, 0, 0, _IS_BOOL, 0)
460+
ZEND_END_ARG_INFO()
460461

461-
#define arginfo_class_OCILob_tell arginfo_class_OCILob_load
462+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_OCILob_tell, 0, 0, MAY_BE_LONG|MAY_BE_FALSE)
463+
ZEND_END_ARG_INFO()
462464

463-
#define arginfo_class_OCILob_rewind arginfo_class_OCILob_load
465+
#define arginfo_class_OCILob_rewind arginfo_class_OCILob_eof
464466

465-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_seek, 0, 0, 1)
467+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_seek, 0, 1, _IS_BOOL, 0)
466468
ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
467469
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, whence, IS_LONG, 0, "OCI_SEEK_SET")
468470
ZEND_END_ARG_INFO()
469471

470-
#define arginfo_class_OCILob_size arginfo_class_OCILob_load
472+
#define arginfo_class_OCILob_size arginfo_class_OCILob_tell
471473

472-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_write, 0, 0, 1)
474+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_OCILob_write, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
473475
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
474476
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
475477
ZEND_END_ARG_INFO()
476478

477-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_append, 0, 0, 1)
479+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_append, 0, 1, _IS_BOOL, 0)
478480
ZEND_ARG_OBJ_INFO(0, from, OCILob, 0)
479481
ZEND_END_ARG_INFO()
480482

481-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_truncate, 0, 0, 0)
483+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_truncate, 0, 0, _IS_BOOL, 0)
482484
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 0, "0")
483485
ZEND_END_ARG_INFO()
484486

485-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_erase, 0, 0, 0)
487+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_OCILob_erase, 0, 0, MAY_BE_LONG|MAY_BE_FALSE)
486488
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 1, "null")
487489
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
488490
ZEND_END_ARG_INFO()
489491

490-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_flush, 0, 0, _IS_BOOL, 0)
492+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_flush, 0, 0, _IS_BOOL, 0)
491493
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flag, IS_LONG, 0, "0")
492494
ZEND_END_ARG_INFO()
493495

494-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_setbuffering, 0, 0, 1)
496+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_setbuffering, 0, 1, _IS_BOOL, 0)
495497
ZEND_ARG_TYPE_INFO(0, mode, _IS_BOOL, 0)
496498
ZEND_END_ARG_INFO()
497499

498-
#define arginfo_class_OCILob_getbuffering arginfo_class_OCILob_load
500+
#define arginfo_class_OCILob_getbuffering arginfo_class_OCILob_eof
499501

500-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_writetofile, 0, 0, 1)
502+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_writetofile, 0, 1, _IS_BOOL, 0)
501503
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
502504
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 1, "null")
503505
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
504506
ZEND_END_ARG_INFO()
505507

506508
#define arginfo_class_OCILob_export arginfo_class_OCILob_writetofile
507509

508-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_writetemporary, 0, 0, 1)
510+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_writetemporary, 0, 1, _IS_BOOL, 0)
509511
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
510512
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "OCI_TEMP_CLOB")
511513
ZEND_END_ARG_INFO()
512514

513-
#define arginfo_class_OCILob_close arginfo_class_OCILob_load
515+
#define arginfo_class_OCILob_close arginfo_class_OCILob_eof
514516

515-
#define arginfo_class_OCILob_free arginfo_class_OCILob_load
517+
#define arginfo_class_OCILob_free arginfo_class_OCILob_eof
516518

517-
#define arginfo_class_OCICollection_free arginfo_class_OCILob_load
519+
#define arginfo_class_OCICollection_free arginfo_class_OCILob_eof
518520

519-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCICollection_append, 0, 0, 1)
521+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCICollection_append, 0, 1, _IS_BOOL, 0)
520522
ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
521523
ZEND_END_ARG_INFO()
522524

523-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCICollection_getElem, 0, 0, 1)
525+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_OCICollection_getElem, 0, 1, MAY_BE_STRING|MAY_BE_DOUBLE|MAY_BE_NULL|MAY_BE_FALSE)
524526
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
525527
ZEND_END_ARG_INFO()
526528

527-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCICollection_assign, 0, 0, 1)
529+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCICollection_assign, 0, 1, _IS_BOOL, 0)
528530
ZEND_ARG_OBJ_INFO(0, from, OCICollection, 0)
529531
ZEND_END_ARG_INFO()
530532

531-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCICollection_assignelem, 0, 0, 2)
533+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCICollection_assignelem, 0, 2, _IS_BOOL, 0)
532534
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
533535
ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
534536
ZEND_END_ARG_INFO()
535537

536-
#define arginfo_class_OCICollection_size arginfo_class_OCILob_load
538+
#define arginfo_class_OCICollection_size arginfo_class_OCILob_tell
537539

538-
#define arginfo_class_OCICollection_max arginfo_class_OCILob_load
540+
#define arginfo_class_OCICollection_max arginfo_class_OCILob_tell
539541

540-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCICollection_trim, 0, 0, 1)
542+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCICollection_trim, 0, 1, _IS_BOOL, 0)
541543
ZEND_ARG_TYPE_INFO(0, num, IS_LONG, 0)
542544
ZEND_END_ARG_INFO()
543545

0 commit comments

Comments
 (0)