Problem/Motivation
We can use the convert coalesce operator instead of the ternary operator is there is NULL or empty.
FILE: /var/www/html/web/modules/custom/ief_table_view_mode/ief_table_view_mode.module
-------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------
100 | ERROR | [x] Use null coalesce operator instead of ternary operator.
-------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------
FILE: /var/www/html/web/modules/custom/ief_table_view_mode/src/Form/EntityInlineTableViewModeForm.php
-----------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------
62 | ERROR | [x] Use null coalesce operator instead of ternary operator.
-----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------
Steps to reproduce
Run the below command,
phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml ief_table_view_mode
Proposed resolution
Before:
return isset($this->handlers['route_provider'][$entity_type_id]) ? $this->handlers['route_provider'][$entity_type_id] : [];
After:
return $this->handlers['route_provider'][$entity_type_id] ?? [];
Remaining tasks
User interface changes
API changes
Data model changes