Commit 3f69a907 authored by Tino Goratsch's avatar Tino Goratsch

backport the coding guidelines from the feature/next branch into the current mainline branch

parent 31b3c862
Pipeline #16385867 (#) passed with stages
in 5 minutes and 35 seconds
......@@ -19,42 +19,24 @@ return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setLineEnding("\n")
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => true,
'cast_spaces' => ['space' => 'none'],
'class_attributes_separation' => ['elements' => ['method']],
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'single'],
'header_comment' => [
'commentType' => 'PHPDoc',
'header' => $header,
],
'increment_style' => ['style' =>'pre'],
'method_chaining_indentation' => true,
'modernize_types_casting' => true,
'native_function_casing' => true,
'native_function_invocation' => true,
'normalize_index_brace' => true,
'no_blank_lines_after_class_opening' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_null_property_initialization' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_unneeded_control_parentheses' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'object_operator_without_whitespace' => true,
'ordered_imports' => ['importsOrder' => null],
'phpdoc_no_package' => true,
'single_quote' => true,
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'whitespace_after_comma_in_array' => true,
'yoda_style' => false,
])
->setFinder($finder)
;
......@@ -30,19 +30,19 @@ class ACL
*/
protected $userRoleRepository;
/**
* Array mit den jeweiligen Rollen zugewiesenen Berechtigungen
* Array mit den jeweiligen Rollen zugewiesenen Berechtigungen.
*
* @var array
*/
protected $privileges = [];
/**
* Array mit den dem Benutzer zugewiesenen Rollen
* Array mit den dem Benutzer zugewiesenen Rollen.
*
* @var array
*/
protected $userRoles = [];
/**
* Array mit allen registrierten Ressourcen
* Array mit allen registrierten Ressourcen.
*
* @var array
*/
......@@ -50,10 +50,11 @@ class ACL
/**
* ACL constructor.
* @param \ACP3\Modules\ACP3\Users\Model\UserModel $user
* @param \ACP3\Core\Modules $modules
*
* @param \ACP3\Modules\ACP3\Users\Model\UserModel $user
* @param \ACP3\Core\Modules $modules
* @param \ACP3\Core\ACL\Model\Repository\UserRoleRepositoryInterface $userRoleRepository
* @param \ACP3\Modules\ACP3\Permissions\Cache $permissionsCache
* @param \ACP3\Modules\ACP3\Permissions\Cache $permissionsCache
*/
public function __construct(
UserModel $user,
......@@ -68,9 +69,9 @@ class ACL
}
/**
* Gibt die dem jeweiligen Benutzer zugewiesenen Rollen zurück
* Gibt die dem jeweiligen Benutzer zugewiesenen Rollen zurück.
*
* @param integer $userId
* @param int $userId
*
* @return array
*/
......@@ -91,9 +92,9 @@ class ACL
}
/**
* Gibt die dem jeweiligen Benutzer zugewiesenen Rollen zurück
* Gibt die dem jeweiligen Benutzer zugewiesenen Rollen zurück.
*
* @param integer $userId
* @param int $userId
*
* @return array
*/
......@@ -116,9 +117,9 @@ class ACL
}
/**
* @param integer $roleId
* @param int $roleId
*
* @return boolean
* @return bool
*/
public function userHasRole($roleId)
{
......@@ -126,7 +127,7 @@ class ACL
}
/**
* Initializes the available user privileges
* Initializes the available user privileges.
*/
protected function getPrivileges()
{
......@@ -138,7 +139,7 @@ class ACL
}
/**
* Returns the role permissions
* Returns the role permissions.
*
* @param array $roleIds
*
......@@ -150,11 +151,11 @@ class ACL
}
/**
* Überpüft, ob eine Modulaktion existiert und der Benutzer darauf Zugriff hat
* Überpüft, ob eine Modulaktion existiert und der Benutzer darauf Zugriff hat.
*
* @param string $resource
*
* @return boolean
* @return bool
*/
public function hasPermission($resource)
{
......@@ -172,7 +173,7 @@ class ACL
/**
* @param string $resource
*
* @return boolean
* @return bool
*/
protected function canAccessResource($resource)
{
......@@ -212,7 +213,7 @@ class ACL
}
/**
* Gibt alle in der Datenbank vorhandenen Ressourcen zurück
* Gibt alle in der Datenbank vorhandenen Ressourcen zurück.
*
* @return array
*/
......@@ -226,12 +227,12 @@ class ACL
}
/**
* Returns, whether the current user has the given privilege
* Returns, whether the current user has the given privilege.
*
* @param string $module
* @param string $privilegeKey
*
* @return boolean
* @return bool
*/
protected function userHasPrivilege($module, $privilegeKey)
{
......
......@@ -46,7 +46,7 @@ abstract class AbstractBootstrap implements BootstrapInterface
}
/**
* Set monolog as the default PHP error handler
* Set monolog as the default PHP error handler.
*/
public function setErrorHandler()
{
......@@ -54,7 +54,7 @@ abstract class AbstractBootstrap implements BootstrapInterface
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getContainer()
{
......@@ -70,7 +70,7 @@ abstract class AbstractBootstrap implements BootstrapInterface
}
/**
* Checks, whether the database configuration file exists
* Checks, whether the database configuration file exists.
*
* @return bool
*/
......
......@@ -19,7 +19,7 @@ use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
use Symfony\Component\HttpFoundation\Response;
/**
* Bootstraps the application
* Bootstraps the application.
*/
class Bootstrap extends AbstractBootstrap
{
......@@ -29,7 +29,7 @@ class Bootstrap extends AbstractBootstrap
private $systemSettings = [];
/**
* @inheritdoc
* {@inheritdoc}
*/
public function handle(SymfonyRequest $request, $type = self::MASTER_REQUEST, $catch = true)
{
......@@ -40,7 +40,7 @@ class Bootstrap extends AbstractBootstrap
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function initializeClasses(SymfonyRequest $symfonyRequest)
{
......@@ -62,7 +62,7 @@ class Bootstrap extends AbstractBootstrap
/**
* @param SymfonyRequest $symfonyRequest
* @param string $filePath
* @param string $filePath
*/
private function dumpContainer(SymfonyRequest $symfonyRequest, $filePath)
{
......@@ -85,7 +85,7 @@ class Bootstrap extends AbstractBootstrap
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function outputPage()
{
......@@ -123,7 +123,7 @@ class Bootstrap extends AbstractBootstrap
}
/**
* Sets the theme paths
* Sets the theme paths.
*/
private function setThemePaths()
{
......@@ -140,7 +140,7 @@ class Bootstrap extends AbstractBootstrap
}
/**
* Checks, whether the maintenance mode is active
* Checks, whether the maintenance mode is active.
*
* @return bool
*/
......@@ -149,7 +149,7 @@ class Bootstrap extends AbstractBootstrap
/** @var \ACP3\Core\Http\Request $request */
$request = $this->container->get('core.http.request');
return (bool)$this->systemSettings['maintenance_mode'] === true &&
return (bool) $this->systemSettings['maintenance_mode'] === true &&
$request->getArea() !== AreaEnum::AREA_ADMIN &&
\strpos($request->getQuery(), 'users/index/login/') !== 0;
}
......@@ -176,7 +176,8 @@ class Bootstrap extends AbstractBootstrap
/**
* @param \Exception $exception
* @param string $route
* @param string $route
*
* @return Response
*/
private function handleException(\Exception $exception, $route)
......@@ -192,9 +193,10 @@ class Bootstrap extends AbstractBootstrap
}
/**
* Renders an exception
* Renders an exception.
*
* @param \Exception $exception
*
* @return Response
*/
private function renderApplicationException(\Exception $exception)
......@@ -215,7 +217,7 @@ class Bootstrap extends AbstractBootstrap
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function startupChecks()
{
......
......@@ -26,7 +26,7 @@ class BootstrapCache extends HttpCache implements CacheInvalidation
use EventDispatchingHttpCache;
/**
* @inheritdoc
* {@inheritdoc}
*/
public function __construct(
HttpKernelInterface $kernel,
......@@ -51,7 +51,7 @@ class BootstrapCache extends HttpCache implements CacheInvalidation
/**
* Made public to allow event listeners to do refresh operations.
*
* {@inheritDoc}
* {@inheritdoc}
*/
public function fetch(Request $request, $catch = false)
{
......
......@@ -18,7 +18,7 @@ class StaticAssetsListener implements EventSubscriberInterface
const PLACEHOLDER = '</body>';
/**
* @inheritdoc
* {@inheritdoc}
*/
public static function getSubscribedEvents()
{
......@@ -45,6 +45,7 @@ class StaticAssetsListener implements EventSubscriberInterface
/**
* @param string $tplOutput
*
* @return string
*/
private function getCleanedUpTemplateOutput(string $tplOutput): string
......@@ -54,6 +55,7 @@ class StaticAssetsListener implements EventSubscriberInterface
/**
* @param string $tplOutput
*
* @return string
*/
private function addElementsFromTemplates(string $tplOutput): string
......
......@@ -14,24 +14,25 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
interface BootstrapInterface extends HttpKernelInterface
{
/**
* Contains the current ACP3 version string
* Contains the current ACP3 version string.
*/
const VERSION = '4.20.0';
/**
* Performs some startup checks
* Performs some startup checks.
*/
public function startUpChecks();
/**
* Initializes the dependency injection container
* Initializes the dependency injection container.
*
* @param SymfonyRequest $symfonyRequest
* @return void
*/
public function initializeClasses(SymfonyRequest $symfonyRequest);
/**
* Handle the request and output the page
* Handle the request and output the page.
*
* @return Response
*/
public function outputPage();
......
......@@ -38,9 +38,9 @@ class ControllerActionDispatcher
/**
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher
* @param \ACP3\Core\Http\RequestInterface $request
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
* @param ArgumentResolverInterface $argumentResolver
* @param \ACP3\Core\Http\RequestInterface $request
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
* @param ArgumentResolverInterface $argumentResolver
*/
public function __construct(
EventDispatcherInterface $eventDispatcher,
......@@ -56,7 +56,8 @@ class ControllerActionDispatcher
/**
* @param string $serviceId
* @param array $arguments
* @param array $arguments
*
* @return Response|string
*
* @throws ControllerActionNotFoundException
......@@ -106,9 +107,10 @@ class ControllerActionDispatcher
/**
* @param \ACP3\Core\Controller\ActionInterface $controller
* @param array $arguments
* @param array $arguments
*
* @return mixed
*
* @throws \ACP3\Core\Controller\Exception\ResultNotExistsException
*/
private function executeControllerAction(ActionInterface $controller, array $arguments)
......@@ -124,6 +126,7 @@ class ControllerActionDispatcher
/**
* @param ActionInterface $controller
*
* @return array
*/
private function getCallable(ActionInterface $controller)
......