Review main Merged

81050[TASK] Move GraphicalFunctions code to ImageProcessingInstructions

Benni Mack CR +2 V +2 Expert +611 −534 updated 10/11/23, 11:32

Commit message

This change moves some logic to calculate width
and height based on instructions from an incoming
array into a separate DTO, which can be used consistently
and type-safe instead of residing in GraphicalFunctions.

Some transformation of options ("maxW" vs. "maxWidth")
is now moved to this new class as well, in order to
centralize the naming of the options.

In addition, the special calculation for ImageMagick
about the cropH and cropV values is now done directly
in the instructions, so the CropArea object can now
be used in more places than before.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Christian Kuhn +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Oliver Klee +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 7

Review log 3145

Show 1120 earlier messages
  1. Benni Mack uploaded patch set 1 09/18/23, 15:32

  2. core-ci voted on patch set 1 V -1 09/18/23, 15:44 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46684

  3. Benni Mack uploaded patch set 2 V -1 09/18/23, 16:37

  4. core-ci voted on patch set 2 V -1 09/18/23, 16:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46688

  5. Benni Mack uploaded patch set 3 V -1 09/18/23, 17:13

  6. core-ci voted on patch set 3 V +1 09/18/23, 17:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46693

  7. Benni Mack uploaded patch set 4 V +1 09/19/23, 17:49

  8. core-ci voted on patch set 4 V +1 09/19/23, 18:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46814

  9. Oliver Klee commented on patch set 4 09/20/23, 11:51

    ImageDimension.php:32

    Would it make sense to directly switch this to constructor property promotion?
  10. Benni Mack uploaded patch set 5 V +1 09/26/23, 10:33

  11. core-ci voted on patch set 5 V -1 09/26/23, 10:49 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47178

  12. Oliver Klee commented on patch set 5 09/26/23, 11:31

    ImageDimension.php:32 Reply

    Done
  13. Benni Mack uploaded patch set 6 V -1 09/26/23, 17:37

  14. core-ci voted on patch set 6 V -1 09/26/23, 17:46 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47199

  15. Benni Mack uploaded patch set 7 V -1 10/07/23, 07:35

  16. core-ci voted on patch set 7 V -1 10/07/23, 07:44 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47533

  17. Benni Mack uploaded patch set 8 V -1 10/07/23, 08:36

  18. core-ci voted on patch set 8 V +1 10/07/23, 08:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47537

  19. Benni Mack uploaded patch set 9 V +1 10/07/23, 08:51

  20. core-ci voted on patch set 9 V +1 10/07/23, 08:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47538

  1. Oliver Klee commented on patch set 9 V +1 10/07/23, 09:38

    Looks very good in general! Thanks for cleaning this areas of the code up. I’ve added some comments. If the scope of this change is only moving code, but not improving the moved code, please feel free to ignore the corresponding comments.

    ImageDimension.php:33

    I propose to add `@param int<o, max>` for both properties to narrow down the range.

    ImageProcessingInstructions.php:30

    Many of these properties can get an `@var int<0, max>` annotation to narrow down the range.

    ImageProcessingInstructions.php:37

    As is it possible to instantiate this class with `new` (without using a factory method), this property should have an empty string as the default value.

    ImageProcessingInstructions.php:111

    Let’s be more specific (as `$width` is an integer, not a boolean): `if ($width > 0) {`

    ImageProcessingInstructions.php:127

    Ditto.

    ImageProcessingInstructions.php:153

    Ditto in this code block.

    ImageProcessingInstructionsTest.php:266

    Please let’s add type annotations for the parameters.
  2. Benni Mack commented on patch set 9 10/07/23, 09:40

    Reply

    I'm fine with the changes you proposed - can you take care of them? The code is already covered quite well with tests but I added a few more. That's the goal of this change.
  3. Oliver Klee commented on patch set 9 10/07/23, 11:47

    Reply

    Yes, will do.
  4. Oliver Klee uploaded patch set 10 V +1 10/07/23, 17:18

  5. Oliver Klee commented on patch set 9 V +1 10/07/23, 17:18

    ImageDimension.php:33 Reply

    Done

    ImageProcessingInstructions.php:30 Reply

    Done

    ImageProcessingInstructions.php:37 Reply

    Done

    ImageProcessingInstructions.php:111 Reply

    Done

    ImageProcessingInstructions.php:127 Reply

    Done

    ImageProcessingInstructions.php:153 Reply

    Done

    ImageProcessingInstructionsTest.php:266 Reply

    Done
  6. Oliver Klee commented on patch set 10 10/07/23, 17:18

    Reply

    Done
  7. Oliver Klee voted on patch set 10 V +1 10/07/23, 17:18

  8. core-ci voted on patch set 10 V +1 10/07/23, 17:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47541

  9. Benni Mack uploaded patch set 11 V +1 10/07/23, 19:34

  10. core-ci voted on patch set 11 V -1 10/07/23, 19:44 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47544

  11. Simon Schaufelberger updated the commit message in patch set 12 V -1 10/07/23, 20:16

  12. Benni Mack rebased onto patch set 13 10/08/23, 19:21

  13. core-ci voted on patch set 13 V -1 10/08/23, 19:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47569

  14. Benni Mack uploaded patch set 14 V -1 10/09/23, 12:47

  15. core-ci voted on patch set 14 V +1 10/09/23, 12:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47593

  16. Oliver Klee voted on patch set 14 V +1 10/09/23, 13:32

  17. Oliver Klee commented on patch set 14 10/09/23, 13:34

    GraphicalFunctions.php:366

    Why are we removing the cropscale information from the hash input here?
  18. Benni Mack uploaded patch set 15 V +1 10/09/23, 14:06

  19. Benni Mack commented on patch set 14 10/09/23, 14:06

    GraphicalFunctions.php:366 Reply

    my bad, I forgot to re-add this
  20. core-ci voted on patch set 15 V +1 10/09/23, 14:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47596

  21. Christian Kuhn commented on patch set 15 10/11/23, 08:38

    GraphicalFunctions.php:366 Reply

    Done
  22. Christian Kuhn voted on patch set 15 V +1 CR +1 10/11/23, 09:12

  23. Oliver Klee voted on patch set 15 V +1 10/11/23, 11:06

  24. Stefan Bürk voted on patch set 15 V +2 CR +2 10/11/23, 11:32

  25. Stefan Bürk merged patch set 16 10/11/23, 11:32