80704[BUGFIX] Correct type check for stream resource
Commit message
Review
-
Code review CR +2 Done
- Christian Kuhn +2
- Oliver Klee +1
-
Verified V +2 Done
- Christian Kuhn +2
- Oliver Klee +1
- core-ci +1 CI
Issues 2
Files 2
Review log 1722
-
Mathias Bolt Lesniak uploaded patch set 1 08/27/23, 07:18
-
core-ci voted on patch set 1 V +1 08/27/23, 07:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45865
-
Oliver Klee commented on patch set 1 08/27/23, 08:17
Have you checked if the main branch is affected as well? (If it is, you would need to set “Releases: main, 12.4” in the commit message and create the change for the main branch. The merger then takes care of the 12.4 backport.) -
Oliver Klee commented on patch set 1 08/27/23, 09:27
RequestTest.php:144Let's make the test name more specific. ("works" is not very specific.) My suggestion: `constructorForValidBodyDoesNotCrash`RequestTest.php:144`$body` should get a type declaration. -
Mathias Bolt Lesniak uploaded patch set 2
V +108/27/23, 21:50 -
Mathias Bolt Lesniak commented on patch set 2 08/27/23, 21:57
Reply
Done. Thanks.RequestTest.php:144ReplyThat would not follow the convention set by the other tests, like `public function constructorRaisesExceptionForInvalidBody($body): void`. I would also argue that adding a type declaration would defeat the purpose of the test, which is to test the constructor of the `Request` class. That constructor doesn't have any type declaration for $body. Adding a type declaration for $body the `Request` class is possibly beyond the scope of this bug. (I don't know.) It would also affect a few other classes.RequestTest.php:144ReplyGood point. I changed it to `constructorDoesNotRaiseExceptionForValidBody` in Patchset 2. This is closer to the `constructorRaisesExceptionForInvalidBody` method name I'm basing it on. -
core-ci voted on patch set 2 V +1 08/27/23, 21:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45868
-
Oliver Klee commented on patch set 2 08/28/23, 08:17
RequestTest.php:144ReplyMy best guess is that the other tests are from a time when type declarations in PHP were very limited. It certainly is not a convention. New code should have type declarations (where it's technically possible), and those type declarations should be as strict as possible (with additional `@param`/`@return` annotations if those help make the type more specific).RequestTest.php:144ReplyDone -
Oliver Klee commented on patch set 2 08/28/23, 08:18
RequestTest.php:144ReplyAnd I'm referring only to adding a type declaration to the test method here, not the tested method (the constructor) or the other tests. -
Christian Kuhn commented on patch set 2 08/28/23, 09:24
RequestTest.php:144Replyphp does not allow type hinting "resource". As such, a type hint for $body is impossible since the DP has a test case using resource (from fopen()). -
Mathias Bolt Lesniak uploaded patch set 3
V +108/28/23, 09:31 -
Christian Kuhn updated the commit message in patch set 4 08/28/23, 09:35
-
Mathias Bolt Lesniak commented on patch set 3 08/28/23, 09:36
RequestTest.php:144ReplyHaha. I discovered that now. But I added an annotation - as well as an additional data set for $body being null, since I had missed it previously. -
Christian Kuhn voted on patch set 4 V +1 CR +1 08/28/23, 09:36
-
core-ci voted on patch set 3 V -1 08/28/23, 09:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45882
-
core-ci voted on patch set 4 V -1 08/28/23, 09:42 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45883
-
Christian Kuhn uploaded patch set 5
CR +1V +108/28/23, 09:51 -
Christian Kuhn voted on patch set 5 V +1 CR +1 08/28/23, 09:51
-
Oliver Klee voted on patch set 5 V +1 CR +1 08/28/23, 09:57
-
core-ci voted on patch set 5 V +1 08/28/23, 09:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45884
-
Christian Kuhn voted on patch set 5 V +2 CR +2 08/28/23, 10:11
-
Christian Kuhn merged patch set 6 08/28/23, 10:11