Skip to content

Commit 43b9ef6

Browse files
committed
Use typed properties in ext/zip
1 parent 612609e commit 43b9ef6

File tree

3 files changed

+25
-34
lines changed

3 files changed

+25
-34
lines changed

ext/zip/php_zip.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -859,10 +859,6 @@ static zval *php_zip_property_reader(ze_zip_object *obj, zip_prop_handler *hnd,
859859
ZVAL_EMPTY_STRING(rv);
860860
}
861861
break;
862-
/* case IS_TRUE */
863-
case IS_FALSE:
864-
ZVAL_BOOL(rv, retint);
865-
break;
866862
case IS_LONG:
867863
ZVAL_LONG(rv, retint);
868864
break;

ext/zip/php_zip.stub.php

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,18 @@ function zip_entry_compressionmethod($zip_entry): string|false {}
6666

6767
class ZipArchive implements Countable
6868
{
69-
/** @var int|null */
70-
public $lastId;
71-
72-
/** @var int|null */
73-
public $status;
74-
75-
/** @var int|null */
76-
public $statusSys;
77-
78-
/** @var int|null */
79-
public $numFiles;
80-
81-
/** @var string|null */
82-
public $filename;
83-
84-
/** @var string|null */
85-
public $comment;
69+
/** @readonly */
70+
public int $lastId;
71+
/** @readonly */
72+
public int $status;
73+
/** @readonly */
74+
public int $statusSys;
75+
/** @readonly */
76+
public int $numFiles;
77+
/** @readonly */
78+
public string $filename;
79+
/** @readonly */
80+
public string $comment;
8681

8782
/** @return bool|int */
8883
public function open(string $filename, int $flags = 0) {}

ext/zip/php_zip_arginfo.h

Lines changed: 13 additions & 13 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: a50da348df01027594efd7c8ab7427c05ffea39e */
2+
* Stub hash: d0f7d294c92a3d056e38abc92162c19e10329310 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_open, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
@@ -463,39 +463,39 @@ static zend_class_entry *register_class_ZipArchive(zend_class_entry *class_entry
463463
zend_class_implements(class_entry, 1, class_entry_Countable);
464464

465465
zval property_lastId_default_value;
466-
ZVAL_NULL(&property_lastId_default_value);
466+
ZVAL_UNDEF(&property_lastId_default_value);
467467
zend_string *property_lastId_name = zend_string_init("lastId", sizeof("lastId") - 1, 1);
468-
zend_declare_property_ex(class_entry, property_lastId_name, &property_lastId_default_value, ZEND_ACC_PUBLIC, NULL);
468+
zend_declare_typed_property(class_entry, property_lastId_name, &property_lastId_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
469469
zend_string_release(property_lastId_name);
470470

471471
zval property_status_default_value;
472-
ZVAL_NULL(&property_status_default_value);
472+
ZVAL_UNDEF(&property_status_default_value);
473473
zend_string *property_status_name = zend_string_init("status", sizeof("status") - 1, 1);
474-
zend_declare_property_ex(class_entry, property_status_name, &property_status_default_value, ZEND_ACC_PUBLIC, NULL);
474+
zend_declare_typed_property(class_entry, property_status_name, &property_status_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
475475
zend_string_release(property_status_name);
476476

477477
zval property_statusSys_default_value;
478-
ZVAL_NULL(&property_statusSys_default_value);
478+
ZVAL_UNDEF(&property_statusSys_default_value);
479479
zend_string *property_statusSys_name = zend_string_init("statusSys", sizeof("statusSys") - 1, 1);
480-
zend_declare_property_ex(class_entry, property_statusSys_name, &property_statusSys_default_value, ZEND_ACC_PUBLIC, NULL);
480+
zend_declare_typed_property(class_entry, property_statusSys_name, &property_statusSys_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
481481
zend_string_release(property_statusSys_name);
482482

483483
zval property_numFiles_default_value;
484-
ZVAL_NULL(&property_numFiles_default_value);
484+
ZVAL_UNDEF(&property_numFiles_default_value);
485485
zend_string *property_numFiles_name = zend_string_init("numFiles", sizeof("numFiles") - 1, 1);
486-
zend_declare_property_ex(class_entry, property_numFiles_name, &property_numFiles_default_value, ZEND_ACC_PUBLIC, NULL);
486+
zend_declare_typed_property(class_entry, property_numFiles_name, &property_numFiles_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
487487
zend_string_release(property_numFiles_name);
488488

489489
zval property_filename_default_value;
490-
ZVAL_NULL(&property_filename_default_value);
490+
ZVAL_UNDEF(&property_filename_default_value);
491491
zend_string *property_filename_name = zend_string_init("filename", sizeof("filename") - 1, 1);
492-
zend_declare_property_ex(class_entry, property_filename_name, &property_filename_default_value, ZEND_ACC_PUBLIC, NULL);
492+
zend_declare_typed_property(class_entry, property_filename_name, &property_filename_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
493493
zend_string_release(property_filename_name);
494494

495495
zval property_comment_default_value;
496-
ZVAL_NULL(&property_comment_default_value);
496+
ZVAL_UNDEF(&property_comment_default_value);
497497
zend_string *property_comment_name = zend_string_init("comment", sizeof("comment") - 1, 1);
498-
zend_declare_property_ex(class_entry, property_comment_name, &property_comment_default_value, ZEND_ACC_PUBLIC, NULL);
498+
zend_declare_typed_property(class_entry, property_comment_name, &property_comment_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
499499
zend_string_release(property_comment_name);
500500

501501
return class_entry;

0 commit comments

Comments
 (0)