]> granicus.if.org Git - php/commitdiff
- Fix protos and add notes to the docs
authorMarcus Boerger <helly@php.net>
Thu, 29 Apr 2004 22:52:49 +0000 (22:52 +0000)
committerMarcus Boerger <helly@php.net>
Thu, 29 Apr 2004 22:52:49 +0000 (22:52 +0000)
- Reorder func prototypes to show what is common and what is specific

ext/spl/spl.php
ext/spl/spl_array.c

index bf3eeac29de2ba29efa5f1deaabad98b23a9fe80..d5c274e687e7e0098576d5e8e7f64bd801d22e3c 100755 (executable)
@@ -143,10 +143,14 @@ class ArrayObject implements IteratorAggregate, ArrayAccess
        function offsetUnset($index);
 
        /** \param $value is appended as last element
+        * \warning this method cannot be called when the ArrayObject refers to 
+        *          an object.
         */     
        function append($value);
 
        /** \return a \b copy of the array
+        * \note when the ArrayObject refers to an object then this method 
+        *       returns an array of the public properties.
         */     
        function getArrayCopy();
 }
@@ -190,10 +194,14 @@ class ArrayIterator implements Iterator, SeekableIterator, ArrayAccess
        function offsetUnset($index);
 
        /** \param $value is appended as last element
+        * \warning this method cannot be called when the ArrayIterator refers to 
+        *          an object.
         */     
        function append($value);
 
        /** \return a \b copy of the array
+        * \note when the ArrayIterator refers to an object then this method 
+        *       returns an array of the public properties.
         */     
        function getArrayCopy();
 
index 67f39830cb368a909e7698bfaf411475151f7c4c..38f41abf10f1e202d2a4bfd3ee414f6d1c079f49 100755 (executable)
@@ -77,7 +77,6 @@ ZEND_END_ARG_INFO();
 
 static zend_function_entry spl_funcs_ArrayObject[] = {
        SPL_ME(Array, __construct,   arginfo_array___construct, ZEND_ACC_PUBLIC)
-       SPL_ME(Array, getIterator,   NULL, ZEND_ACC_PUBLIC)
        SPL_ME(Array, offsetExists,  arginfo_array_offsetGet, ZEND_ACC_PUBLIC)
        SPL_ME(Array, offsetGet,     arginfo_array_offsetGet, ZEND_ACC_PUBLIC)
        SPL_ME(Array, offsetSet,     arginfo_array_offsetSet, ZEND_ACC_PUBLIC)
@@ -85,24 +84,27 @@ static zend_function_entry spl_funcs_ArrayObject[] = {
        SPL_ME(Array, append,        arginfo_array_append,    ZEND_ACC_PUBLIC)
        SPL_ME(Array, getArrayCopy,  NULL, ZEND_ACC_PUBLIC)
        SPL_ME(Array, count,         NULL, ZEND_ACC_PUBLIC)
+       /* ArrayObject specific */
+       SPL_ME(Array, getIterator,   NULL, ZEND_ACC_PUBLIC)
        {NULL, NULL, NULL}
 };
 
 static zend_function_entry spl_funcs_ArrayIterator[] = {
        SPL_ME(Array, __construct,   arginfo_array___construct, ZEND_ACC_PUBLIC)
-       SPL_ME(Array, rewind,        NULL, ZEND_ACC_PUBLIC)
-       SPL_ME(Array, current,       NULL, ZEND_ACC_PUBLIC)
-       SPL_ME(Array, key,           NULL, ZEND_ACC_PUBLIC)
-       SPL_ME(Array, next,          NULL, ZEND_ACC_PUBLIC)
-       SPL_ME(Array, valid,         NULL, ZEND_ACC_PUBLIC)
        SPL_ME(Array, offsetExists,  arginfo_array_offsetGet, ZEND_ACC_PUBLIC)
        SPL_ME(Array, offsetGet,     arginfo_array_offsetGet, ZEND_ACC_PUBLIC)
        SPL_ME(Array, offsetSet,     arginfo_array_offsetSet, ZEND_ACC_PUBLIC)
        SPL_ME(Array, offsetUnset,   arginfo_array_offsetGet, ZEND_ACC_PUBLIC)
        SPL_ME(Array, append,        arginfo_array_append,    ZEND_ACC_PUBLIC)
        SPL_ME(Array, getArrayCopy,  NULL, ZEND_ACC_PUBLIC)
-       SPL_ME(Array, seek,          arginfo_array_seek,    ZEND_ACC_PUBLIC)
        SPL_ME(Array, count,         NULL, ZEND_ACC_PUBLIC)
+       /* ArrayIterator specific */
+       SPL_ME(Array, rewind,        NULL, ZEND_ACC_PUBLIC)
+       SPL_ME(Array, current,       NULL, ZEND_ACC_PUBLIC)
+       SPL_ME(Array, key,           NULL, ZEND_ACC_PUBLIC)
+       SPL_ME(Array, next,          NULL, ZEND_ACC_PUBLIC)
+       SPL_ME(Array, valid,         NULL, ZEND_ACC_PUBLIC)
+       SPL_ME(Array, seek,          arginfo_array_seek,        ZEND_ACC_PUBLIC)
        {NULL, NULL, NULL}
 };
 
@@ -327,6 +329,7 @@ static int spl_array_has_dimension(zval *object, zval *offset, int check_empty T
 /* }}} */
 
 /* {{{ proto bool ArrayObject::offsetExists(mixed $index)
+       proto bool ArrayIterator::offsetExists(mixed $index)
  Returns whether the requested $index exists. */
 SPL_METHOD(Array, offsetExists)
 {
@@ -338,6 +341,7 @@ SPL_METHOD(Array, offsetExists)
 } /* }}} */
 
 /* {{{ proto bool ArrayObject::offsetGet(mixed $index)
+       proto bool ArrayIterator::offsetGet(mixed $index)
  Returns the value at the specified $index. */
 SPL_METHOD(Array, offsetGet)
 {
@@ -349,7 +353,8 @@ SPL_METHOD(Array, offsetGet)
        RETURN_ZVAL(value, 0, 1);
 } /* }}} */
 
-/* {{{ proto bool ArrayObject::offsetSet(mixed $index, mixed $newval)
+/* {{{ proto void ArrayObject::offsetSet(mixed $index, mixed $newval)
+       proto void ArrayIterator::offsetSet(mixed $index, mixed $newval)
  Sets the value at the specified $index to $newval. */
 SPL_METHOD(Array, offsetSet)
 {
@@ -360,7 +365,8 @@ SPL_METHOD(Array, offsetSet)
        spl_array_write_dimension(getThis(), index, value TSRMLS_CC);
 } /* }}} */
 
-/* {{{ proto bool ArrayObject::append(mixed $newval)
+/* {{{ proto void ArrayObject::append(mixed $newval)
+       proto void ArrayIterator::append(mixed $newval)
  Appends the value (cannot be called for objects). */
 SPL_METHOD(Array, append)
 {
@@ -388,7 +394,8 @@ SPL_METHOD(Array, append)
        }
 } /* }}} */
 
-/* {{{ proto bool ArrayObject::offsetUnset(mixed $index)
+/* {{{ proto void ArrayObject::offsetUnset(mixed $index)
+       proto void ArrayIterator::offsetUnset(mixed $index)
  Unsets the value at the specified $index. */
 SPL_METHOD(Array, offsetUnset)
 {
@@ -400,6 +407,7 @@ SPL_METHOD(Array, offsetUnset)
 } /* }}} */
 
 /* {{ proto array ArrayObject::getArrayCopy()
+      proto array ArrayIterator::getArrayCopy()
  Return a copy of the contained array */
 SPL_METHOD(Array, getArrayCopy)
 {
@@ -713,7 +721,7 @@ SPL_METHOD(Array, rewind)
 }
 /* }}} */
 
-/* {{{ proto bool ArrayIterator::seek(int $position)
+/* {{{ proto void ArrayIterator::seek(int $position)
  Seek to position. */
 SPL_METHOD(Array, seek)
 {
@@ -736,7 +744,8 @@ SPL_METHOD(Array, seek)
        while (position-- > 0 && spl_array_next(intern TSRMLS_CC));
 } /* }}} */
 
-/* {{{ proto bool ArrayObject::count()
+/* {{{ proto int ArrayObject::count()
+       proto int ArrayIterator::count()
  Return the number of elements in the Iterator. */
 SPL_METHOD(Array, count)
 {