Review main Abandoned

74337[WIP][TASK] Make type annotations for image-related classes more specific

Oliver Klee CR 0 V 0 Easy +6 −4 updated 08/25/24, 10:10

Commit message

Also add some typecasts for type correctness.

Also drop some pointless null coalescing operators for values that
will never be null (e.g., empty arrays or integers).

Parts where the types are not obvious are left unchanged. So this
is only a first start for improving type information.

As this change is non-breaking, it is suitable for a backport.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 1

Review log 1319

  1. Oliver Klee uploaded patch set 1 04/17/22, 18:50

  2. core-ci voted on patch set 1 V -1 04/17/22, 18:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26111

  3. Oliver Klee commented on patch set 1 04/17/22, 18:59

    @all Is this changeset okay to review, or should I split it up with one changeset per class?
  4. Oliver Klee commented on patch set 1 04/17/22, 19:01

    … at least as soon as it does not break the tests anymore. ;-)
  5. Stefan Bürk commented on patch set 1 04/20/22, 00:50

    Reply

    You have a bunch of cgl issues through the added "@return void" docblocks. Something php-cs-fixer has a rule for: https://cs.symfony.com/doc/rules/phpdoc/phpdoc_no_empty_return.html Run `Build/Scripts/runTests.sh -s cglFix` to fix them. But there is one real test issue - will comment on proper line.

    GraphicalFunctions.php:2459

    Not sure - but assuming that the corresponding failing unit test has been tailored correctly, your change here will be a change in behaviour as it does not match the possible values. $width for e.g. could be '200+0+0' which will "magic casted with truncationg" to 200. See test failures - spoiler: expected/actual are flipped due wrong assert in test case in typo3/sysext/core/Tests/Unit/Imaging/GraphicalFunctionsTest.php:156 ``` 1) TYPO3\CMS\Core\Tests\Unit\Imaging\GraphicalFunctionsTest::imageMagickIdentifyReturnsFormattedValuesWithOffset Failed asserting that two arrays are equal. --- Expected +++ Actual @@ @@ Array ( - 0 => 200 - 1 => 400 + 0 => '200+0+0' + 1 => '400+0+0' 2 => 'png' 3 => 'myImageFile.png' 4 => 'png' ) /builds/typo3/CI/cms/typo3/sysext/core/Tests/Unit/Imaging/GraphicalFunctionsTest.php:156 /builds/typo3/CI/cms/vendor/phpunit/phpunit/phpunit:98 ``` Maybe the testcase is wrong, maybe not. However, given current unit test this change breaks something.
  6. Oliver Klee commented on patch set 1 04/20/22, 07:09

    Thanks!

    Reply

    Ack

    GraphicalFunctions.php:2459 Reply

    Ack
  7. Oliver Klee updated the commit message in patch set 2 04/20/22, 10:55

  8. core-ci voted on patch set 2 V -1 04/20/22, 11:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26225

  9. Oliver Klee marked it work in progress 04/20/22, 12:28

  10. Oliver Klee uploaded patch set 3 05/29/22, 15:30

  11. core-ci voted on patch set 3 V -1 05/29/22, 15:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27553

  12. Oliver Klee uploaded patch set 4 V -1 03/11/23, 17:54

  13. core-ci voted on patch set 4 V -1 03/11/23, 19:06 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38802

  14. Oliver Klee rebased onto patch set 5 V -1 03/16/23, 08:58

  15. core-ci voted on patch set 5 V -1 03/16/23, 09:14 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39042

  16. Oliver Klee wrote 04/05/23, 12:02

    Topic set to phpstan
  17. Oliver Klee uploaded patch set 6 V -1 11/25/23, 13:28

  18. core-ci voted on patch set 6 V +1 11/25/23, 13:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49919

  19. Oliver Klee abandoned the change 08/25/24, 10:10