Skip to content

Commit 50fd5bc

Browse files
committed
Format code using PHP-CS-Fixer
1 parent de0c913 commit 50fd5bc

174 files changed

Lines changed: 920 additions & 1895 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.php-cs-fixer.dist.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
$finder = (new PhpCsFixer\Finder())->in(__DIR__);
4+
5+
return (new PhpCsFixer\Config())
6+
->setRules(
7+
[
8+
'@PSR12' => true,
9+
'@Symfony' => true,
10+
// Only allowed if risky rules are enabled: 'strict_param' => true,
11+
'array_indentation' => true,
12+
'array_syntax' => ['syntax' => 'short'],
13+
'binary_operator_spaces' => ['operators' => ['=>' => 'align_single_space_minimal']],
14+
'concat_space' => ['spacing' => 'one'],
15+
'global_namespace_import' => ['import_classes' => true, 'import_constants' => true, 'import_functions' => true],
16+
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
17+
'method_chaining_indentation' => true,
18+
'no_alias_language_construct_call' => false,
19+
'no_unneeded_control_parentheses' => false,
20+
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true],
21+
'phpdoc_annotation_without_dot' => true,
22+
'phpdoc_summary' => false,
23+
'simplified_if_return' => true,
24+
'single_line_throw' => false,
25+
],
26+
)
27+
28+
->setFinder($finder)
29+
;

Build/FunctionalTestsBootstrap.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
3+
use TYPO3\TestingFramework\Core\Testbase;
4+
25
/*
36
* This file is part of the TYPO3 CMS project.
47
*
@@ -13,7 +16,7 @@
1316
*/
1417

