Merge pull request #13935 from carusogabriel/simplify-returns
Simplify returns
This commit is contained in:
commit
91ee20e757
@ -233,11 +233,7 @@ class Core
|
||||
return is_numeric($var);
|
||||
}
|
||||
|
||||
if (gettype($var) === $type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return gettype($var) === $type;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -807,11 +803,8 @@ class Core
|
||||
/* Following are doubtful ones. */
|
||||
'mysqldatabaseadministration.blogspot.com',
|
||||
);
|
||||
if (in_array($domain, $domainWhiteList)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return in_array($domain, $domainWhiteList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -144,10 +144,7 @@ class DatabaseInterface
|
||||
*/
|
||||
public static function checkDbExtension($extension = 'mysql')
|
||||
{
|
||||
if (function_exists($extension . '_connect')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return function_exists($extension . '_connect');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -90,12 +90,8 @@ class ImportAjax
|
||||
*/
|
||||
public static function progressCheck()
|
||||
{
|
||||
if (! function_exists("uploadprogress_get_info")
|
||||
|| ! function_exists('getallheaders')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return function_exists("uploadprogress_get_info")
|
||||
|| function_exists('getallheaders');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,10 +102,7 @@ class ImportAjax
|
||||
*/
|
||||
public static function sessionCheck()
|
||||
{
|
||||
if (! ini_get('session.upload_progress.enabled')) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return ini_get('session.upload_progress.enabled');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -436,11 +436,7 @@ class GisPolygon extends GisGeometry
|
||||
{
|
||||
// If area is negative then it's in clockwise orientation,
|
||||
// i.e. it's an outer ring
|
||||
if (GisPolygon::area($ring) < 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return GisPolygon::area($ring) < 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -497,11 +493,7 @@ class GisPolygon extends GisGeometry
|
||||
$p1 = $p2;
|
||||
}
|
||||
|
||||
if ($counter % 2 == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return $counter % 2 != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1687,10 +1687,6 @@ class Import
|
||||
|
||||
$result = $GLOBALS['dbi']->tryQuery($check_query);
|
||||
|
||||
if ($GLOBALS['dbi']->numRows($result) == 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return $GLOBALS['dbi']->numRows($result) == 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,11 +87,7 @@ class IpAllowDeny
|
||||
} // end if
|
||||
} // end for
|
||||
|
||||
if (($maskl & $rangel) == ($maskl & $ipl)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return ($maskl & $rangel) == ($maskl & $ipl);
|
||||
}
|
||||
|
||||
// range based
|
||||
|
||||
@ -664,13 +664,8 @@ class Node
|
||||
*/
|
||||
private function _isHideDb($db)
|
||||
{
|
||||
if (!empty($GLOBALS['cfg']['Server']['hide_db'])
|
||||
&& preg_match('/' . $GLOBALS['cfg']['Server']['hide_db'] . '/', $db)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return !empty($GLOBALS['cfg']['Server']['hide_db'])
|
||||
&& preg_match('/' . $GLOBALS['cfg']['Server']['hide_db'] . '/', $db);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -181,11 +181,7 @@ class AuthenticationHttp extends AuthenticationPlugin
|
||||
}
|
||||
|
||||
// Returns whether we get authentication settings or not
|
||||
if (empty($this->user)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return !empty($this->user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -268,11 +268,8 @@ class ExportHtmlword extends ExportPlugin
|
||||
}
|
||||
} // end while
|
||||
$GLOBALS['dbi']->freeResult($result);
|
||||
if (!Export::outputHandler('</table>')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return Export::outputHandler('</table>');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -148,17 +148,13 @@ class ExportOds extends ExportPlugin
|
||||
$GLOBALS['ods_buffer'] .= '</office:spreadsheet>'
|
||||
. '</office:body>'
|
||||
. '</office:document-content>';
|
||||
if (!Export::outputHandler(
|
||||
|
||||
return Export::outputHandler(
|
||||
OpenDocument::create(
|
||||
'application/vnd.oasis.opendocument.spreadsheet',
|
||||
$GLOBALS['ods_buffer']
|
||||
)
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -151,11 +151,7 @@ class ExportPdf extends ExportPlugin
|
||||
$pdf = $this->_getPdf();
|
||||
|
||||
// instead of $pdf->Output():
|
||||
if (!Export::outputHandler($pdf->getPDFData())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return Export::outputHandler($pdf->getPDFData());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -2189,11 +2189,7 @@ class ExportSql extends ExportPlugin
|
||||
. $this->_exportComment()
|
||||
. $this->_possibleCRLF();
|
||||
|
||||
if (!Export::outputHandler($head)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return Export::outputHandler($head);
|
||||
}
|
||||
|
||||
$result = $GLOBALS['dbi']->tryQuery(
|
||||
|
||||
@ -75,12 +75,9 @@ class Pdf extends PdfLib
|
||||
|
||||
return true;
|
||||
}
|
||||
if ($current_page != $this->page) {
|
||||
// account for columns mode
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
// account for columns mode
|
||||
return $current_page != $this->page;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -318,11 +318,7 @@ class ThemeManager
|
||||
*/
|
||||
public function checkTheme($theme)
|
||||
{
|
||||
if (! array_key_exists($theme, $this->themes)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return array_key_exists($theme, $this->themes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -78,11 +78,8 @@ class Tracker
|
||||
}
|
||||
|
||||
$pma_table = self::_getTrackingTable();
|
||||
if (isset($pma_table)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return isset($pma_table);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -310,11 +310,7 @@ abstract class TestBase extends \PHPUnit_Extensions_Selenium2TestCase
|
||||
*/
|
||||
public function isSuccessLogin()
|
||||
{
|
||||
if ($this->isElementPresent("byXPath", "//*[@id=\"serverinfo\"]")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return $this->isElementPresent("byXPath", "//*[@id=\"serverinfo\"]");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -324,11 +320,7 @@ abstract class TestBase extends \PHPUnit_Extensions_Selenium2TestCase
|
||||
*/
|
||||
public function isUnsuccessLogin()
|
||||
{
|
||||
if ($this->isElementPresent("byCssSelector", "div.error")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return $this->isElementPresent("byCssSelector", "div.error");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -587,16 +579,10 @@ abstract class TestBase extends \PHPUnit_Extensions_Selenium2TestCase
|
||||
$this->waitForElement('byCssSelector', 'li.submenuhover > a');
|
||||
|
||||
$this->waitUntil(function () {
|
||||
if (
|
||||
$this->isElementPresent(
|
||||
'byCssSelector',
|
||||
'li.submenuhover.submenu.shown'
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return $this->isElementPresent(
|
||||
'byCssSelector',
|
||||
'li.submenuhover.submenu.shown'
|
||||
);
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user