From: Tim Düsterhus Date: Thu, 22 Oct 2020 08:02:16 +0000 (+0200) Subject: Remove PHP 7.0 compatibility code for Reflection X-Git-Tag: 5.4.0_Alpha_1~726^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=16afd61fcdf1dc88d1cd82d25411c34215100e9d;p=GitHub%2FWoltLab%2FWCF.git Remove PHP 7.0 compatibility code for Reflection see #3617 see 26ead9f58b1554956e8fb46133e20a5f3fdf5d25 --- diff --git a/wcfsetup/install/files/lib/system/form/builder/data/processor/CustomFormDataProcessor.class.php b/wcfsetup/install/files/lib/system/form/builder/data/processor/CustomFormDataProcessor.class.php index f4a15954b4..ce24c786a7 100644 --- a/wcfsetup/install/files/lib/system/form/builder/data/processor/CustomFormDataProcessor.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/data/processor/CustomFormDataProcessor.class.php @@ -64,12 +64,8 @@ class CustomFormDataProcessor extends AbstractFormDataProcessor { /** @var \ReflectionType $parameterType */ $parameterType = $parameters[0]->getType(); if (!( - // PHP 7.1+ ($parameterType instanceof \ReflectionNamedType && - ($parameterType->getName() === IFormDocument::class || is_subclass_of($parameterType->getName(), IFormDocument::class))) || - // PHP 7.0 - (get_class($parameterType) === \ReflectionType::class && - ($parameterType->__toString() === IFormDocument::class || is_subclass_of($parameterType->__toString(), IFormDocument::class))) + ($parameterType->getName() === IFormDocument::class || is_subclass_of($parameterType->getName(), IFormDocument::class))) )) { throw new \InvalidArgumentException( "The form data processor function's first parameter must be an instance of '" . IFormDocument::class . "', instead " . @@ -79,12 +75,8 @@ class CustomFormDataProcessor extends AbstractFormDataProcessor { $parameterType = $parameters[1]->getType(); if (!( - // PHP 7.1+ ($parameterType instanceof \ReflectionNamedType && - ($parameterType->getName() === 'array')) || - // PHP 7.0 - (get_class($parameterType) === \ReflectionType::class && - ($parameterType->__toString() === 'array')) + ($parameterType->getName() === 'array')) )) { throw new \InvalidArgumentException("The form data processor function's second parameter must be an array."); } @@ -105,12 +97,8 @@ class CustomFormDataProcessor extends AbstractFormDataProcessor { /** @var \ReflectionType $parameterType */ $parameterType = $parameters[0]->getType(); if (!( - // PHP 7.1+ ($parameterType instanceof \ReflectionNamedType && - ($parameterType->getName() === IFormDocument::class || is_subclass_of($parameterType->getName(), IFormDocument::class))) || - // PHP 7.0 - (get_class($parameterType) === \ReflectionType::class && - ($parameterType->__toString() === IFormDocument::class || is_subclass_of($parameterType->__toString(), IFormDocument::class))) + ($parameterType->getName() === IFormDocument::class || is_subclass_of($parameterType->getName(), IFormDocument::class))) )) { throw new \InvalidArgumentException( "The object data processor function's first parameter must be an instance of '" . IFormDocument::class . "', instead " . @@ -120,24 +108,16 @@ class CustomFormDataProcessor extends AbstractFormDataProcessor { $parameterType = $parameters[1]->getType(); if (!( - // PHP 7.1+ ($parameterType instanceof \ReflectionNamedType && - ($parameterType->getName() === 'array')) || - // PHP 7.0 - (get_class($parameterType) === \ReflectionType::class && - ($parameterType->__toString() === 'array')) + ($parameterType->getName() === 'array')) )) { throw new \InvalidArgumentException("The object data processor function's second parameter must be an array."); } $parameterType = $parameters[2]->getType(); if (!( - // PHP 7.1+ ($parameterType instanceof \ReflectionNamedType && - ($parameterType->getName() === IStorableObject::class)) || - // PHP 7.0 - (get_class($parameterType) === \ReflectionType::class && - ($parameterType->__toString() === IStorableObject::class)) + ($parameterType->getName() === IStorableObject::class)) )) { throw new \InvalidArgumentException("The object data processor function's third parameter must be an instance of '" . IStorableObject::class . "', instead " . @($parameterType === null ? 'any' : "'" . $parameterType . "'") . " parameter is expected."); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/validation/FormFieldValidator.class.php b/wcfsetup/install/files/lib/system/form/builder/field/validation/FormFieldValidator.class.php index f5ef82db17..7bdcfbf0ba 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/validation/FormFieldValidator.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/validation/FormFieldValidator.class.php @@ -40,12 +40,8 @@ class FormFieldValidator implements IFormFieldValidator { /** @var \ReflectionType $parameterType */ $parameterType = $parameters[0]->getType(); if (!( - // PHP 7.1+ ($parameterType instanceof \ReflectionNamedType && - ($parameterType->getName() === IFormField::class || is_subclass_of($parameterType->getName(), IFormField::class))) || - // PHP 7.0 - (get_class($parameterType) === \ReflectionType::class && - ($parameterType->__toString() === IFormField::class || is_subclass_of($parameterType->__toString(), IFormField::class))) + ($parameterType->getName() === IFormField::class || is_subclass_of($parameterType->getName(), IFormField::class))) )) { throw new \InvalidArgumentException( "The validation function's parameter must be an instance of '" . IFormField::class . "', instead " .