From 8cdf3c2d755938e1966ecf4cceb6cea0bba95e91 Mon Sep 17 00:00:00 2001 From: Christian Krzeminski Date: Wed, 3 Jul 2024 10:56:28 +0200 Subject: [PATCH] chore: v12 only, code-style --- .code-quality/phpstan-baseline.neon | 24 +++------------ .code-quality/phpstan.neon | 5 ++-- .code-quality/rector-8_0.php | 30 ------------------- .code-quality/rector.php | 4 --- .github/workflows/tests.yml | 22 +++----------- .scrutinizer.yml | 3 ++ .../BeUserAuthenticationController.php | 8 ++--- .../FeUserAuthenticationController.php | 8 ++--- Classes/System/Dispatcher.php | 10 ++++++- Classes/System/RestApi/RestApiClient.php | 15 ++-------- Classes/System/RestApi/RestApiJsonFormat.php | 4 +-- Classes/System/RestApi/RestApiRequest.php | 14 ++++----- .../Restler/AbstractExceptionHandler.php | 8 ----- Classes/System/Restler/Builder.php | 12 +++----- Classes/System/Restler/Configuration.php | 8 ++--- .../System/Restler/Format/HalJsonFormat.php | 6 ++-- Classes/System/Restler/RestlerExtended.php | 24 +++++++-------- Classes/System/Restler/Routes.php | 2 +- Classes/System/RestlerBuilderAware.php | 8 ++--- Classes/System/TYPO3/Cache.php | 4 +-- Classes/System/TYPO3/Loader.php | 30 ++++--------------- Classes/System/TYPO3/RestlerEnhancer.php | 2 +- Tests/Unit/BaseTestCase.php | 2 +- .../System/RestApi/RestApiRequestTest.php | 4 +-- 24 files changed, 75 insertions(+), 182 deletions(-) delete mode 100644 .code-quality/rector-8_0.php diff --git a/.code-quality/phpstan-baseline.neon b/.code-quality/phpstan-baseline.neon index 522ab0b..56f33dc 100644 --- a/.code-quality/phpstan-baseline.neon +++ b/.code-quality/phpstan-baseline.neon @@ -28,26 +28,6 @@ parameters: message: "#^Method Aoe\\\\Restler\\\\System\\\\Restler\\\\RestlerExtended\\:\\:postCall\\(\\) has no return type specified\\.$#" count: 1 path: ../Classes/System/Restler/RestlerExtended.php - - - message: "#^Dead catch \\- Error is never thrown in the try block\\.$#" - count: 1 - path: ../Classes/System/Restler/Builder.php - - - message: "#^Anonymous variable in a `\\$request\\-\\>getAttribute\\('site'\\)\\-\\>\\.\\.\\.\\(\\)` method call can lead to false dead methods\\. Make sure the variable type is known$#" - count: 1 - path: ../Classes/System/Dispatcher.php - - - message: "#^Anonymous variable in a `\\$request\\-\\>getAttribute\\('site'\\)\\-\\>getBase\\(\\)\\-\\>\\.\\.\\.\\(\\)` method call can lead to false dead methods\\. Make sure the variable type is known$#" - count: 1 - path: ../Classes/System/Dispatcher.php - - - message: "#^Anonymous variable in a `\\$this\\-\\>request\\-\\>getAttribute\\('site'\\)\\-\\>\\.\\.\\.\\(\\)` method call can lead to false dead methods\\. Make sure the variable type is known$#" - count: 1 - path: ../Classes/System/Restler/RestlerExtended.php - - - message: "#^Anonymous variable in a `\\$this\\-\\>request\\-\\>getAttribute\\('site'\\)\\-\\>getBase\\(\\)\\-\\>\\.\\.\\.\\(\\)` method call can lead to false dead methods\\. Make sure the variable type is known$#" - count: 1 - path: ../Classes/System/Restler/RestlerExtended.php - message: "#^Method Aoe\\\\Restler\\\\System\\\\RestApi\\\\RestApiRequest\\:\\:composeHeaders\\(\\) has no return type specified\\.$#" count: 1 @@ -64,3 +44,7 @@ parameters: message: "#^Comparison operation \"\\>\" between int\\<1, max\\> and 0 is always true\\.$#" count: 1 path: ../Classes/System/Restler/Format/HalJsonFormat.php + - + message: "#^Interface (.*) has only single implementer. Consider using the class directly as there is no point in using the interface.$#" + count: 1 + path: ../Classes/System/Restler/ConfigurationInterface.php diff --git a/.code-quality/phpstan.neon b/.code-quality/phpstan.neon index 8fef980..0bf371c 100644 --- a/.code-quality/phpstan.neon +++ b/.code-quality/phpstan.neon @@ -8,9 +8,10 @@ parameters: paths: - "../Classes/" + ignoreErrors: + - identifier: missingType.iterableValue + inferPrivatePropertyTypeFromConstructor: true - checkMissingIterableValueType: false - checkGenericClassInNonGenericObjectType: false checkAlwaysTrueCheckTypeFunctionCall: false checkAlwaysTrueStrictComparison: false diff --git a/.code-quality/rector-8_0.php b/.code-quality/rector-8_0.php deleted file mode 100644 index 623b419..0000000 --- a/.code-quality/rector-8_0.php +++ /dev/null @@ -1,30 +0,0 @@ -parameters(); - $parameters->set( - Option::PATHS, - [ - __DIR__ . '/../Classes', - __DIR__ . '/../Tests', - __DIR__ . '/rector.php', - __DIR__ . '/rector-8_0.php', - ] - ); - - $containerConfigurator->import(SetList::PHP_81); - - $parameters->set(Option::AUTO_IMPORT_NAMES, false); - $parameters->set(Option::AUTOLOAD_PATHS, [__DIR__ . '/../Classes']); - $parameters->set(Option::SKIP, []); - - $services = $containerConfigurator->services(); - $services->set(RemoveUnusedPrivatePropertyRector::class); -}; diff --git a/.code-quality/rector.php b/.code-quality/rector.php index 65d88dd..fc3ec26 100644 --- a/.code-quality/rector.php +++ b/.code-quality/rector.php @@ -5,12 +5,10 @@ use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector; use Rector\Config\RectorConfig; use Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector; -use Rector\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector; use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertEqualsToSameRector; use Rector\Set\ValueObject\SetList; use Rector\PHPUnit\Set\PHPUnitSetList; -use Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector; use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictSetUpRector; @@ -35,8 +33,6 @@ PHPUnitSetList::PHPUNIT_CODE_QUALITY ]) ->withSkip([ - FinalizeClassesWithoutChildrenRector::class, - ChangeAndIfToEarlyReturnRector::class, TypedPropertyFromStrictSetUpRector::class, AddMethodCallBasedStrictParamTypeRector::class, FlipTypeControlToUseExclusiveTypeRector::class, diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8217b02..239416a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,18 +1,6 @@ name: Tests -on: - push: - branches: - - '**' - - '!TYPO3_V10' - - '!TYPO3V8' - - '!TYPO3V9' - pull_request: - branches: - - '**' - - '!TYPO3_V10' - - '!TYPO3V8' - - '!TYPO3V9' +on: [ push, pull_request ] jobs: build: @@ -22,12 +10,10 @@ jobs: strategy: fail-fast: false matrix: - typo3: [ ^11.5, ^12.4 ] - php: [ '8.0', '8.1', '8.2', '8.3' ] + typo3: [ ^12.4 ] + php: [ '8.1', '8.2', '8.3' ] experimental: [false] - exclude: - - typo3: ^12.4 - php: '8.0' + continue-on-error: ${{ matrix.experimental }} diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 212da43..1433157 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,6 +1,9 @@ build: nodes: analysis: + image: default-bionic + environment: + php: 8.3.0 tests: override: - php-scrutinizer-run diff --git a/Classes/Controller/BeUserAuthenticationController.php b/Classes/Controller/BeUserAuthenticationController.php index 5b8cd70..6e3642d 100644 --- a/Classes/Controller/BeUserAuthenticationController.php +++ b/Classes/Controller/BeUserAuthenticationController.php @@ -63,11 +63,9 @@ class BeUserAuthenticationController implements iAuthenticate */ public $restler; - private Loader $typo3Loader; - - public function __construct(Loader $typo3Loader) - { - $this->typo3Loader = $typo3Loader; + public function __construct( + private readonly Loader $typo3Loader + ) { $this->restler = Scope::get('Restler'); } diff --git a/Classes/Controller/FeUserAuthenticationController.php b/Classes/Controller/FeUserAuthenticationController.php index 61d1f7a..f1ff041 100644 --- a/Classes/Controller/FeUserAuthenticationController.php +++ b/Classes/Controller/FeUserAuthenticationController.php @@ -89,11 +89,9 @@ class FeUserAuthenticationController implements iAuthenticate */ public $restler; - private Loader $typo3Loader; - - public function __construct(Loader $typo3Loader) - { - $this->typo3Loader = $typo3Loader; + public function __construct( + private readonly Loader $typo3Loader + ) { $this->restler = Scope::get('Restler'); } diff --git a/Classes/System/Dispatcher.php b/Classes/System/Dispatcher.php index 4bd2fb0..f8d145c 100644 --- a/Classes/System/Dispatcher.php +++ b/Classes/System/Dispatcher.php @@ -83,7 +83,15 @@ protected function extractSiteUrl(ServerRequestInterface $request): string } if ($siteBasePath) { - return '/' . rtrim(preg_replace('%^' . preg_quote($siteBasePath, '%') . '%', '', $request->getUri()->getPath()), '/'); + return '/' . rtrim( + (string) preg_replace( + '%^' . preg_quote((string) $siteBasePath, '%') . '%', + '', + $request->getUri() + ->getPath() + ), + '/' + ); } return $request->getUri() diff --git a/Classes/System/RestApi/RestApiClient.php b/Classes/System/RestApi/RestApiClient.php index c8d0db4..6f61d8e 100644 --- a/Classes/System/RestApi/RestApiClient.php +++ b/Classes/System/RestApi/RestApiClient.php @@ -37,24 +37,15 @@ class RestApiClient implements SingletonInterface { - private Cache $typo3Cache; - - private ExtensionConfiguration $extensionConfiguration; - private bool $isExecutingRequest = false; private bool $isRequestPrepared = false; - private RestApiRequestScope $restApiRequestScope; - public function __construct( - ExtensionConfiguration $extensionConfiguration, - RestApiRequestScope $restApiRequestScope, - Cache $typo3Cache + private readonly ExtensionConfiguration $extensionConfiguration, + private readonly RestApiRequestScope $restApiRequestScope, + private readonly Cache $typo3Cache ) { - $this->extensionConfiguration = $extensionConfiguration; - $this->restApiRequestScope = $restApiRequestScope; - $this->typo3Cache = $typo3Cache; } public function isExecutingRequest(): bool diff --git a/Classes/System/RestApi/RestApiJsonFormat.php b/Classes/System/RestApi/RestApiJsonFormat.php index aab8538..fb87f22 100644 --- a/Classes/System/RestApi/RestApiJsonFormat.php +++ b/Classes/System/RestApi/RestApiJsonFormat.php @@ -53,13 +53,13 @@ public function decode($data) } try { - $decoded = json_decode($data, false, 512, $options); + $decoded = json_decode((string) $data, false, 512, $options); $this->handleJsonError(); } catch (\RuntimeException $runtimeException) { throw new RestException('400', $runtimeException->getMessage()); } - if (strlen($data) && $decoded === null || $decoded === $data) { + if (strlen((string) $data) && $decoded === null || $decoded === $data) { throw new RestException('400', 'Error parsing JSON'); } diff --git a/Classes/System/RestApi/RestApiRequest.php b/Classes/System/RestApi/RestApiRequest.php index 02cecbb..88fa011 100644 --- a/Classes/System/RestApi/RestApiRequest.php +++ b/Classes/System/RestApi/RestApiRequest.php @@ -88,10 +88,6 @@ class RestApiRequest extends Restler */ private string $restApiRequestMethod; - private RestApiRequestScope $restApiRequestScope; - - private Cache $typo3Cache; - /***************************************************************************************************************************/ /***************************************************************************************************************************/ /* Block of methods, which MUST be overridden from parent-class (otherwise this class can not work) *************************/ @@ -101,10 +97,10 @@ class RestApiRequest extends Restler * Override parent method...because we don't want to call it! * The original method would set some properties (e.g. set this object into static properties of global classes) */ - public function __construct(RestApiRequestScope $restApiRequestScope, Cache $typo3Cache) - { - $this->restApiRequestScope = $restApiRequestScope; - $this->typo3Cache = $typo3Cache; + public function __construct( + private readonly RestApiRequestScope $restApiRequestScope, + private readonly Cache $typo3Cache + ) { } /** @@ -235,7 +231,7 @@ protected function postCall() $_GET, $this->apiMethodInfo->metadata, $this->responseData, - get_class($this->responseFormat), + $this->responseFormat::class, [] // we don't know which headers would be 'normally' send - because this is an internal REST-API-call ); } diff --git a/Classes/System/Restler/AbstractExceptionHandler.php b/Classes/System/Restler/AbstractExceptionHandler.php index 632b346..76865aa 100644 --- a/Classes/System/Restler/AbstractExceptionHandler.php +++ b/Classes/System/Restler/AbstractExceptionHandler.php @@ -26,7 +26,6 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -use Aoe\Restler\Configuration\ExtensionConfiguration; use Luracast\Restler\RestException; use Luracast\Restler\Restler; use Luracast\Restler\Scope; @@ -37,13 +36,6 @@ */ abstract class AbstractExceptionHandler { - protected ExtensionConfiguration $extensionConfiguration; - - public function __construct(ExtensionConfiguration $extensionConfiguration) - { - $this->extensionConfiguration = $extensionConfiguration; - } - /** * handle HTTP-Status-Codes of type 1xx */ diff --git a/Classes/System/Restler/Builder.php b/Classes/System/Restler/Builder.php index 3c92fd0..c23b1bb 100644 --- a/Classes/System/Restler/Builder.php +++ b/Classes/System/Restler/Builder.php @@ -41,14 +41,10 @@ class Builder implements SingletonInterface { - private ExtensionConfiguration $extensionConfiguration; - - private CacheManager $cacheManager; - - public function __construct(ExtensionConfiguration $extensionConfiguration, CacheManager $cacheManager) - { - $this->extensionConfiguration = $extensionConfiguration; - $this->cacheManager = $cacheManager; + public function __construct( + private readonly ExtensionConfiguration $extensionConfiguration, + private readonly CacheManager $cacheManager, + ) { } /** diff --git a/Classes/System/Restler/Configuration.php b/Classes/System/Restler/Configuration.php index b5b422d..7589c96 100644 --- a/Classes/System/Restler/Configuration.php +++ b/Classes/System/Restler/Configuration.php @@ -41,11 +41,9 @@ */ class Configuration implements ConfigurationInterface { - private ExtensionConfiguration $extensionConfiguration; - - public function __construct(ExtensionConfiguration $extensionConfiguration) - { - $this->extensionConfiguration = $extensionConfiguration; + public function __construct( + private readonly ExtensionConfiguration $extensionConfiguration + ) { } /** diff --git a/Classes/System/Restler/Format/HalJsonFormat.php b/Classes/System/Restler/Format/HalJsonFormat.php index a507c5a..02ee315 100644 --- a/Classes/System/Restler/Format/HalJsonFormat.php +++ b/Classes/System/Restler/Format/HalJsonFormat.php @@ -114,7 +114,7 @@ public function encode($data, $humanReadable = false) if (self::$unEscapedUnicode) { $result = preg_replace_callback( '/\\\u(\w\w\w\w)/', - static function (array $matches) { + static function (array $matches): string|false { if (function_exists('mb_convert_encoding')) { return mb_convert_encoding(pack('H*', $matches[1]), 'UTF-8', 'UTF-16BE'); } @@ -154,13 +154,13 @@ public function decode($data): ?array } try { - $decoded = json_decode($data, false, 512, $options); + $decoded = json_decode((string) $data, false, 512, $options); $this->handleJsonError(); } catch (\RuntimeException $runtimeException) { throw new RestException('400', $runtimeException->getMessage()); } - if (strlen($data) && $decoded === null || $decoded === $data) { + if (strlen((string) $data) && $decoded === null || $decoded === $data) { throw new RestException('400', 'Error parsing JSON'); } diff --git a/Classes/System/Restler/RestlerExtended.php b/Classes/System/Restler/RestlerExtended.php index 6278c79..3025119 100644 --- a/Classes/System/Restler/RestlerExtended.php +++ b/Classes/System/Restler/RestlerExtended.php @@ -37,10 +37,6 @@ class RestlerExtended extends Restler { - protected ?ServerRequestInterface $request; - - private Cache $typo3Cache; - /***************************************************************************************************************************/ /***************************************************************************************************************************/ /* Block of methods, which MUST be overriden from parent-class (otherwise we can't use the TYPO3-caching-framework) ********/ @@ -54,13 +50,13 @@ class RestlerExtended extends Restler * every time to map it to the URL * * @param bool $refreshCache will update the cache when set to true - * @param ServerRequestInterface $request frontend request + * @param ServerRequestInterface $request frontend request */ public function __construct( - Cache $typo3Cache, + private readonly Cache $typo3Cache, $productionMode = false, $refreshCache = false, - ServerRequestInterface $request = null + private readonly ?ServerRequestInterface $request = null ) { parent::__construct($productionMode, $refreshCache); @@ -73,9 +69,6 @@ public function __construct( Scope::$classAliases['HalJsonFormat'] = \Aoe\Restler\System\Restler\Format\HalJsonFormat::class; $this->setSupportedFormats('HalJsonFormat'); - $this->typo3Cache = $typo3Cache; - $this->request = $request; - // set pathes from request if present if ($this->request !== null) { $this->url = $this->getPath(); @@ -91,7 +84,7 @@ public function handle() try { // get information about the REST-request (this is required to check, if we can handle the REST-request by TYPO3-cache) $this->get(); - } catch (RestException $restException) { + } catch (RestException) { // Exception occurred (e.g. 'Error encoding/decoding JSON') during getting information about REST-request: // Let restler handle the error (e.g. that JSON could not be read) - and NOT the TYPO3-exception-handling! return parent::handle(); @@ -143,7 +136,10 @@ protected function getPath(): string ->withPath($siteBasePath); // set url with base path removed - return rtrim(preg_replace('%^' . preg_quote($siteBasePath, '%') . '%', '', $this->request->getUri()->getPath()), '/'); + return rtrim( + (string) preg_replace('%^' . preg_quote((string) $siteBasePath, '%') . '%', '', $this->request->getUri()->getPath()), + '/' + ); } return parent::getPath(); @@ -163,7 +159,7 @@ protected function postCall() $_GET, $this->apiMethodInfo->metadata, $this->responseData, - get_class($this->responseFormat), + $this->responseFormat::class, headers_list() ); } @@ -180,7 +176,7 @@ private function handleRequestByTypo3Cache(): string } else { // set/manipulate headers foreach ($cacheEntry['responseHeaders'] as $responseHeader) { - if (substr($responseHeader, 0, 8) === 'Expires:') { + if (str_starts_with((string) $responseHeader, 'Expires:')) { if ($cacheEntry['frontendCacheExpires'] === 0) { $expires = $cacheEntry['frontendCacheExpires']; } else { diff --git a/Classes/System/Restler/Routes.php b/Classes/System/Restler/Routes.php index 2aa03bd..545980c 100644 --- a/Classes/System/Restler/Routes.php +++ b/Classes/System/Restler/Routes.php @@ -17,7 +17,7 @@ public static function containsUrl(string $uri): bool { foreach (self::findAll() as $routes) { foreach ($routes as $route) { - $routeMatcher = '/^' . preg_quote('/' . rtrim($route['route']['url'], '/*'), '/') . '/'; + $routeMatcher = '/^' . preg_quote('/' . rtrim((string) $route['route']['url'], '/*'), '/') . '/'; if (is_array($route['route']['arguments'])) { foreach ($route['route']['arguments'] as $argumentName => $argumentNumber) { diff --git a/Classes/System/RestlerBuilderAware.php b/Classes/System/RestlerBuilderAware.php index 75b7705..49fc20f 100644 --- a/Classes/System/RestlerBuilderAware.php +++ b/Classes/System/RestlerBuilderAware.php @@ -39,11 +39,9 @@ abstract class RestlerBuilderAware private ?Builder $restlerBuilder = null; - private ExtensionConfiguration $extensionConfiguration; - - public function __construct(ExtensionConfiguration $extensionConfiguration) - { - $this->extensionConfiguration = $extensionConfiguration; + public function __construct( + private readonly ExtensionConfiguration $extensionConfiguration + ) { } /** diff --git a/Classes/System/TYPO3/Cache.php b/Classes/System/TYPO3/Cache.php index 0ce8120..8f8f188 100644 --- a/Classes/System/TYPO3/Cache.php +++ b/Classes/System/TYPO3/Cache.php @@ -64,7 +64,7 @@ class Cache implements SingletonInterface */ public const API_METHOD_TYPO3CACHE_TAGS = 'restler_typo3cache_tags'; - private FrontendInterface $cache; + private readonly FrontendInterface $cache; public function __construct(CacheManager $cacheManager) { @@ -93,7 +93,7 @@ public function cacheResponseByTypo3Cache( $identifier = $this->buildIdentifier($requestUri, $requestGetData); $frontendCacheExpires = (int) ($apiMethodInfoMetadata['expires'] ?? 0); $typo3CacheExpires = (int) $apiMethodInfoMetadata[self::API_METHOD_TYPO3CACHE_EXPIRES]; - $typo3CacheTags = explode(',', $apiMethodInfoMetadata[self::API_METHOD_TYPO3CACHE_TAGS]); + $typo3CacheTags = explode(',', (string) $apiMethodInfoMetadata[self::API_METHOD_TYPO3CACHE_TAGS]); $cacheData = []; $cacheData['responseCode'] = $responseCode; diff --git a/Classes/System/TYPO3/Loader.php b/Classes/System/TYPO3/Loader.php index 22e9fd5..e7d3c43 100644 --- a/Classes/System/TYPO3/Loader.php +++ b/Classes/System/TYPO3/Loader.php @@ -51,32 +51,14 @@ class Loader implements SingletonInterface { - protected TimeTracker $timeTracker; - - private BackendUserAuthenticator $backendUserAuthenticator; - - private FrontendUserAuthenticator $frontendUserAuthenticator; - - private MockRequestHandler $mockRequestHandler; - - private RequestHandler $requestHandler; - - private TypoScriptFrontendInitialization $typoScriptFrontendInitialization; - public function __construct( - BackendUserAuthenticator $backendUserAuthenticator, - FrontendUserAuthenticator $frontendUserAuthenticator, - MockRequestHandler $mockRequestHandler, - RequestHandler $requestHandler, - TimeTracker $timeTracker, - TypoScriptFrontendInitialization $typoScriptFrontendInitialization + private readonly BackendUserAuthenticator $backendUserAuthenticator, + private readonly FrontendUserAuthenticator $frontendUserAuthenticator, + private readonly MockRequestHandler $mockRequestHandler, + private readonly RequestHandler $requestHandler, + private readonly TimeTracker $timeTracker, + private readonly TypoScriptFrontendInitialization $typoScriptFrontendInitialization ) { - $this->backendUserAuthenticator = $backendUserAuthenticator; - $this->frontendUserAuthenticator = $frontendUserAuthenticator; - $this->mockRequestHandler = $mockRequestHandler; - $this->requestHandler = $requestHandler; - $this->timeTracker = $timeTracker; - $this->typoScriptFrontendInitialization = $typoScriptFrontendInitialization; } /** diff --git a/Classes/System/TYPO3/RestlerEnhancer.php b/Classes/System/TYPO3/RestlerEnhancer.php index 13fb5d4..583f1c9 100644 --- a/Classes/System/TYPO3/RestlerEnhancer.php +++ b/Classes/System/TYPO3/RestlerEnhancer.php @@ -21,7 +21,7 @@ */ class RestlerEnhancer extends RestlerBuilderAware implements DecoratingEnhancerInterface { - private string $default; + private readonly string $default; public function __construct(array $configuration) { diff --git a/Tests/Unit/BaseTestCase.php b/Tests/Unit/BaseTestCase.php index 783e95d..c82e38f 100644 --- a/Tests/Unit/BaseTestCase.php +++ b/Tests/Unit/BaseTestCase.php @@ -42,7 +42,7 @@ abstract class BaseTestCase extends UnitTestCase */ protected function callUnaccessibleMethodOfObject($object, $methodName, array $methodParams = []) { - $class = new \ReflectionClass(get_class($object)); + $class = new \ReflectionClass($object::class); $method = $class->getMethod($methodName); $method->setAccessible(true); diff --git a/Tests/Unit/System/RestApi/RestApiRequestTest.php b/Tests/Unit/System/RestApi/RestApiRequestTest.php index cef8c43..b222524 100644 --- a/Tests/Unit/System/RestApi/RestApiRequestTest.php +++ b/Tests/Unit/System/RestApi/RestApiRequestTest.php @@ -176,7 +176,7 @@ public function testShouldRestoreOriginalRestApiRequestWhenExecutionOfRestApiReq try { $this->restApiRequest->executeRestApiRequest($requestMethod, $requestUri); - } catch (Exception $e) { + } catch (Exception) { } $this->assertEquals($this->originalGetVars, $_GET); @@ -205,7 +205,7 @@ public function testShouldRestoreOriginalRestApiRequestWhenExecutionOfRestApiReq try { $this->restApiRequest->executeRestApiRequest($requestMethod, $requestUri); - } catch (Exception $e) { + } catch (Exception) { } $this->assertEquals($this->originalGetVars, $_GET);