Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By podarok on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
master
Introduced in version:
master
Description:
When you have a condition that aims to change the value of a variable without additional logic, get rid of if else elseif code, just define early variable and change it via conditions
The issue has been caught here
Before:
if ($a = 'hello') {
$text = 'Welcome to site';
}
else {
$text = 'Register please';
}
After:
$text = 'Register please';
if ($a = 'hello') {
$text = 'Welcome to site';
}
Impacts:
Module developers