Skip to content

Commit d14df49

Browse files
TybazethePanz
authored andcommitted
Code Simplification from Merge Review
1 parent 296a268 commit d14df49

13 files changed

+17
-26
lines changed

lib/event/sfEvent.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function getReturnValue()
8383
/**
8484
* Sets the processed flag.
8585
*
86-
* @param boolean $processed The processed flag value
86+
* @param bool $processed The processed flag value
8787
*/
8888
public function setProcessed($processed)
8989
{

lib/exception/sfException.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ static protected function formatArrayAsHtml($values)
367367
static protected function fileExcerpt($file, $line)
368368
{
369369
// $file can be null for RuntimeException
370-
if ($file === null)
370+
if (null === $file)
371371
{
372372
return '';
373373
}

lib/i18n/sfDateFormat.class.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,7 @@ public function format($time, $pattern = 'F', $inputPattern = null, $charset = '
239239
}
240240
else
241241
{
242-
$function = $this->getFunctionName($pattern);
243-
if ($function != null)
242+
if (null !== $function = $this->getFunctionName($pattern))
244243
{
245244
$function = ucfirst($function);
246245
$fName = 'get'.$function;

lib/i18n/sfI18N.class.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -272,16 +272,8 @@ public function getTimestampForCulture($dateTime, $culture = null)
272272
list($hour, $minute) = $this->getTimeForCulture($dateTime, null === $culture ? $this->culture : $culture);
273273

274274
// mktime behavior change with php8
275-
// $hour become not nullable
276-
if (!$hour)
277-
{
278-
$hour = 0;
279-
}
280-
// Before 8.0, $minutes value to null, was casted as (int)0
281-
if (!$minute)
282-
{
283-
$minute = 0;
284-
}
275+
$hour = null !== $hour ? $hour : 0;
276+
$minute = null !== $minute ? $minute : 0;
285277
return null === $day ? null : mktime($hour, $minute, 0, $month, $day, $year);
286278
}
287279

lib/test/sfTestFunctionalBase.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ static public function handlePhpError($errno, $errstr, $errfile, $errline)
478478
/**
479479
* Exception handler for the current test browser instance.
480480
*
481-
* @param Throwable $exception The exception
481+
* @param Throwable|Exception $exception The exception
482482
*/
483483
function handleException($exception)
484484
{

lib/test/sfTesterResponse.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ public function initialize()
4949
}
5050
else
5151
{
52-
if ($this->response->getContent())
52+
if ($content = $this->response->getContent())
5353
{
54-
@$this->dom->loadHTML($this->response->getContent());
54+
@$this->dom->loadHTML($content);
5555
}
5656
}
5757
$this->domCssSelector = new sfDomCssSelector($this->dom);

lib/util/sfBrowserBase.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,9 @@ public function call($uri, $method = 'get', $parameters = array(), $changeStack
363363
}
364364
else
365365
{
366-
if ($response->getContent())
366+
if ($content = $response->getContent())
367367
{
368-
@$this->dom->loadHTML($response->getContent());
368+
@$this->dom->loadHTML($content);
369369
}
370370
}
371371
$this->domCssSelector = new sfDomCssSelector($this->dom);
@@ -911,7 +911,7 @@ public function doClickElement(DOMElement $item, $arguments = array(), $options
911911
}
912912
else
913913
{
914-
$queryString = (is_array($arguments)) ? http_build_query($arguments, null, '&') : '';
914+
$queryString = is_array($arguments) ? http_build_query($arguments, null, '&') : '';
915915
$sep = false === strpos($url, '?') ? '?' : '&';
916916

917917
return array($url.($queryString ? $sep.$queryString : ''), 'get', array());

lib/util/sfNamespacedParameterHolder.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ public function __serialize()
395395
}
396396

397397
/**
398-
* Unserializes a sfParameterHolder instance. for PHP 7.4
398+
* Unserializes a sfParameterHolder instance for PHP 7.4+
399399
*
400400
* @param array $data
401401
*/

lib/util/sfParameterHolder.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public function __serialize()
209209
}
210210

211211
/**
212-
* Unserializes a sfParameterHolder instance. for PHP 7.4
212+
* Unserializes a sfParameterHolder instance for PHP 7.4+
213213
*
214214
* @param array $data
215215
*/

lib/vendor/lime/lime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ public function handle_error($code, $message, $file, $line, $context = null)
589589
}
590590

591591
/**
592-
* @param Throwable $exception only available on php7
592+
* @param Throwable|Exception $exception
593593
* @return bool
594594
*/
595595
public function handle_exception($exception)

0 commit comments

Comments
 (0)