Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,27 +68,29 @@
->setRules(
[
// Basic ruleset is PSR 12
'@PSR12' => true,
'@PSR12' => true,
// Short array syntax
'array_syntax' => ['syntax' => 'short'],
'array_syntax' => ['syntax' => 'short'],
// List of values separated by a comma is contained on a single line should not have a trailing comma like [$foo, $bar,] = ...
'no_trailing_comma_in_singleline' => true,
'no_trailing_comma_in_singleline' => true,
// Arrays on multiline should have a trailing comma
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
// Align elements in multiline array and variable declarations on new lines below each other
'binary_operator_spaces' => ['operators' => ['=>' => 'align_single_space_minimal', '=' => 'align']],
'binary_operator_spaces' => ['operators' => ['=>' => 'align_single_space_minimal', '=' => 'align']],
// The "No break" comment in switch statements
'no_break_comment' => ['comment_text' => 'No break'],
'no_break_comment' => ['comment_text' => 'No break'],
// Remove unused imports
'no_unused_imports' => true,
'no_unused_imports' => true,
// Classes from the global namespace should not be imported
'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false],
'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false],
// Alpha order imports
'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'],
'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'],
// There should not be useless else cases
'no_useless_else' => true,
'no_useless_else' => true,
// Native function invocation
'native_function_invocation' => ['include' => ['@compiler_optimized']],
'native_function_invocation' => ['include' => ['@compiler_optimized']],
// Adds null to type declarations when parameter have a default null value
'nullable_type_declaration_for_default_null_value' => true,
]
)
->setFinder($finder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ class ActionlogsController extends AdminController
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
* @param MVCFactoryInterface $factory The factory.
* @param CMSApplication $app The Application for the dispatcher
* @param Input $input Input
* @param ?MVCFactoryInterface $factory The factory.
* @param CMSApplication $app The Application for the dispatcher
* @param Input $input Input
*
* @since 3.9.0
*
* @throws \Exception
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null, $app = null, $input = null)
{
parent::__construct($config, $factory, $app, $input);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ class AssociationsModel extends ListModel
/**
* Override parent constructor.
*
* @param array $config An optional associative array of configuration settings.
* @param MVCFactoryInterface $factory The factory.
* @param array $config An optional associative array of configuration settings.
* @param ?MVCFactoryInterface $factory The factory.
*
* @see \Joomla\CMS\MVC\Model\BaseDatabaseModel
* @since 3.7
*/
public function __construct($config = [], MVCFactoryInterface $factory = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null)
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class BannersController extends AdminController
*
* @since 3.0
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null, $app = null, $input = null)
{
parent::__construct($config, $factory, $app, $input);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function boot(ContainerInterface $container)
*
* @since 4.0.0
*/
protected function getTableNameForSection(string $section = null)
protected function getTableNameForSection(?string $section = null)
{
return 'banners';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class BannerTable extends Table implements VersionableTableInterface
*
* @since 1.5
*/
public function __construct(DatabaseDriver $db, DispatcherInterface $dispatcher = null)
public function __construct(DatabaseDriver $db, ?DispatcherInterface $dispatcher = null)
{
$this->typeAlias = 'com_banners.banner';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ClientTable extends Table implements VersionableTableInterface
*
* @since 1.5
*/
public function __construct(DatabaseDriver $db, DispatcherInterface $dispatcher = null)
public function __construct(DatabaseDriver $db, ?DispatcherInterface $dispatcher = null)
{
$this->typeAlias = 'com_banners.client';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ class CategoryController extends FormController
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* @param MVCFactoryInterface|null $factory The factory.
* @param CMSApplication|null $app The Application for the dispatcher
* @param Input|null $input Input
* @param array $config An optional associative array of configuration settings.
* @param ?MVCFactoryInterface $factory The factory.
* @param ?CMSApplication $app The Application for the dispatcher
* @param ?Input $input Input
*
* @since 1.6
* @throws \Exception
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, CMSApplication $app = null, Input $input = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null)
{
parent::__construct($config, $factory, $app, $input);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ class DisplayController extends BaseController
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* @param MVCFactoryInterface|null $factory The factory.
* @param CMSApplication|null $app The Application for the dispatcher
* @param Input|null $input Input
* @param array $config An optional associative array of configuration settings.
* @param ?MVCFactoryInterface $factory The factory.
* @param ?CMSApplication $app The Application for the dispatcher
* @param ?Input $input Input
*
* @since 3.0
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null, $app = null, $input = null)
{
parent::__construct($config, $factory, $app, $input);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ class CategoriesModel extends ListModel
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* @param MVCFactoryInterface|null $factory The factory.
* @param array $config An optional associative array of configuration settings.
* @param ?MVCFactoryInterface $factory The factory.
*
* @since 1.6
*/
public function __construct($config = [], MVCFactoryInterface $factory = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null)
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ class CategoryModel extends AdminModel
/**
* Override parent constructor.
*
* @param array $config An optional associative array of configuration settings.
* @param MVCFactoryInterface|null $factory The factory.
* @param array $config An optional associative array of configuration settings.
* @param ?MVCFactoryInterface $factory The factory.
*
* @see \Joomla\CMS\MVC\Model\BaseDatabaseModel
* @since 3.2
*/
public function __construct($config = [], MVCFactoryInterface $factory = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null)
{
$extension = Factory::getApplication()->getInput()->get('extension', 'com_content');
$this->typeAlias = $extension . '.category';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ class CheckinModel extends ListModel
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* @param MVCFactoryInterface $factory The factory.
* @param array $config An optional associative array of configuration settings.
* @param ?MVCFactoryInterface $factory The factory.
*
* @see \Joomla\CMS\MVC\Model\BaseDatabaseModel
* @since 3.2
*/
public function __construct($config = [], MVCFactoryInterface $factory = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null)
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ class ApplicationController extends BaseController
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
* @param MVCFactoryInterface $factory The factory.
* @param CMSApplication $app The Application for the dispatcher
* @param Input $input Input
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
* @param ?MVCFactoryInterface $factory The factory.
* @param ?CMSApplication $app The Application for the dispatcher
* @param ?Input $input Input
*
* @since 3.0
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null, $app = null, $input = null)
{
parent::__construct($config, $factory, $app, $input);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ class ComponentController extends FormController
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
* @param MVCFactoryInterface $factory The factory.
* @param CMSApplication $app The Application for the dispatcher
* @param Input $input Input
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
* @param ?MVCFactoryInterface $factory The factory.
* @param ?CMSApplication $app The Application for the dispatcher
* @param ?Input $input Input
*
* @since 3.0
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null, $app = null, $input = null)
{
parent::__construct($config, $factory, $app, $input);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ class ContactsController extends AdminController
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
* @param MVCFactoryInterface $factory The factory.
* @param CMSApplication $app The Application for the dispatcher
* @param Input $input Input
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
* @param ?MVCFactoryInterface $factory The factory.
* @param ?CMSApplication $app The Application for the dispatcher
* @param ?Input $input Input
*
* @since 3.0
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null, $app = null, $input = null)
{
parent::__construct($config, $factory, $app, $input);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,27 +134,27 @@ public function getContexts(): array
/**
* Returns the table for the count items functions for the given section.
*
* @param string $section The section
* @param ?string $section The section
*
* @return string|null
*
* @since 4.0.0
*/
protected function getTableNameForSection(string $section = null)
protected function getTableNameForSection(?string $section = null)
{
return ($section === 'category' ? 'categories' : 'contact_details');
}

/**
* Returns the state column for the count items functions for the given section.
*
* @param string $section The section
* @param ?string $section The section
*
* @return string|null
*
* @since 4.0.0
*/
protected function getStateColumnForSection(string $section = null)
protected function getStateColumnForSection(?string $section = null)
{
return 'published';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class ContactTable extends Table implements VersionableTableInterface, TaggableT
*
* @since 1.0
*/
public function __construct(DatabaseDriver $db, DispatcherInterface $dispatcher = null)
public function __construct(DatabaseDriver $db, ?DispatcherInterface $dispatcher = null)
{
$this->typeAlias = 'com_contact.contact';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ class ArticleController extends FormController
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
* @param MVCFactoryInterface $factory The factory.
* @param CMSApplication $app The Application for the dispatcher
* @param Input $input Input
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
* @param ?MVCFactoryInterface $factory The factory.
* @param ?CMSApplication $app The Application for the dispatcher
* @param ?Input $input Input
*
* @since 3.0
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null, $app = null, $input = null)
{
parent::__construct($config, $factory, $app, $input);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ class ArticlesController extends AdminController
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
* @param MVCFactoryInterface $factory The factory.
* @param CMSApplication $app The Application for the dispatcher
* @param Input $input Input
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
* @param ?MVCFactoryInterface $factory The factory.
* @param ?CMSApplication $app The Application for the dispatcher
* @param ?Input $input Input
*
* @since 3.0
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null, $app = null, $input = null)
{
parent::__construct($config, $factory, $app, $input);

Expand Down
Loading