73270[BUGFIX] Avoid PHP 8.0/8.1 error in RecordHistory
Commit message
Review
-
Code review CR +2 Done
- Christian Kuhn +2
- Oliver Klee +1
- Susi Moog +1
-
Verified V +2 Done
- Christian Kuhn +2
- Susi Moog +1
- core-ci +1 CI
Issues 1
Files 1
Review log 1317
-
TYPO3com uploaded patch set 1 02/03/22, 17:47
-
core-ci voted on patch set 1 V +1 02/03/22, 17:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22964
-
Stefan Bürk commented on patch set 1 CR -1 02/03/22, 18:29
on itCasing/typo .. must be "[BUGFIX]"RecordHistory.php:468I would avoid that here and instead add the string-cast in the constructor itself. We should check if we "may" add a correct string typehint to the method signatore, as it is proteced anyway.RecordHistory.php:483Same goes here. Move string-cast to constructor. -
Stefan Bürk uploaded patch set 2 02/03/22, 18:29
-
core-ci voted on patch set 2 V +1 02/03/22, 18:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22968
-
Oliver Klee commented on patch set 2 02/04/22, 11:24
RecordHistory.php:81Although this clearly is an improvement, this still does not feel clean to me (as the parameters currently already are strings according to the PHPDoc type annotations). I see two possible ways to solve this in a cleaner way: a) make both parameter nullable, and explicitly deal with null values b) keep both parameters non-nullable, and fix the callers instead to always provide strings (and never null). What do you think, Stefan? -
Stefan Bürk commented on patch set 2 02/04/22, 17:30
RecordHistory.php:81ReplyThanks Oliver. Generally you are right. Also the "phpdoc" states that both arguments have to be "string", the where called with "null". Thus the original patch owner provided a patch to do the string casts in the two called methods. My thought was to solve this in two steps, with this as the first one as backportable bugfix. In contrast to the first patch version, I move the string cast here to the constructor and make the protected method string typed as a first step. Leaving the phpdoc as-is and not changing to nullable type - which would "open up" the signature instead of adapting the signature as strict type. In the end the transition must be strict type strings here. It does not make much sense to deal with nullable-strings here for these thwo arguments. I would do your point b in a dedicated patch or patches: 1. ensure core internal calls are ensured to passe string to this constructor 2. add string types to constructor arguments - not sure if this may be a breaking thing, as this class is not marked as internal. However there are more things we can make strict type in this class, and thus I would suggest that we use the patch now as a bugfix with backport and doing the strict-typing afterwards. As my original thought was. Maybe we should add a @todo here to the constructor noting this plan to ensure callee's passes strings and then strict type the constructor (along with other strict typings). Which we should do in main only, and not as bugfix backport. Would this plan be fine for you ? -
Oliver Klee commented on patch set 2 02/04/22, 17:48
RecordHistory.php:81ReplyYes, sounds good. Thanks! -
Oliver Klee voted on patch set 2 CR +1 02/04/22, 20:09
-
Christian Kuhn uploaded patch set 3 02/05/22, 07:49
-
Christian Kuhn commented on patch set 3 02/05/22, 07:49
Reply
DoneRecordHistory.php:468ReplyDoneRecordHistory.php:483ReplyDone -
Christian Kuhn voted on patch set 3 V +1 CR +1 02/05/22, 07:49
-
core-ci voted on patch set 3 V +1 02/05/22, 08:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23035
-
Oliver Klee voted on patch set 3 CR +1 02/05/22, 11:07
-
Susi Moog voted on patch set 3 V +1 CR +1 02/05/22, 11:16
-
Christian Kuhn voted on patch set 3 V +2 CR +2 02/05/22, 11:25
-
Christian Kuhn merged patch set 4 02/05/22, 11:25