update arginfo. format code.

This commit is contained in:
CismonX 2018-08-22 16:35:27 +08:00
parent ac28d9eaa6
commit 4754c5a3d6
3 changed files with 39 additions and 26 deletions

View File

@ -52,6 +52,10 @@ ZEND_BEGIN_ARG_INFO(n_arginfo, 0)
ZEND_ARG_TYPE_INFO(0, n, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(flags_arginfo, 0)
ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(predicate_arginfo, 0)
ZEND_ARG_CALLABLE_INFO(0, predicate, 0)
ZEND_END_ARG_INFO()
@ -60,6 +64,11 @@ ZEND_BEGIN_ARG_INFO(selector_arginfo, 0)
ZEND_ARG_CALLABLE_INFO(0, selector, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(selector_flags_arginfo, 0)
ZEND_ARG_CALLABLE_INFO(0, selector, 0)
ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(operation_arginfo, 0)
ZEND_ARG_CALLABLE_INFO(0, operation, 0)
ZEND_END_ARG_INFO()
@ -169,11 +178,11 @@ const zend_function_entry collection_methods[] = {
PHP_ME(Collection, lastIndexOf, element_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, map, transform_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, mapTo, destination_transform_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, max, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Collection, maxBy, selector_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, max, flags_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, maxBy, selector_flags_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, maxWith, comparator_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, min, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Collection, minBy, selector_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, min, flags_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, minBy, selector_flags_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, minWith, comparator_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, minus, elements_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, minusAssign, elements_arginfo, ZEND_ACC_PUBLIC)
@ -202,15 +211,15 @@ const zend_function_entry collection_methods[] = {
PHP_ME(Collection, set, key_value_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, single, predicate_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, slice, keys_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, sort, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Collection, sortBy, selector_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, sortByDescending, selector_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, sortDescending, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Collection, sort, flags_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, sortBy, selector_flags_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, sortByDescending, selector_flags_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, sortDescending, flags_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, sortWith, comparator_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, sorted, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Collection, sortedBy, selector_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, sortedByDescending, selector_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, sortedDescending, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Collection, sorted, flags_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, sortedBy, selector_flags_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, sortedByDescending, selector_flags_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, sortedDescending, flags_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, sortedWith, comparator_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, take, n_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(Collection, takeLast, n_arginfo, ZEND_ACC_PUBLIC)

View File

@ -8,25 +8,29 @@
#define PHP_COLLECTIONS_H
extern zend_module_entry collections_module_entry;
#define phpext_collections_ptr &collections_module_entry
#define phpext_collections_ptr &collections_module_entry
#define PHP_COLLECTIONS_VERSION "0.1.0"
#define PHP_COLLECTIONS_VERSION "0.1.0"
#ifdef PHP_WIN32
#define PHP_COLLECTIONS_API __declspec(dllexport)
#define PHP_COLLECTIONS_API __declspec(dllexport)
#elif defined(__GNUC__) && __GNUC__ >= 4
#define PHP_COLLECTIONS_API __attribute__ ((visibility("default")))
#define PHP_COLLECTIONS_API __attribute__ ((visibility("default")))
#else
#define PHP_COLLECTIONS_API
#endif
#if PHP_VERSION_ID < 70300
#define GC_ADDREF(p) ++GC_REFCOUNT(p)
#define GC_DELREF(p) --GC_REFCOUNT(p)
#if PHP_VERSION_ID < 70100
#error "This extension requires PHP 7.1 and above."
#endif
#define PHP_COLLECTIONS_COMPARE_NATURAL (1 << 0)
#define PHP_COLLECTIONS_FOLD_CASE (1 << 1)
#if PHP_VERSION_ID < 70300
#define GC_ADDREF(p) ++GC_REFCOUNT(p)
#define GC_DELREF(p) --GC_REFCOUNT(p)
#endif
#define PHP_COLLECTIONS_COMPARE_NATURAL (1 << 0)
#define PHP_COLLECTIONS_FOLD_CASE (1 << 1)
ZEND_BEGIN_MODULE_GLOBALS(collections)
zend_fcall_info* fci;
@ -39,9 +43,9 @@ ZEND_EXTERN_MODULE_GLOBALS(collections)
#ifdef COMPILE_DL_COLLECTIONS
ZEND_TSRMLS_CACHE_EXTERN()
#endif
#define COLLECTIONS_G(v) TSRMG(collections_globals_id, zend_collections_globals*, v)
#define COLLECTIONS_G(v) TSRMG(collections_globals_id, zend_collections_globals*, v)
#else
#define COLLECTIONS_G(v) (collections_globals.v)
#define COLLECTIONS_G(v) (collections_globals.v)
#endif
extern PHP_COLLECTIONS_API zend_class_entry* collections_collection_ce;
@ -61,4 +65,4 @@ void collection_offset_unset(zval* object, zval* offset);
extern const zend_function_entry collection_methods[];
extern const zend_function_entry pair_methods[];
#endif // !PHP_COLLECTIONS_FE_H
#endif // !PHP_COLLECTIONS_H

View File

@ -743,10 +743,10 @@ class Collection implements ArrayAccess, Countable
/**
* Sorts the collection in-place according to the specified order of its elements.
*
* @param int $order[optional]
* @param int $flags[optional]
* @return void
*/
function sort($order) {}
function sort($flags) {}
/**
* Sorts elements in the collection in-place according to the specified order of the value returned