adding return type hints to php ext

pull/9370/head
Brett McBride 3 years ago
parent c26b1c87d7
commit fabe73db6f
  1. 68
      php/ext/google/protobuf/array.c
  2. 65
      php/ext/google/protobuf/map.c

@ -287,7 +287,7 @@ PHP_METHOD(RepeatedField, append) {
}
/**
* RepeatedField::offsetExists()
* RepeatedField::offsetExists(): bool
*
* Implements the ArrayAccess interface. Invoked when PHP code calls:
*
@ -341,7 +341,7 @@ PHP_METHOD(RepeatedField, offsetGet) {
}
/**
* RepeatedField::offsetSet()
* RepeatedField::offsetSet(): void
*
* Implements the ArrayAccess interface. Invoked when PHP code calls:
*
@ -386,7 +386,7 @@ PHP_METHOD(RepeatedField, offsetSet) {
}
/**
* RepeatedField::offsetUnset()
* RepeatedField::offsetUnset(): void
*
* Implements the ArrayAccess interface. Invoked when PHP code calls:
*
@ -416,7 +416,7 @@ PHP_METHOD(RepeatedField, offsetUnset) {
}
/**
* RepeatedField::count()
* RepeatedField::count(): int
*
* Implements the Countable interface. Invoked when PHP code calls:
*
@ -436,7 +436,7 @@ PHP_METHOD(RepeatedField, count) {
}
/**
* RepeatedField::getIterator()
* RepeatedField::getIterator(): Traversable
*
* Implements the IteratorAggregate interface. Invoked when PHP code calls:
*
@ -463,20 +463,35 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetGet, 0, 0, 1)
ZEND_ARG_INFO(0, index)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetSet, 0, 0, 2)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_count, 0, 0, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_offsetSet, 0, 2, IS_VOID, 0)
ZEND_ARG_INFO(0, index)
ZEND_ARG_INFO(0, newval)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_offsetUnset, 0, 0, IS_VOID, 0)
ZEND_ARG_INFO(0, index)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_offsetExists, 0, 0, _IS_BOOL, 0)
ZEND_ARG_INFO(0, index)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getIterator, 0, 0, Traversable, 0)
ZEND_END_ARG_INFO()
static zend_function_entry repeated_field_methods[] = {
PHP_ME(RepeatedField, __construct, arginfo_construct, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedField, append, arginfo_append, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedField, offsetExists, arginfo_offsetGet, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedField, offsetGet, arginfo_offsetGet, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedField, offsetSet, arginfo_offsetSet, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedField, offsetUnset, arginfo_offsetGet, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedField, count, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedField, getIterator, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedField, __construct, arginfo_construct, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedField, append, arginfo_append, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedField, offsetExists, arginfo_offsetExists, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedField, offsetGet, arginfo_offsetGet, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedField, offsetSet, arginfo_offsetSet, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedField, offsetUnset, arginfo_offsetUnset, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedField, count, arginfo_count, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedField, getIterator, arginfo_getIterator, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
@ -550,7 +565,7 @@ static void RepeatedFieldIter_make(zval *val, zval *repeated_field) {
*/
/**
* RepeatedFieldIter::rewind()
* RepeatedFieldIter::rewind(): void
*
* Implements the Iterator interface. Sets the iterator to the first element.
*/
@ -593,7 +608,7 @@ PHP_METHOD(RepeatedFieldIter, key) {
}
/**
* RepeatedFieldIter::next()
* RepeatedFieldIter::next(): void
*
* Implements the Iterator interface. Advances to the next element.
*/
@ -603,7 +618,7 @@ PHP_METHOD(RepeatedFieldIter, next) {
}
/**
* RepeatedFieldIter::valid()
* RepeatedFieldIter::valid(): bool
*
* Implements the Iterator interface. Returns true if this is a valid element.
*/
@ -613,12 +628,21 @@ PHP_METHOD(RepeatedFieldIter, valid) {
RETURN_BOOL(intern->position < upb_array_size(field->array));
}
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_next, 0, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_valid, 0, 0, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_rewind, 0, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()
static zend_function_entry repeated_field_iter_methods[] = {
PHP_ME(RepeatedFieldIter, rewind, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedFieldIter, current, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedFieldIter, key, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedFieldIter, next, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedFieldIter, valid, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedFieldIter, rewind, arginfo_rewind, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedFieldIter, current, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedFieldIter, key, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedFieldIter, next, arginfo_next, ZEND_ACC_PUBLIC)
PHP_ME(RepeatedFieldIter, valid, arginfo_valid, ZEND_ACC_PUBLIC)
ZEND_FE_END
};

@ -305,7 +305,7 @@ PHP_METHOD(MapField, __construct) {
}
/**
* MapField::offsetExists()
* MapField::offsetExists(): bool
*
* Implements the ArrayAccess interface. Invoked when PHP code calls:
*
@ -361,7 +361,7 @@ PHP_METHOD(MapField, offsetGet) {
}
/**
* MapField::offsetSet()
* MapField::offsetSet(): void
*
* Implements the ArrayAccess interface. Invoked when PHP code calls:
*
@ -389,7 +389,7 @@ PHP_METHOD(MapField, offsetSet) {
}
/**
* MapField::offsetUnset()
* MapField::offsetUnset(): void
*
* Implements the ArrayAccess interface. Invoked when PHP code calls:
*
@ -413,7 +413,7 @@ PHP_METHOD(MapField, offsetUnset) {
}
/**
* MapField::count()
* MapField::count(): int
*
* Implements the Countable interface. Invoked when PHP code calls:
*
@ -433,7 +433,7 @@ PHP_METHOD(MapField, count) {
}
/**
* MapField::getIterator()
* MapField::getIterator(): Traversable
*
* Implements the IteratorAggregate interface. Invoked when PHP code calls:
*
@ -457,19 +457,33 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetGet, 0, 0, 1)
ZEND_ARG_INFO(0, index)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetSet, 0, 0, 2)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_offsetSet, 0, 2, IS_VOID, 0)
ZEND_ARG_INFO(0, index)
ZEND_ARG_INFO(0, newval)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_offsetUnset, 0, 0, IS_VOID, 0)
ZEND_ARG_INFO(0, index)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_offsetExists, 0, 0, _IS_BOOL, 0)
ZEND_ARG_INFO(0, index)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getIterator, 0, 0, Traversable, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_count, 0, 0, IS_LONG, 0)
ZEND_END_ARG_INFO()
static zend_function_entry MapField_methods[] = {
PHP_ME(MapField, __construct, arginfo_construct, ZEND_ACC_PUBLIC)
PHP_ME(MapField, offsetExists, arginfo_offsetGet, ZEND_ACC_PUBLIC)
PHP_ME(MapField, offsetGet, arginfo_offsetGet, ZEND_ACC_PUBLIC)
PHP_ME(MapField, offsetSet, arginfo_offsetSet, ZEND_ACC_PUBLIC)
PHP_ME(MapField, offsetUnset, arginfo_offsetGet, ZEND_ACC_PUBLIC)
PHP_ME(MapField, count, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(MapField, getIterator, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(MapField, __construct, arginfo_construct, ZEND_ACC_PUBLIC)
PHP_ME(MapField, offsetExists, arginfo_offsetExists, ZEND_ACC_PUBLIC)
PHP_ME(MapField, offsetGet, arginfo_offsetGet, ZEND_ACC_PUBLIC)
PHP_ME(MapField, offsetSet, arginfo_offsetSet, ZEND_ACC_PUBLIC)
PHP_ME(MapField, offsetUnset, arginfo_offsetUnset, ZEND_ACC_PUBLIC)
PHP_ME(MapField, count, arginfo_count, ZEND_ACC_PUBLIC)
PHP_ME(MapField, getIterator, arginfo_getIterator, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
@ -547,7 +561,7 @@ static void MapFieldIter_make(zval *val, zval *map_field) {
*/
/**
* MapFieldIter::rewind()
* MapFieldIter::rewind(): void
*
* Implements the Iterator interface. Sets the iterator to the first element.
*/
@ -587,7 +601,7 @@ PHP_METHOD(MapFieldIter, key) {
}
/**
* MapFieldIter::next()
* MapFieldIter::next(): void
*
* Implements the Iterator interface. Advances to the next element.
*/
@ -598,7 +612,7 @@ PHP_METHOD(MapFieldIter, next) {
}
/**
* MapFieldIter::valid()
* MapFieldIter::valid(): bool
*
* Implements the Iterator interface. Returns true if this is a valid element.
*/
@ -609,12 +623,21 @@ PHP_METHOD(MapFieldIter, valid) {
RETURN_BOOL(!done);
}
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_rewind, 0, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_next, 0, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_valid, 0, 0, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
static zend_function_entry map_field_iter_methods[] = {
PHP_ME(MapFieldIter, rewind, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(MapFieldIter, current, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(MapFieldIter, key, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(MapFieldIter, next, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(MapFieldIter, valid, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(MapFieldIter, rewind, arginfo_rewind, ZEND_ACC_PUBLIC)
PHP_ME(MapFieldIter, current, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(MapFieldIter, key, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(MapFieldIter, next, arginfo_next, ZEND_ACC_PUBLIC)
PHP_ME(MapFieldIter, valid, arginfo_valid, ZEND_ACC_PUBLIC)
ZEND_FE_END
};

Loading…
Cancel
Save