Skip to content

Commit c623121

Browse files
authored
Merge pull request #3803 from paulbalandan/elseif
Use elseif instead of else if
2 parents 725b008 + b896fd4 commit c623121

10 files changed

Lines changed: 21 additions & 20 deletions

File tree

system/CodeIgniter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ protected function display404errors(PageNotFoundException $e)
991991
{
992992
echo $override($e->getMessage());
993993
}
994-
else if (is_array($override))
994+
elseif (is_array($override))
995995
{
996996
$this->benchmark->start('controller');
997997
$this->benchmark->start('controller_constructor');

system/Database/Query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ protected function matchSimpleBinds(string $sql, array $binds, int $bindCount, i
480480
}
481481
}
482482
// Number of binds must match bindMarkers in the string.
483-
else if (($c = preg_match_all('/' . preg_quote($this->bindMarker, '/') . '/i', $sql, $matches, PREG_OFFSET_CAPTURE)) !== $bindCount)
483+
elseif (($c = preg_match_all('/' . preg_quote($this->bindMarker, '/') . '/i', $sql, $matches, PREG_OFFSET_CAPTURE)) !== $bindCount)
484484
{
485485
return $sql;
486486
}

system/Entity.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public function __get(string $key)
330330

331331
// Otherwise return the protected property
332332
// if it exists.
333-
else if (array_key_exists($key, $this->attributes))
333+
elseif (array_key_exists($key, $this->attributes))
334334
{
335335
$result = $this->attributes[$key];
336336
}
@@ -341,7 +341,7 @@ public function __get(string $key)
341341
$result = $this->mutateDate($result);
342342
}
343343
// Or cast it as something?
344-
else if ($this->_cast && ! empty($this->casts[$key]))
344+
elseif ($this->_cast && ! empty($this->casts[$key]))
345345
{
346346
$result = $this->castAs($result, $this->casts[$key]);
347347
}

system/HTTP/CURLRequest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ protected function applyMethod(string $method, array $curlOptions): array
557557
$this->setHeader('Content-Length', '0');
558558
}
559559
}
560-
else if ($method === 'HEAD')
560+
elseif ($method === 'HEAD')
561561
{
562562
$curlOptions[CURLOPT_NOBODY] = 1;
563563
}
@@ -603,7 +603,7 @@ protected function setResponseHeaders(array $headers = [])
603603

604604
$this->response->setHeader($title, $value);
605605
}
606-
else if (strpos($header, 'HTTP') === 0)
606+
elseif (strpos($header, 'HTTP') === 0)
607607
{
608608
preg_match('#^HTTP\/([12](?:\.[01])?) ([0-9]+) (.+)#', $header, $matches);
609609

@@ -681,7 +681,7 @@ protected function setCURLOptions(array $curlOptions = [], array $config = [])
681681
$curlOptions[CURLOPT_CAINFO] = $file;
682682
$curlOptions[CURLOPT_SSL_VERIFYPEER] = 1;
683683
}
684-
else if (is_bool($config['verify']))
684+
elseif (is_bool($config['verify']))
685685
{
686686
$curlOptions[CURLOPT_SSL_VERIFYPEER] = $config['verify'];
687687
}
@@ -789,7 +789,7 @@ protected function setCURLOptions(array $curlOptions = [], array $config = [])
789789
{
790790
$curlOptions[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0;
791791
}
792-
else if ($config['version'] === 1.1)
792+
elseif ($config['version'] === 1.1)
793793
{
794794
$curlOptions[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1;
795795
}

system/HTTP/Header.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,12 @@ public function getValueLine(): string
221221
{
222222
$options[] = $key . '=' . $value;
223223
}
224-
else if (is_array($value))
224+
elseif (is_array($value))
225225
{
226226
$key = key($value);
227227
$options[] = $key . '=' . $value[$key];
228228
}
229-
else if (is_numeric($key))
229+
elseif (is_numeric($key))
230230
{
231231
$options[] = $value;
232232
}

system/HTTP/URI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ public function removeDotSegments(string $path): string
12141214
{
12151215
array_pop($output);
12161216
}
1217-
else if ($segment !== '.' && $segment !== '')
1217+
elseif ($segment !== '.' && $segment !== '')
12181218
{
12191219
array_push($output, $segment);
12201220
}

system/Helpers/number_helper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,17 +157,17 @@ function number_to_amount($num, int $precision = 0, string $locale = null)
157157
$suffix = lang('Number.trillion', [], $generalLocale);
158158
$num = round(($num / 1000000000000), $precision);
159159
}
160-
else if ($num > 1000000000)
160+
elseif ($num > 1000000000)
161161
{
162162
$suffix = lang('Number.billion', [], $generalLocale);
163163
$num = round(($num / 1000000000), $precision);
164164
}
165-
else if ($num > 1000000)
165+
elseif ($num > 1000000)
166166
{
167167
$suffix = lang('Number.million', [], $generalLocale);
168168
$num = round(($num / 1000000), $precision);
169169
}
170-
else if ($num > 1000)
170+
elseif ($num > 1000)
171171
{
172172
$suffix = lang('Number.thousand', [], $generalLocale);
173173
$num = round(($num / 1000), $precision);

system/Router/RouteCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,7 @@ protected function create(string $verb, string $from, $to, array $options = null
14041404
}
14051405

14061406
// Limiting to subdomains?
1407-
else if (! empty($options['subdomain']))
1407+
elseif (! empty($options['subdomain']))
14081408
{
14091409
// If we don't match the current subdomain, then
14101410
// we don't need to add the route.

system/Test/DOMParser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,14 @@ protected function doXPath(string $search = null, string $element, array $paths
267267
: "//body//{$selector['tag']}[@id=\"{$selector['id']}\"]";
268268
}
269269
// By Class
270-
else if (! empty($selector['class']))
270+
elseif (! empty($selector['class']))
271271
{
272272
$path = empty($selector['tag'])
273273
? "//*[@class=\"{$selector['class']}\"]"
274274
: "//body//{$selector['tag']}[@class=\"{$selector['class']}\"]";
275275
}
276276
// By tag only
277-
else if (! empty($selector['tag']))
277+
elseif (! empty($selector['tag']))
278278
{
279279
$path = "//body//{$selector['tag']}";
280280
}

system/View/Parser.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ protected function parsePair(string $variable, array $data, string $template): a
385385
$row = $row->toArray();
386386
}
387387
// Otherwise, cast as an array and it will grab public properties.
388-
else if (is_object($row))
388+
elseif (is_object($row))
389389
{
390390
$row = (array)$row;
391391
}
@@ -409,11 +409,12 @@ protected function parsePair(string $variable, array $data, string $template): a
409409

410410
continue;
411411
}
412+
412413
if (is_object($val))
413414
{
414415
$val = 'Class: ' . get_class($val);
415416
}
416-
else if (is_resource($val))
417+
elseif (is_resource($val))
417418
{
418419
$val = 'Resource';
419420
}
@@ -858,7 +859,7 @@ protected function objectToArray($value)
858859
$value = $value->toArray();
859860
}
860861
// Otherwise, cast as an array and it will grab public properties.
861-
else if (is_object($value))
862+
elseif (is_object($value))
862863
{
863864
$value = (array)$value;
864865
}

0 commit comments

Comments
 (0)