Review main Merged

71901[BUGFIX] Add PHP 8.1 compatibility in AbstractRecordCollection

Stefan Bürk CR +2 V +2 Easy +33 −4 updated 10/23/21, 18:21

Commit message

Since PHP 8.1, most internal classes are updated
with tentative return types. This will be enforced
with 9.0.

It means incompatible or missing return types in
extending  user land classes emit E_DEPRECATED
since 8.1. We can not add the return type in many
cases since that would be breaking in v11, solution
is the #[\ReturnTypeWillChange] attribute.

This patch adds according attributes to
AbstractRecordCollection, which implements \Iterator
interface. Mixed return type will be usable when core
requires at least PHP 8.0.

Class AbstractRecordCollection implement deprecated
\Serializable indirectly via RecordCollectionInterface.

Adding the magic methods suppresses PHP 7.4
E_DEPRECATED messages and retains compatibilty,
slated for removal in v12.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Jochen Roth +1
    • crell +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Jochen Roth +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 1519

  1. Stefan Bürk uploaded patch set 1 10/19/21, 22:05

  2. core-ci voted on patch set 1 V +1 10/19/21, 22:17 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18354

  3. Stefan Bürk voted on patch set 1 CR -1 10/19/21, 22:25

  4. Stefan Bürk wrote 10/19/21, 22:34

    Removed Code-Review-1 by Stefan Bürk <stefan@buerk.tech>
  5. Stefan Bürk uploaded patch set 2 10/20/21, 00:08

  6. Stefan Bürk uploaded patch set 3 10/20/21, 00:11

  7. Christian Kuhn voted on patch set 3 V +1 CR +1 10/20/21, 00:12

  8. core-ci voted on patch set 3 V +1 10/20/21, 00:25 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18362

  9. core-ci voted on patch set 2 V -1 10/20/21, 00:28 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18361

  10. crell commented on patch set 3 10/21/21, 15:09

    AbstractRecordCollection.php:220

    An int return type is compatible with 7.4, so that can be done now.
  11. Stefan Bürk commented on patch set 3 10/21/21, 15:14

    AbstractRecordCollection.php:220 Reply

    int would be 7.4 compatible, yes. But adding here ':int' return type would change the signature, and classes extend this may break if they have no/not that return type. So this would be breaking, which we cannot do in v11. See: https://3v4l.org/frkqe
  12. crell commented on patch set 3 10/21/21, 15:16

    AbstractRecordCollection.php:220 Reply

    Ugh, stupid extending classes... Note that in the comment, then, as the reason why we can't do it now. (Because the PHP version isn't the blocker, LTS status is.)
  13. Stefan Bürk uploaded patch set 4 10/21/21, 15:36

  14. Stefan Bürk commented on patch set 4 10/21/21, 15:37

    AbstractRecordCollection.php:220 Reply

    Done
  15. core-ci voted on patch set 4 V +1 10/21/21, 15:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/18406

  16. crell voted on patch set 4 CR +1 10/21/21, 19:22

  17. Jochen Roth voted on patch set 4 V +1 CR +1 10/22/21, 08:22

  18. Christian Kuhn voted on patch set 4 V +2 CR +2 10/23/21, 18:20

  19. Christian Kuhn merged patch set 5 10/23/21, 18:21