DX: apply rector rules up to php8.0

This commit is contained in:
2023-04-15 01:05:37 +02:00
parent d8870e906f
commit dde3002100
714 changed files with 2348 additions and 9263 deletions

View File

@@ -44,27 +44,18 @@ class CustomFieldChoice extends AbstractCustomField
private $defaultLocales;
/**
* @var TwigEngine
*/
private $templating;
/**
* @var TranslatableStringHelper Helper that find the string in current locale from an array of translation
*/
private $translatableStringHelper;
/**
* CustomFieldChoice constructor.
*/
public function __construct(
TranslatorInterface $translator,
TwigEngine $templating,
TranslatableStringHelper $translatableStringHelper
private TwigEngine $templating,
/**
* @var TranslatableStringHelper Helper that find the string in current locale from an array of translation
*/
private TranslatableStringHelper $translatableStringHelper
) {
$this->defaultLocales = $translator->getFallbackLocales();
$this->templating = $templating;
$this->translatableStringHelper = $translatableStringHelper;
}
public function allowOtherChoice(CustomField $cf)
@@ -228,7 +219,7 @@ class CustomFieldChoice extends AbstractCustomField
*
* @return bool
*/
public function isChecked(CustomField $cf, $choiceSlug, $data)
public function isChecked(CustomField $cf, $choiceSlug, array|string $data)
{
if (null === $data) {
return false;
@@ -330,10 +321,9 @@ class CustomFieldChoice extends AbstractCustomField
* deserialized the data from the database to a multiple
* field.
*
* @param mixed $serialized
* @param bool $allowOther
*/
private function deserializeToMultiple($serialized, $allowOther)
private function deserializeToMultiple(mixed $serialized, $allowOther)
{
$value = $this->guessValue($serialized);
@@ -387,7 +377,7 @@ class CustomFieldChoice extends AbstractCustomField
*
* @return mixed
*/
private function guessValue($value)
private function guessValue(array|string $value)
{
if (null === $value) {
return null;