Skip to content

SplCaster shows wrong iteration mode #20718

@smilingthax

Description

@smilingthax

From

$prefix.'mode' => new ConstStub((($mode & \SplDoublyLinkedList::IT_MODE_LIFO) ? 'IT_MODE_LIFO' : 'IT_MODE_FIFO').' | '.(($mode & \SplDoublyLinkedList::IT_MODE_KEEP) ? 'IT_MODE_KEEP' : 'IT_MODE_DELETE'), $mode),
:

(($mode & \SplDoublyLinkedList::IT_MODE_LIFO) ? 'IT_MODE_LIFO' : 'IT_MODE_FIFO').' | '.(($mode & \SplDoublyLinkedList::IT_MODE_KEEP) ? 'IT_MODE_KEEP' : 'IT_MODE_DELETE'

Problem is that \SplDoublyLinkedList::IT_MODE_KEEP == 0 (AFAIK on both php and hhvm). So ($mode & IT_MODE_KEEP) == ($mode & 0) == 0, i.e. always falsy, and IT_MODE_KEEP is never printed, even for default-constructed \SplDoublyLinkedLists, where mode == IT_MODE_FIFO | IT_MODE_KEEP (==0), per php doc.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions