Skip to content

[10.x] collection shift can not handle an empty collection #51840

@Treggats

Description

@Treggats

Laravel Version

10.48.13

PHP Version

8.3.8

Database Driver & Version

No response

Description

A recent addition to Collection::shift() causes it to throw an exception when running on a empty collection.

Will provide a PR to fix this issue.

Steps To Reproduce

  1. create a collection with two objects
  2. call shift() three times on it and assign it to variables
  3. dump a property of the object for every variable
  4. it will throw an exception saying it can not call the property on a collection

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions