Review main Merged

80107[TASK] Simplify DataMapper::thawProperties()

Alexander Schnitzler CR +2 V +2 Normal +63 −48 updated 07/21/23, 19:36

Commit message

The process of thawing properties didn't properly distinguish
between thawing types (int|float|object etc.) and thawing objects.

This has been mitigated by first using a match statement on the
built in type and handling different types of classes in a separate
method.

It's easier to read, maintain and extend.

Review

  • Code review CR +2 Done
    • Nikita Hovratov +2
    • Oliver Klee +1
  • Verified V +2 Done
    • Nikita Hovratov +2
    • Oliver Klee +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 1417

  1. Alexander Schnitzler uploaded patch set 1 07/21/23, 09:13

  2. Alexander Schnitzler wrote 07/21/23, 09:13

    Topic set to extbase
  3. Alexander Schnitzler uploaded patch set 2 07/21/23, 09:18

  4. core-ci voted on patch set 1 V +1 07/21/23, 09:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44369

  5. core-ci voted on patch set 2 V +1 07/21/23, 09:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44370

  6. Alexander Schnitzler marked it ready for review 07/21/23, 10:26

  7. Oliver Klee commented on patch set 2 07/21/23, 11:23

    DataMapper.php:212

    For the reader's benefit, I'd prefer this: ```php if (!$columnMap instanceof …) { ```

    DataMapper.php:241

    Can we add an `@var` to `$nonProxyPropertyTypes` instead?

    DataMapper.php:278

    To keep the method on the same abstraction level, I'd prefer to add and use `TypeHandlingUtility::isStorageType` and `TypeHandlingUtility::DateTimeType` (or something with similar names).
  8. Alexander Schnitzler commented on patch set 2 07/21/23, 11:47

    DataMapper.php:241 Reply

    Well, we can also remove this entirely. It's only for IDE's that don't understand phpstan-specific type annotations because the community doesn't want to use @phpstan- prefixed phpdoc... What do you prefer?

    DataMapper.php:278 Reply

    I'd love not to do that because we simply hide instanceof or is_subclass_of checks behind a less speaking method name while the whole TypeHandlingUtility will lose its relevance and will eventually be removed at some point.
  9. Alexander Schnitzler commented on patch set 2 07/21/23, 11:47

    DataMapper.php:212 Reply

    Ack
  10. Oliver Klee commented on patch set 2 07/21/23, 12:10

    DataMapper.php:241 Reply

    I‘d be fine with removing it.

    DataMapper.php:278 Reply

    Hiding the implementation details is the point of the refactoring I suggested. ;-) If you consider the names I’ve proposed “less speaking”, do you have better ideas for the naming? Concerning the removal: Is this “it is planned to remove this before 13.0, and it’s quite certain that this will be accomplished”, or “we might remove it at some time in the future, but nothing is certain yet”? If it’s the former, I’d be fine with keeping the code as is, and if it’s the latter, I’d really prefer to make the code more expressive with the refactoring.
  11. Alexander Schnitzler uploaded patch set 3 V +1 07/21/23, 12:22

  12. Oliver Klee commented on patch set 3 07/21/23, 12:24

    DataMapper.php:212 Reply

    Done

    DataMapper.php:241 Reply

    Done
  13. core-ci voted on patch set 3 V +1 07/21/23, 12:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44378

  14. Alexander Schnitzler commented on patch set 3 07/21/23, 12:49

    DataMapper.php:278 Reply

    It's rather removing it in 13. I just don't find enough time for all the plans I have. ^^ But pretty much everything in this TypeHandlingUtility is legacy and to be dropped rather sooner than later.
  15. Oliver Klee commented on patch set 3 V +1 CR +1 07/21/23, 13:32

    DataMapper.php:278 Reply

    Ack
  16. Nikita Hovratov voted on patch set 3 V +2 CR +2 07/21/23, 19:35

  17. Nikita Hovratov merged patch set 4 07/21/23, 19:36