Review main Merged

69155[BUGFIX] Correct return type for FileReference methods

Chris Müller CR +2 V +2 Easy +30 −3 updated 08/09/21, 18:04

Commit message

The @return annotation for the following FileReference methods is set
to "string", but these methods can also return null:

- getTitle()
- getAlternative()
- getDescription()

To avoid problems with code quality tools and to ensure type
safety the return value of these methods is always casted to a
string.

Review

  • Code review CR +2 Done
    • Richard Haeser +2
    • Oliver Hader +1
    • Benni Mack +1
  • Verified V +2 Done
    • Richard Haeser +2
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 67

  1. Chris Müller uploaded patch set 1 05/17/21, 06:58

  2. core-ci voted on patch set 1 V +1 05/17/21, 07:12 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11574

  3. Benni Mack voted on patch set 1 V +1 CR +1 05/17/21, 07:25

  4. Richard Haeser voted on patch set 1 V +2 CR +2 05/17/21, 07:25

  5. Richard Haeser merged patch set 2 05/17/21, 07:26

  6. Oliver Hader commented on patch set 2 05/17/21, 13:37

    I think this is a regression... post -1 * `sys_file_reference.title === null` - means it's not defined, use `sys_file.title` instead * `sys_file_reference.title === ''` - means that `sys_file.title` should be overridden (with empty string) Thus, from my point of view the return type should have been changed to `?string` instead of enforcing `string` for the return type.
  7. Oliver Hader commented on patch set 2 CR +1 08/09/21, 18:04

    Reply

    Ignore my remark, I was not aware that e.g. `getTitle()` falls back to `sys_file.title` in case `sys_file_reference` is `null`.