Commit f730e579 authored by alexpott's avatar alexpott

Issue #2572695 by marvin_B8, attiks, pfrenssen, xjm: Fix...

Issue #2572695 by marvin_B8, attiks, pfrenssen, xjm: Fix 'Drupal.ControlStructures.ElseIf' coding standard
parent d73dcaf7
......@@ -445,22 +445,22 @@ function theme_settings_convert_to_config(array $theme_settings, Config $config)
if ($key == 'default_logo') {
$config->set('logo.use_default', $value);
}
else if ($key == 'logo_path') {
elseif ($key == 'logo_path') {
$config->set('logo.path', $value);
}
else if ($key == 'default_favicon') {
elseif ($key == 'default_favicon') {
$config->set('favicon.use_default', $value);
}
else if ($key == 'favicon_path') {
elseif ($key == 'favicon_path') {
$config->set('favicon.path', $value);
}
else if ($key == 'favicon_mimetype') {
elseif ($key == 'favicon_mimetype') {
$config->set('favicon.mimetype', $value);
}
else if (substr($key, 0, 7) == 'toggle_') {
elseif (substr($key, 0, 7) == 'toggle_') {
$config->set('features.' . Unicode::substr($key, 7), $value);
}
else if (!in_array($key, array('theme', 'logo_upload'))) {
elseif (!in_array($key, array('theme', 'logo_upload'))) {
$config->set($key, $value);
}
}
......
......@@ -290,7 +290,7 @@ protected function castSafeStrings($data) {
if ($data instanceof MarkupInterface) {
$data = (string) $data;
}
else if (is_array($data)) {
elseif (is_array($data)) {
array_walk_recursive($data, function (&$value) {
if ($value instanceof MarkupInterface) {
$value = (string) $value;
......
......@@ -54,7 +54,7 @@ public function massageFormValues(array $values, array $form, FormStateInterface
if (isset($item['value']) && $item['value'] instanceof DrupalDateTime) {
$date = $item['value'];
}
else if (isset($item['value']['object']) && $item['value']['object'] instanceof DrupalDateTime) {
elseif (isset($item['value']['object']) && $item['value']['object'] instanceof DrupalDateTime) {
$date = $item['value']['object'];
}
else {
......
......@@ -99,10 +99,10 @@ public function process(ContainerBuilder $container) {
if ($param->getClass()) {
$interface = $param->getClass();
}
else if ($param->getName() === 'id') {
elseif ($param->getName() === 'id') {
$id_pos = $pos;
}
else if ($param->getName() === 'priority') {
elseif ($param->getName() === 'priority') {
$priority_pos = $pos;
}
else {
......
......@@ -52,7 +52,7 @@ public function getWrappers($filter = StreamWrapperInterface::ALL) {
if (isset($this->wrappers[$filter])) {
return $this->wrappers[$filter];
}
else if (isset($this->wrappers[StreamWrapperInterface::ALL])) {
elseif (isset($this->wrappers[StreamWrapperInterface::ALL])) {
$this->wrappers[$filter] = array();
foreach ($this->wrappers[StreamWrapperInterface::ALL] as $scheme => $info) {
// Bit-wise filter.
......
......@@ -45,7 +45,7 @@ protected function doLeaveNode(\Twig_Node $node, \Twig_Environment $env) {
);
}
// Change the 'escape' filter to our own 'drupal_escape' filter.
else if ($node instanceof \Twig_Node_Expression_Filter) {
elseif ($node instanceof \Twig_Node_Expression_Filter) {
$name = $node->getNode('filter')->getAttribute('value');
if ('escape' == $name || 'e' == $name) {
// Use our own escape filter that is SafeMarkup aware.
......
......@@ -338,19 +338,19 @@ public function getHtmlRestrictions() {
continue;
}
// The new filter allows less attributes (all -> list or none).
else if (!is_array($current_attributes) && $current_attributes == TRUE && ($new_attributes == FALSE || is_array($new_attributes))) {
elseif (!is_array($current_attributes) && $current_attributes == TRUE && ($new_attributes == FALSE || is_array($new_attributes))) {
$intersection[$tag] = $new_attributes;
}
// The new filter allows less attributes (list -> none).
else if (is_array($current_attributes) && $new_attributes == FALSE) {
elseif (is_array($current_attributes) && $new_attributes == FALSE) {
$intersection[$tag] = $new_attributes;
}
// The new filter allows more attributes; retain current.
else if (is_array($current_attributes) && $new_attributes == TRUE) {
elseif (is_array($current_attributes) && $new_attributes == TRUE) {
continue;
}
// The new filter allows the same attributes; retain current.
else if ($current_attributes == $new_attributes) {
elseif ($current_attributes == $new_attributes) {
continue;
}
// Both list an array of attribute values; do an intersection,
......
......@@ -102,7 +102,7 @@ function shortcut_set_switch_access($account = NULL) {
if (!isset($account)) {
return AccessResult::allowed()->cachePerPermissions();
}
else if ($user->id() == $account->id()) {
elseif ($user->id() == $account->id()) {
return AccessResult::allowed()->cachePerPermissions()->cachePerUser();
}
......
......@@ -2970,7 +2970,7 @@ protected function buildUrl($path, array $options = array()) {
}
// The URL generator service is not necessarily available yet; e.g., in
// interactive installer tests.
else if ($this->container->has('url_generator')) {
elseif ($this->container->has('url_generator')) {
$force_internal = isset($options['external']) && $options['external'] == FALSE;
if (!$force_internal && UrlHelper::isExternal($path)) {
return Url::fromUri($path, $options)->toString();
......
......@@ -256,7 +256,7 @@ protected function poFileContents($langcode) {
msgstr "I HAZ KONTEX."
EOF;
}
else if ($langcode === 'zz') {
elseif ($langcode === 'zz') {
return <<< EOF
msgid ""
msgstr ""
......
......@@ -99,18 +99,18 @@ function system_requirements($phase) {
if ($matches[1] < 2) {
$rewrite_error = TRUE;
}
else if ($matches[1] == 2) {
elseif ($matches[1] == 2) {
if (!isset($matches[2])) {
$rewrite_warning = TRUE;
}
else if ($matches[2] < 2) {
elseif ($matches[2] < 2) {
$rewrite_error = TRUE;
}
else if ($matches[2] == 2) {
elseif ($matches[2] == 2) {
if (!isset($matches[3])) {
$rewrite_warning = TRUE;
}
else if ($matches[3] < 16) {
elseif ($matches[3] < 16) {
$rewrite_error = TRUE;
}
}
......
......@@ -58,7 +58,7 @@ public function assertTourTips($tips = array()) {
$elements = \PHPUnit_Util_XML::cssSelect('#' . $tip['data-id'], TRUE, $this->content, TRUE);
$this->assertTrue(!empty($elements) && count($elements) === 1, format_string('Found corresponding page element for tour tip with id #%data-id', array('%data-id' => $tip['data-id'])));
}
else if (!empty($tip['data-class'])) {
elseif (!empty($tip['data-class'])) {
$elements = \PHPUnit_Util_XML::cssSelect('.' . $tip['data-class'], TRUE, $this->content, TRUE);
$this->assertFalse(empty($elements), format_string('Found corresponding page element for tour tip with class .%data-class', array('%data-class' => $tip['data-class'])));
}
......
......@@ -44,7 +44,7 @@ protected function checkAccess(EntityInterface $entity, $operation, AccountInter
return AccessResult::allowed()->cachePerPermissions()->cacheUntilEntityChanges($entity);
}
// Users can view own profiles at all times.
else if ($account->id() == $entity->id()) {
elseif ($account->id() == $entity->id()) {
return AccessResult::allowed()->cachePerUser();
}
break;
......
......@@ -250,7 +250,7 @@ public function unpackOptions(&$storage, $options, $definition = NULL, $all = TR
$this->unpackOptions($storage[$key], $value, isset($definition[$key]['contains']) ? $definition[$key]['contains'] : array(), $all, FALSE);
}
else if ($all || !empty($definition[$key])) {
elseif ($all || !empty($definition[$key])) {
$storage[$key] = $value;
}
}
......
......@@ -349,7 +349,7 @@ public function adminSummary() {
if (count($this->value) == 0) {
$values = $this->t('Unknown');
}
else if (count($this->value) == 1) {
elseif (count($this->value) == 1) {
// If any, use the 'single' short name of the operator instead.
if (isset($info[$this->operator]['short_single'])) {
$operator = $info[$this->operator]['short_single'];
......
......@@ -25,7 +25,6 @@
<exclude name="Drupal.Commenting.InlineComment"/>
<exclude name="Drupal.Commenting.PostStatementComment"/>
<exclude name="Drupal.ControlStructures.ControlSignature"/>
<exclude name="Drupal.ControlStructures.ElseIf"/>
<exclude name="Drupal.ControlStructures.InlineControlStructure"/>
<exclude name="Drupal.Files.EndFileNewline"/>
<exclude name="Drupal.Files.LineLength"/>
......
......@@ -168,10 +168,10 @@
if ($i < 12) {
$node->type = 'page';
}
else if ($i < 24) {
elseif ($i < 24) {
$node->type = 'story';
}
else if (module_exists('blog')) {
elseif (module_exists('blog')) {
$node->type = 'blog';
}
$node->sticky = 0;
......
......@@ -798,7 +798,7 @@ public function testAndOrCacheabilityPropagation(AccessResultInterface $first, $
if ($op === 'OR') {
$result = $first->orIf($second);
}
else if ($op === 'AND') {
elseif ($op === 'AND') {
$result = $first->andIf($second);
}
else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment