Skip to content

Commit

Permalink
[BUGFIX] Use proper Fluid exception class
Browse files Browse the repository at this point in the history
This patch replaces the deprecated classes with their proper
replacement.

Resolves: #91315
Releases: 9.5
Change-Id: I01ec5402ce121720191ecd90d5c5e8c389461597
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64418
Tested-by: Josef Glatz <josefglatz@gmail.com>
Tested-by: Markus Klein <markus.klein@typo3.org>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Josef Glatz <josefglatz@gmail.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
  • Loading branch information
andreaskienast committed May 6, 2020
1 parent 9a4bcd7 commit f862f64
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 22 deletions.
Expand Up @@ -59,7 +59,7 @@ public function initializeArguments()
* @param \Closure $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
* @return string
* @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception
* @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
Expand Down
6 changes: 3 additions & 3 deletions typo3/sysext/fluid/Classes/ViewHelpers/CObjectViewHelper.php
Expand Up @@ -120,7 +120,7 @@ public function initializeArguments()
* @param \Closure $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
* @return mixed
* @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception
* @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
Expand Down Expand Up @@ -150,15 +150,15 @@ public static function renderStatic(array $arguments, \Closure $renderChildrenCl
$setup = static::getConfigurationManager()->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
foreach ($pathSegments as $segment) {
if (!array_key_exists($segment . '.', $setup)) {
throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception(
throw new \TYPO3Fluid\Fluid\Core\ViewHelper\Exception(
'TypoScript object path "' . $typoscriptObjectPath . '" does not exist',
1253191023
);
}
$setup = $setup[$segment . '.'];
}
if (!isset($setup[$lastSegment])) {
throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception(
throw new \TYPO3Fluid\Fluid\Core\ViewHelper\Exception(
'No Content Object definition found at TypoScript object path "' . $typoscriptObjectPath . '"',
1540246570
);
Expand Down
Expand Up @@ -91,7 +91,7 @@ public function initializeArguments()
/**
* Renders the checkbox.
*
* @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception
* @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception
* @return string
*/
public function render()
Expand Down
Expand Up @@ -239,7 +239,7 @@ protected function getOptions()
if (method_exists($key, '__toString')) {
$key = (string)$key;
} else {
throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception('Identifying value for object of class "' . get_class($value) . '" was an object.', 1247827428);
throw new \TYPO3Fluid\Fluid\Core\ViewHelper\Exception('Identifying value for object of class "' . get_class($value) . '" was an object.', 1247827428);
}
}
} elseif ($this->persistenceManager->getIdentifierByObject($value) !== null) {
Expand All @@ -248,15 +248,15 @@ protected function getOptions()
} elseif (method_exists($value, '__toString')) {
$key = (string)$value;
} else {
throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception('No identifying value for object of class "' . get_class($value) . '" found.', 1247826696);
throw new \TYPO3Fluid\Fluid\Core\ViewHelper\Exception('No identifying value for object of class "' . get_class($value) . '" found.', 1247826696);
}
if ($this->hasArgument('optionLabelField')) {
$value = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getPropertyPath($value, $this->arguments['optionLabelField']);
if (is_object($value)) {
if (method_exists($value, '__toString')) {
$value = (string)$value;
} else {
throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception('Label value for object of class "' . get_class($value) . '" was an object without a __toString() method.', 1247827553);
throw new \TYPO3Fluid\Fluid\Core\ViewHelper\Exception('Label value for object of class "' . get_class($value) . '" was an object without a __toString() method.', 1247827553);
}
}
} elseif (method_exists($value, '__toString')) {
Expand Down
Expand Up @@ -14,7 +14,7 @@
* The TYPO3 project - inspiring people to share!
*/

use TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException;
use TYPO3Fluid\Fluid\Core\Exception;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
Expand Down Expand Up @@ -122,7 +122,7 @@ public function initializeArguments()
* @param \Closure $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
* @return string
* @throws InvalidVariableException
* @throws Exception
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
Expand Down Expand Up @@ -156,7 +156,7 @@ public static function renderStatic(array $arguments, \Closure $renderChildrenCl
$output = mb_convert_case($value, MB_CASE_TITLE, 'utf-8');
break;
default:
throw new InvalidVariableException('The case mode "' . $mode . '" supplied to Fluid\'s format.case ViewHelper is not supported.', 1358349150);
throw new Exception('The case mode "' . $mode . '" supplied to Fluid\'s format.case ViewHelper is not supported.', 1358349150);
}

return $output;
Expand Down
Expand Up @@ -17,9 +17,9 @@
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Fluid\Core\ViewHelper\Exception;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Exception;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithContentArgumentAndRenderStatic;

/**
Expand Down
Expand Up @@ -15,11 +15,11 @@
*/

use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\Core\ViewHelper\Exception;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\CMS\Frontend\Service\TypoLinkCodecService;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Exception;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;

/**
Expand Down
Expand Up @@ -15,7 +15,7 @@
*/

use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException;
use TYPO3Fluid\Fluid\Core\Exception;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
Expand Down Expand Up @@ -113,7 +113,7 @@ public function initializeArguments()
* @param array $arguments
* @param \Closure $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
* @throws InvalidVariableException
* @throws Exception
* @return string
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Expand All @@ -130,7 +130,7 @@ public static function renderStatic(array $arguments, \Closure $renderChildrenCl
}

if ((string)$id === '') {
throw new InvalidVariableException('An argument "key" or "id" has to be provided', 1351584844);
throw new Exception('An argument "key" or "id" has to be provided', 1351584844);
}

$request = $renderingContext->getControllerContext()->getRequest();
Expand Down
Expand Up @@ -145,7 +145,7 @@ public function renderThrowsExceptionIfTypoScriptObjectPathDoesNotExist(string $
]
);

$this->expectException(\TYPO3\CMS\Fluid\Core\ViewHelper\Exception::class);
$this->expectException(\TYPO3Fluid\Fluid\Core\ViewHelper\Exception::class);
$this->expectExceptionCode($exceptionCode);
$this->viewHelper->initializeArgumentsAndRender();
}
Expand Down
Expand Up @@ -511,7 +511,7 @@ public function selectOnDomainObjectsThrowsExceptionIfNoValueCanBeFound()
$mockPersistenceManager->expects($this->any())->method('getIdentifierByObject')->will($this->returnValue(null));
$this->viewHelper->_set('persistenceManager', $mockPersistenceManager);

$this->expectException(\TYPO3\CMS\Fluid\Core\ViewHelper\Exception::class);
$this->expectException(\TYPO3Fluid\Fluid\Core\ViewHelper\Exception::class);
$this->expectExceptionCode(1247826696);

$user = new UserDomainClass(1, 'Ingmar', 'Schlecht');
Expand Down
Expand Up @@ -69,7 +69,7 @@ public function viewHelperDoesNotRenderChildrenIfGivenValueIsNotNull()
*/
public function viewHelperThrowsExceptionIfIncorrectModeIsGiven()
{
$this->expectException(\TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException::class);
$this->expectException(\TYPO3Fluid\Fluid\Core\Exception::class);
$this->expectExceptionCode(1358349150);
$this->setArgumentsUnderTest(
$this->viewHelper,
Expand Down
Expand Up @@ -14,9 +14,9 @@
* The TYPO3 project - inspiring people to share!
*/

use TYPO3\CMS\Fluid\Core\ViewHelper\Exception;
use TYPO3\CMS\Fluid\ViewHelpers\Format\DateViewHelper;
use TYPO3\TestingFramework\Fluid\Unit\ViewHelpers\ViewHelperBaseTestcase;
use TYPO3Fluid\Fluid\Core\ViewHelper\Exception;

/**
* Test case
Expand Down
Expand Up @@ -64,7 +64,7 @@ public function renderMethodThrowsExceptionOnInvalidArguments(array $arguments)
{
$this->setArgumentsUnderTest($this->viewHelper, $arguments);

$this->expectException(\TYPO3\CMS\Fluid\Core\ViewHelper\Exception::class);
$this->expectException(\TYPO3Fluid\Fluid\Core\ViewHelper\Exception::class);
$this->expectExceptionCode(1382284106);

$this->viewHelper->render();
Expand Down
Expand Up @@ -36,7 +36,7 @@ public function renderThrowsExceptionIfNoKeyOrIdParameterIsGiven()
$this->viewHelper = new TranslateViewHelper();
$this->injectDependenciesIntoViewHelper($this->viewHelper);

$this->expectException(\TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException::class);
$this->expectException(\TYPO3Fluid\Fluid\Core\Exception::class);
$this->expectExceptionCode(1351584844);

$this->setArgumentsUnderTest(
Expand Down

0 comments on commit f862f64

Please sign in to comment.