Skip to content

Commit

Permalink
Remove implicit nullable types
Browse files Browse the repository at this point in the history
  • Loading branch information
laoneo committed Aug 5, 2024
1 parent 1b5560a commit 50f7fe2
Show file tree
Hide file tree
Showing 245 changed files with 293 additions and 291 deletions.
20 changes: 11 additions & 9 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,25 @@
->setRules(
[
// Basic ruleset is PSR 12
'@PSR12' => true,
'@PSR12' => true,
// Short array syntax
'array_syntax' => ['syntax' => 'short'],
'array_syntax' => ['syntax' => 'short'],
// Lists should not have a trailing comma like list($foo, $bar,) = ...
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_list_call' => 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'],
// Convert (Foo $bar = null) into (?Foo $bar = null)
'nullable_type_declaration_for_default_null_value' => true
]
)
->setFinder($finder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ActionlogsController extends AdminController
*
* @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 @@ -39,7 +39,7 @@ class AssociationsModel extends ListModel
* @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 @@ -50,7 +50,7 @@ class CategoryController extends FormController
* @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 @@ -54,7 +54,7 @@ class DisplayController extends BaseController
*
* @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 @@ -47,7 +47,7 @@ class CategoriesModel extends ListModel
*
* @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 @@ -87,7 +87,7 @@ class CategoryModel extends AdminModel
* @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 @@ -41,7 +41,7 @@ class CheckinModel extends ListModel
* @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 @@ -42,7 +42,7 @@ class ApplicationController extends BaseController
*
* @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 @@ -41,7 +41,7 @@ class ComponentController extends FormController
*
* @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 @@ -41,7 +41,7 @@ class ContactsController 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 @@ -134,7 +134,7 @@ public function getContexts(): array
*
* @since 4.0.0
*/
protected function getTableNameForSection(string $section = null)
protected function getTableNameForSection(?string $section = null)
{
return ($section === 'category' ? 'categories' : 'contact_details');
}
Expand All @@ -148,7 +148,7 @@ protected function getTableNameForSection(string $section = 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 @@ -44,7 +44,7 @@ class ArticleController extends FormController
*
* @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 @@ -42,7 +42,7 @@ class ArticlesController 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 @@ -223,7 +223,7 @@ public function getCategoryWorkflowContext(?string $section = null): string
*
* @since 4.0.0
*/
protected function getTableNameForSection(string $section = null)
protected function getTableNameForSection(?string $section = null)
{
return '#__content';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class ArticleModel extends AdminModel implements WorkflowModelInterface
* @since 1.6
* @throws \Exception
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, FormFactoryInterface $formFactory = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null, ?FormFactoryInterface $formFactory = null)
{
$config['events_map'] = $config['events_map'] ?? [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class HistoryModel extends ListModel
* @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 @@ -60,7 +60,7 @@ class FieldController extends FormController
*
* @since 3.7.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 @@ -58,7 +58,7 @@ class GroupController extends FormController
*
* @since 3.7.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 @@ -36,7 +36,7 @@ class FieldsComponent extends MVCComponent implements CategoryServiceInterface
*
* @since 4.0.0
*/
protected function getTableNameForSection(string $section = null)
protected function getTableNameForSection(?string $section = null)
{
return 'fields';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static function getFields(
$context,
$item = null,
$prepareValue = false,
array $valuesToOverride = null,
?array $valuesToOverride = null,
bool $includeSubformFields = false
) {
if (self::$fieldsCache === null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class FieldModel extends AdminModel
* @since 3.7.0
* @throws \Exception
*/
public function __construct($config = [], MVCFactoryInterface $factory = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null)
{
parent::__construct($config, $factory);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class FieldsModel extends ListModel
* @since 3.7.0
* @throws \Exception
*/
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 @@ -45,7 +45,7 @@ class GroupsModel extends ListModel
* @since 3.7.0
* @throws \Exception
*/
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 @@ -259,7 +259,7 @@ protected function _getAssetTitle()
*
* @since 3.7.0
*/
protected function _getAssetParentId(Table $table = null, $id = null)
protected function _getAssetParentId(?Table $table = null, $id = null)
{
$contextArray = explode('.', $this->context);
$component = $contextArray[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ protected function _getAssetTitle()
*
* @since 3.7.0
*/
protected function _getAssetParentId(Table $table = null, $id = null)
protected function _getAssetParentId(?Table $table = null, $id = null)
{
$component = explode('.', $this->context);
$db = $this->getDbo();
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_finder/src/Indexer/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ public static function getContentExtras(Result $item)
*
* @since 2.5
*/
public static function prepareContent($text, $params = null, Result $item = null)
public static function prepareContent($text, $params = null, ?Result $item = null)
{
static $loaded;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class Indexer
*
* @since 3.8.0
*/
public function __construct(DatabaseInterface $db = null)
public function __construct(?DatabaseInterface $db = null)
{
if ($db === null) {
@trigger_error(sprintf('Database will be mandatory in 5.0.'), E_USER_DEPRECATED);
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_finder/src/Indexer/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class Query
* @since 2.5
* @throws \Exception on database error.
*/
public function __construct($options, DatabaseInterface $db = null)
public function __construct($options, ?DatabaseInterface $db = null)
{
if ($db === null) {
@trigger_error(sprintf('Database will be mandatory in 5.0.'), E_USER_DEPRECATED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class FiltersModel extends ListModel
* @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 @@ -61,7 +61,7 @@ class IndexModel extends ListModel
* @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 @@ -38,7 +38,7 @@ class MapsModel extends ListModel
* @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 @@ -34,7 +34,7 @@ class SearchesModel extends ListModel
* @see \Joomla\CMS\MVC\Model\BaseDatabaseModel
* @since 4.0.0
*/
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 @@ -41,7 +41,7 @@ class ManageController extends BaseController
*
* @since 1.6
*/
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 @@ -49,7 +49,7 @@ class UpdatesitesController extends AdminController
*
* @since 1.6
*/
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 @@ -69,7 +69,7 @@ class DatabaseModel extends InstallerModel
* @see ListModel
* @since 4.0.0
*/
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 @@ -39,7 +39,7 @@ class DiscoverModel extends InstallerModel
* @see \Joomla\CMS\MVC\Model\ListModel
* @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 @@ -37,7 +37,7 @@ class InstallerModel extends ListModel
* @see \Joomla\CMS\MVC\Model\ListModel
* @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
Loading

0 comments on commit 50f7fe2

Please sign in to comment.