Edit report at https://bugs.php.net/bug.php?id=60759&edit=1

 ID:                 60759
 Patch added by:     dragoo...@php.net
 Reported by:        dragoo...@php.net
 Summary:            SplDoublyLinkedList->clear()
 Status:             Open
 Type:               Feature/Change Request
 Package:            SPL related
 Operating System:   N/A
 PHP Version:        5.4.0RC5
 Block user comment: N
 Private report:     N

 New Comment:

The following patch has been added/updated:

Patch Name: spl_dllist_clear
Revision:   1326667071
URL:        
https://bugs.php.net/patch-display.php?bug=60759&patch=spl_dllist_clear&revision=1326667071


Previous Comments:
------------------------------------------------------------------------
[2012-01-15 22:37:16] dragoo...@php.net

I think it's much more appropriate to rename this to clear() as it implies 
wiping 
contents of something. The original idea of reset() wasn't a good one as the 
term 
'reset' in PHP usually refers to resetting an internal pointer of a list.

New patch attached as spl_dllist_clear.

------------------------------------------------------------------------
[2012-01-15 22:29:54] dragoo...@php.net

Renaming the reset() method to clear()

------------------------------------------------------------------------
[2012-01-15 03:26:24] dragoo...@php.net

Description:
------------
The patch adds a reset() method to the SplDoublyLinkedList class.
This allows the internal list to be wiped cleaned for reuse.

Test script:
---------------
<?php
$d = new SplDoublyLinkedList();
$d->push(5);
var_dump($d->count());
$d->reset();
var_dump($d->count());

int(1)
int(0)

Actual result:
--------------
<?php
$d = new SplDoublyLinkedList();
$d->push(5);
var_dump($d->count());
$d->reset();
var_dump($d->count());

int(1)
int(0)


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60759&edit=1

Reply via email to