Bug #94799
closedUsing PHP 7.4 syntax in a 7.2 compatible TYPO3 version example
0%
Description
The example https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.5.x/Important-94484-IntroduceHTMLSanitizer.html#php-api uses PHP 7.4 syntax
...$this->globalAttrs
I would prefer having PHP 7.2 compatible syntax, as this is introduced in a TYPO3 Version that still supports PHP 7.2
In general, I'm a little unsure about the example.
As I see it, the `withTags` and the `withAttrs` should both be arrays of Tags and Attrs respectively. That's not the case how I read the example.
Updated by Oliver Hader over 3 years ago
Variadic functions and the splat operator ...
has been introduced with PHP 5.6 already, see https://www.php.net/manual/en/migration56.new-features.php
Updated by Oliver Hader over 3 years ago
The general benefit of using variadic is type-safety, just compare the following examples which would do the same:
$items = [new Subject('a'), new Subject('b'), new Subject('c')]; function processArray(array $subjects) { ... } processArray($items); function processVariadic(Subject ...$subjects) { ... } processVariadic(...$subjects); // not using array wrapped in [] here processVariadic(new Subject('a'), new Subject('b'), new Subject('c'));
Updated by Oliver Hader over 3 years ago
- Status changed from New to Needs Feedback
Updated by Tomas Norre Mikkelsen over 3 years ago
ok. My bad. Strange that my PHPStorm complained about it, and said it could switch to PHP 7.4.
I Will look into before give more feedback
Updated by Tomas Norre Mikkelsen over 3 years ago
Please close this again, I was wrong.
I didn't find the option to close it myself.
Updated by Oliver Hader over 3 years ago
- Status changed from Needs Feedback to Closed
Thanks for your feedback. Closed issue as requested.