Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public function __construct($name, array $arguments = [])
if (!\array_key_exists('extensionName', $arguments) || !\array_key_exists('section', $arguments)) {
$parts = explode('.', $arguments['extension']);

$arguments['extensionName'] = $arguments['extensionName'] ?? $parts[0];
$arguments['section'] = $arguments['section'] ?? $parts[1];
$arguments['extensionName'] ??= $parts[0];
$arguments['section'] ??= $parts[1];
Comment thread
joomdonation marked this conversation as resolved.
Outdated
}

if (!isset($arguments['pks']) || !\is_array($arguments['pks'])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class ArticleModel extends AdminModel implements WorkflowModelInterface
*/
public function __construct($config = [], ?MVCFactoryInterface $factory = null, ?FormFactoryInterface $formFactory = null)
{
$config['events_map'] = $config['events_map'] ?? [];
$config['events_map'] ??= [];

$config['events_map'] = array_merge(
['featured' => 'content'],
Expand All @@ -117,9 +117,9 @@ public function __construct($config = [], ?MVCFactoryInterface $factory = null,

// Set the featured status change events
$this->event_before_change_featured = $config['event_before_change_featured'] ?? $this->event_before_change_featured;
$this->event_before_change_featured = $this->event_before_change_featured ?? 'onContentBeforeChangeFeatured';
$this->event_before_change_featured ??= 'onContentBeforeChangeFeatured';
$this->event_after_change_featured = $config['event_after_change_featured'] ?? $this->event_after_change_featured;
$this->event_after_change_featured = $this->event_after_change_featured ?? 'onContentAfterChangeFeatured';
$this->event_after_change_featured ??= 'onContentAfterChangeFeatured';

$this->setUpWorkflow('com_content.article');
}
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_menus/src/Helper/MenusHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public static function getMenuItems($menutype, $enabledOnly = false, $exclude =
if ($menuitem->link = \in_array($menuitem->type, ['separator', 'heading', 'container']) ? '#' : trim($menuitem->link)) {
$menuitem->submenu = [];
$menuitem->class = $menuitem->img ?? '';
$menuitem->scope = $menuitem->scope ?? null;
$menuitem->scope ??= null;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code style, and the line above is basically exact the same but is not converted?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed that code style before, but our PHPCS does not allow it passed, so I had to revert the fix back. We have strange behavior with PHPCS for ??= operator here.

For the line above, if you are talking about the line $menuitem->class = $menuitem->img ?? '';, then it is not the same.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, then we can't merge this, until cs checker is fixed. (and yes you are right above is not the same)

$menuitem->target = $menuitem->browserNav ? '_blank' : '';
}

Expand Down Expand Up @@ -750,7 +750,7 @@ public static function preprocess($item)

if ($item->link = \in_array($item->type, ['separator', 'heading', 'container']) ? '#' : trim($item->link)) {
$item->class = $item->img ?? '';
$item->scope = $item->scope ?? null;
$item->scope ??= null;
$item->target = $item->browserNav ? '_blank' : '';
}
}
Expand Down
8 changes: 4 additions & 4 deletions administrator/components/com_menus/src/Model/ItemModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -579,10 +579,10 @@ protected function loadFormData()
if (empty($data['id'])) {
// Get selected fields
$filters = Factory::getApplication()->getUserState('com_menus.items.filter');
$data['parent_id'] = $data['parent_id'] ?? ($filters['parent_id'] ?? null);
$data['published'] = $data['published'] ?? ($filters['published'] ?? null);
$data['language'] = $data['language'] ?? ($filters['language'] ?? null);
$data['access'] = $data['access'] ?? ($filters['access'] ?? Factory::getApplication()->get('access'));
$data['parent_id'] ??= $filters['parent_id'] ?? null;
$data['published'] ??= $filters['published'] ?? null;
$data['language'] ??= $filters['language'] ?? null;
$data['access'] ??= $filters['access'] ?? Factory::getApplication()->get('access');
}

if (isset($data['menutype']) && !$this->getState('item.menutypeid')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public function display($tpl = null)
}
}

$vars['layout'] = $vars['layout'] ?? 'default';
$vars['layout'] ??= 'default';

// Attempt to load the layout xml file.
// If Alternative Menu Item, get template folder for layout file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function nextExec(bool $string = true, bool $basisNow = false)
private function dateTimeToSql(\DateTime $dateTime): string
{
static $db;
$db = $db ?? Factory::getContainer()->get(DatabaseInterface::class);
$db ??= Factory::getContainer()->get(DatabaseInterface::class);

return $dateTime->format($db->getDateFormat());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class TaskModel extends AdminModel
*/
public function __construct($config = [], ?MVCFactoryInterface $factory = null, ?FormFactoryInterface $formFactory = null)
{
$config['events_map'] = $config['events_map'] ?? [];
$config['events_map'] ??= [];

$config['events_map'] = array_merge(
[
Expand Down Expand Up @@ -631,7 +631,7 @@ public function save($data): bool

// If no params, we set as empty array.
// ? Is this the right place to do this
$data['params'] = $data['params'] ?? [];
$data['params'] ??= [];

// Parent method takes care of saving to the table
return parent::save($data);
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_scheduler/src/Task/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function run(): bool
}

$this->snapshot['status'] = Status::RUNNING;
$this->snapshot['taskStart'] = $this->snapshot['taskStart'] ?? microtime(true);
$this->snapshot['taskStart'] ??= microtime(true);
$this->snapshot['netDuration'] = 0;

/** @var ExecuteTaskEvent $event */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function disable($cachable = false, $urlparams = []): void
$user = ($userId === null)
? $this->app->getIdentity()
: $this->getUserFactory()->loadUserById($userId);
$user = $user ?? $this->getUserFactory()->loadUserById(0);
$user ??= $this->getUserFactory()->loadUserById(0);

if (!MfaHelper::canDeleteMethod($user)) {
throw new \RuntimeException(Text::_('JERROR_ALERTNOAUTHOR'), 403);
Expand Down Expand Up @@ -127,7 +127,7 @@ public function display($cachable = false, $urlparams = []): void
$user = ($userId === null)
? $this->app->getIdentity()
: $this->getUserFactory()->loadUserById($userId);
$user = $user ?? $this->getUserFactory()->loadUserById(0);
$user ??= $this->getUserFactory()->loadUserById(0);

if (!MfaHelper::canShowConfigurationInterface($user)) {
throw new \RuntimeException(Text::_('JERROR_ALERTNOAUTHOR'), 403);
Expand Down Expand Up @@ -171,7 +171,7 @@ public function doNotShowThisAgain($cachable = false, $urlparams = []): void
$user = ($userId === null)
? $this->app->getIdentity()
: $this->getUserFactory()->loadUserById($userId);
$user = $user ?? $this->getUserFactory()->loadUserById(0);
$user ??= $this->getUserFactory()->loadUserById(0);

if (!MfaHelper::canAddEditMethod($user)) {
throw new \RuntimeException(Text::_('JERROR_ALERTNOAUTHOR'), 403);
Expand Down
2 changes: 1 addition & 1 deletion components/com_contact/src/Helper/AssociationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ abstract class AssociationHelper extends CategoryAssociationHelper
public static function getAssociations($id = 0, $view = null)
{
$jinput = Factory::getApplication()->getInput();
$view = $view ?? $jinput->get('view');
$view ??= $jinput->get('view');
$id = empty($id) ? $jinput->getInt('id') : $id;

if ($view === 'contact') {
Expand Down
2 changes: 1 addition & 1 deletion components/com_content/src/Helper/AssociationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ abstract class AssociationHelper extends CategoryAssociationHelper
public static function getAssociations($id = 0, $view = null, $layout = null)
{
$jinput = Factory::getApplication()->getInput();
$view = $view ?? $jinput->get('view');
$view ??= $jinput->get('view');
$component = $jinput->getCmd('option');
$id = empty($id) ? $jinput->getInt('id') : $id;

Expand Down
2 changes: 1 addition & 1 deletion components/com_newsfeeds/src/Helper/AssociationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ abstract class AssociationHelper extends CategoryAssociationHelper
public static function getAssociations($id = 0, $view = null)
{
$jinput = Factory::getApplication()->getInput();
$view = $view ?? $jinput->get('view');
$view ??= $jinput->get('view');
$id = empty($id) ? $jinput->getInt('id') : $id;

if ($view === 'newsfeed') {
Expand Down