1518
call_user_func(function () {
16-
$testbase = new \TYPO3\TestingFramework\Core\Testbase();
19+
$testbase = new Testbase();
1720
$testbase->defineOriginalRootPath();
1821
$testbase->createDirectory(ORIGINAL_ROOT . 'typo3temp/var/tests');
1922
$testbase->createDirectory(ORIGINAL_ROOT . 'typo3temp/var/transient');

Build/UnitTestsBootstrap.php

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
<?php
2+
3+
use TYPO3\CMS\Core\Cache\Backend\NullBackend;
4+
use TYPO3\CMS\Core\Cache\Frontend\PhpFrontend;
5+
use TYPO3\CMS\Core\Configuration\ConfigurationManager;
6+
use TYPO3\CMS\Core\Core\Bootstrap;
7+
use TYPO3\CMS\Core\Core\Environment;
8+
use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder;
9+
use TYPO3\CMS\Core\Package\UnitTestPackageManager;
10+
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
11+
use TYPO3\CMS\Core\Utility\GeneralUtility;
12+
use TYPO3\TestingFramework\Core\Testbase;
13+
214
/*
315
* This file is part of the TYPO3 CMS project.
416
*
@@ -13,7 +25,7 @@
1325
*/
1426

1527
call_user_func(function () {
16-
$testbase = new \TYPO3\TestingFramework\Core\Testbase();
28+
$testbase = new Testbase();
1729

1830
// These if's are for core testing (package typo3/cms) only. cms-composer-installer does
1931
// not create the autoload-include.php file that sets these env vars and sets composer
@@ -32,36 +44,36 @@
3244
$testbase->defineSitePath();
3345

3446
$composerMode = defined('TYPO3_COMPOSER_MODE') && TYPO3_COMPOSER_MODE === true;
35-
$requestType = \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_BE | \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_CLI;
36-
\TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(0, $requestType, $composerMode);
47+
$requestType = SystemEnvironmentBuilder::REQUESTTYPE_BE | SystemEnvironmentBuilder::REQUESTTYPE_CLI;
48+
SystemEnvironmentBuilder::run(0, $requestType, $composerMode);
3749

38-
$testbase->createDirectory(\TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/typo3conf/ext');
39-
$testbase->createDirectory(\TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/typo3temp/assets');
40-
$testbase->createDirectory(\TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/typo3temp/var/tests');
41-
$testbase->createDirectory(\TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/typo3temp/var/transient');
50+
$testbase->createDirectory(Environment::getPublicPath() . '/typo3conf/ext');
51+
$testbase->createDirectory(Environment::getPublicPath() . '/typo3temp/assets');
52+
$testbase->createDirectory(Environment::getPublicPath() . '/typo3temp/var/tests');
53+
$testbase->createDirectory(Environment::getPublicPath() . '/typo3temp/var/transient');
4254

4355
// Retrieve an instance of class loader and inject to core bootstrap
4456
$classLoader = require $testbase->getPackagesPath() . '/autoload.php';
45-
\TYPO3\CMS\Core\Core\Bootstrap::initializeClassLoader($classLoader);
57+
Bootstrap::initializeClassLoader($classLoader);
4658

4759
// Initialize default TYPO3_CONF_VARS
48-
$configurationManager = new \TYPO3\CMS\Core\Configuration\ConfigurationManager();
60+
$configurationManager = new ConfigurationManager();
4961
$GLOBALS['TYPO3_CONF_VARS'] = $configurationManager->getDefaultConfiguration();
5062

51-
$cache = new \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend(
63+
$cache = new PhpFrontend(
5264
'core',
53-
new \TYPO3\CMS\Core\Cache\Backend\NullBackend('production', []),
65+
new NullBackend('production', []),
5466
);
5567
// Set all packages to active
56-
$packageManager = \TYPO3\CMS\Core\Core\Bootstrap::createPackageManager(
57-
\TYPO3\CMS\Core\Package\UnitTestPackageManager::class,
58-
\TYPO3\CMS\Core\Core\Bootstrap::createPackageCache($cache)
68+
$packageManager = Bootstrap::createPackageManager(
69+
UnitTestPackageManager::class,
70+
Bootstrap::createPackageCache($cache)
5971
);
6072

61-
\TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Package\PackageManager::class, $packageManager);
62-
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::setPackageManager($packageManager);
73+
GeneralUtility::setSingletonInstance(TYPO3\CMS\Core\Package\PackageManager::class, $packageManager);
74+
ExtensionManagementUtility::setPackageManager($packageManager);
6375

6476
$testbase->dumpClassLoadingInformation();
6577

66-
\TYPO3\CMS\Core\Utility\GeneralUtility::purgeInstances();
78+
GeneralUtility::purgeInstances();
6779
});

Classes/Access/AbstractAccessController.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ public function __construct(protected ObjectManagerInterface $objectManager)
1919
/**
2020
* Checks if a valid user is logged in
2121
*
22-
* @param RestRequestInterface $request
23-
* @return Access
2422
* @throws Exception
2523
*/
2624
protected function checkAuthentication(RestRequestInterface $request): Access
@@ -32,6 +30,6 @@ protected function checkAuthentication(RestRequestInterface $request): Access
3230
throw $exception;
3331
}
3432

35-
return $isAuthenticated === false ? Access::unauthorized() : Access::authorized();
33+
return false === $isAuthenticated ? Access::unauthorized() : Access::authorized();
3634
}
3735
}

Classes/Access/AccessControllerInterface.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,11 @@ interface AccessControllerInterface
1111
{
1212
/**
1313
* Returns if the current request's client has access to the requested resource
14-
*
15-
* @param RestRequestInterface $request
16-
* @return Access
1714
*/
1815
public function getAccess(RestRequestInterface $request): Access;
1916

2017
/**
2118
* Returns if the given request needs authentication
22-
*
23-
* @param RestRequestInterface $request
24-
* @return bool
2519
*/
2620
public function requestNeedsAuthentication(RestRequestInterface $request): bool;
2721
}

Classes/Access/ConfigurationBasedAccessController.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,13 @@ class ConfigurationBasedAccessController extends AbstractAccessController
2727

2828
public function __construct(
2929
ConfigurationProviderInterface $configurationProvider,
30-
ObjectManagerInterface $objectManager
30+
ObjectManagerInterface $objectManager,
3131
) {
3232
parent::__construct($objectManager);
3333
$this->configurationProvider = $configurationProvider;
3434
}
3535

3636
/**
37-
* @param RestRequestInterface $request
38-
* @return Access
3937
* @throws InvalidConfigurationException
4038
*/
4139
public function getAccess(RestRequestInterface $request): Access
@@ -50,9 +48,6 @@ public function getAccess(RestRequestInterface $request): Access
5048

5149
/**
5250
* Returns the configuration matching the given resource type
53-
*
54-
* @param ResourceType $resourceType
55-
* @return ResourceConfiguration
5651
*/
5752
public function getConfigurationForResourceType(ResourceType $resourceType): ResourceConfiguration
5853
{
@@ -62,8 +57,6 @@ public function getConfigurationForResourceType(ResourceType $resourceType): Res
6257
/**
6358
* Returns if the given request needs authentication
6459
*
65-
* @param RestRequestInterface $request
66-
* @return bool
6760
* @throws InvalidConfigurationException
6861
*/
6962
public function requestNeedsAuthentication(RestRequestInterface $request): bool
@@ -73,19 +66,12 @@ public function requestNeedsAuthentication(RestRequestInterface $request): bool
7366

7467
/**
7568
* Returns if the given request requires authorization
76-
*
77-
* @param RestRequestInterface $request
78-
* @return bool
7969
*/
8070
protected function requiresAuthorization(RestRequestInterface $request): bool
8171
{
8272
return !in_array(strtoupper($request->getMethod()), self::ACCESS_NOT_REQUIRED);
8373
}
8474

85-
/**
86-
* @param RestRequestInterface $request
87-
* @return Access
88-
*/
8975
protected function getAccessConfiguration(RestRequestInterface $request): Access
9076
{
9177
if (!$this->requiresAuthorization($request)) {

Classes/Authentication/AbstractAuthenticationProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ abstract class AbstractAuthenticationProvider implements AuthenticationProviderI
1111
/**
1212
* Tries to authenticate the current request
1313
*
14-
* @param RestRequestInterface $request
1514
* @return bool Returns if the authentication was successful
1615
*/
1716
public function authenticate(RestRequestInterface $request): bool

Classes/Authentication/AuthenticationProviderCollection.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public function __construct($providers)
4141
/**
4242
* Loops through each Authentication Provider in the collection and tries to authenticate the current request
4343
*
44-
* @param RestRequestInterface $request
4544
* @return bool Returns if the authentication was successful
4645
*/
4746
public function authenticate(RestRequestInterface $request): bool
@@ -59,7 +58,6 @@ public function authenticate(RestRequestInterface $request): bool
5958
/**
6059
* Sets the used Authentication Providers
6160
*
62-
* @param SplObjectStorage $providers
6361
* @return $this
6462
*/
6563
public function setProviders(SplObjectStorage $providers): self
@@ -71,8 +69,6 @@ public function setProviders(SplObjectStorage $providers): self
7169

7270
/**
7371
* Returns the used Authentication Providers
74-
*
75-
* @return SplObjectStorage
7672
*/
7773
public function getProviders(): SplObjectStorage
7874
{
@@ -82,7 +78,6 @@ public function getProviders(): SplObjectStorage
8278
/**
8379
* Adds the given Authentication Provider
8480
*
85-
* @param AuthenticationProviderInterface $provider
8681
* @return $this
8782
*/
8883
public function addProvider(AuthenticationProviderInterface $provider): self
@@ -95,7 +90,6 @@ public function addProvider(AuthenticationProviderInterface $provider): self
9590
/**
9691
* Removes the given Authentication Provider
9792
*
98-
* @param AuthenticationProviderInterface $provider
9993
* @return $this
10094
*/
10195
public function removeProvider(AuthenticationProviderInterface $provider): self

Classes/Authentication/AuthenticationProviderInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ interface AuthenticationProviderInterface
1111
/**
1212
* Tries to authenticate the current request
1313
*
14-
* @param RestRequestInterface $request
1514
* @return bool Returns if the authentication was successful
1615
*/
1716
public function authenticate(RestRequestInterface $request): bool;

Classes/Authentication/BasicAuthenticationProvider.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ class BasicAuthenticationProvider extends AbstractAuthenticationProvider
1818

1919
/**
2020
* BasicAuth Provider constructor
21-
*
22-
* @param UserProviderInterface $userProvider
2321
*/
2422
public function __construct(UserProviderInterface $userProvider)
2523
{
@@ -29,7 +27,6 @@ public function __construct(UserProviderInterface $userProvider)
2927
/**
3028
* Tries to authenticate the current request
3129
*
32-
* @param RestRequestInterface $request
3330
* @return bool Returns if the authentication was successful
3431
*/
3532
public function authenticate(RestRequestInterface $request): bool
@@ -59,7 +56,7 @@ private function checkServerData($key)
5956
{
6057
if (isset($_SERVER[$key])) {
6158
$value = $_SERVER[$key];
62-
if (strpos(strtolower($value), 'basic') === 0) {
59+
if (0 === strpos(strtolower($value), 'basic')) {
6360
return explode(':', base64_decode(substr($value, 6)));
6461
}
6562
}

0 commit comments

Comments
 (0)