Skip to content

Commit

Permalink
Dev: application/core code inspection - incompatible return type (#717)
Browse files Browse the repository at this point in the history
  • Loading branch information
TonisOrmisson authored and LouisGac committed Jun 8, 2017
1 parent 2216695 commit 56d557b
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 32 deletions.
25 changes: 10 additions & 15 deletions application/core/LSHttpRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,11 @@ public function getUrlReferrer($sAlternativeUrl=null)
$baseRequestUri = str_replace(Yii::app()->getBaseUrl(), "", Yii::app()->request->requestUri);
$referrer = ($baseReferrer != $baseRequestUri)?$referrer:null;
//Use alternative url if the $referrer is still available in the checkLoopInNavigationStack
if( ($this->checkLoopInNavigationStack($referrer)) || (is_null($referrer)) )
{
if( ($this->checkLoopInNavigationStack($referrer)) || (is_null($referrer)) ) {
// Checks if the alternative url should be used
if(isset($sAlternativeUrl))
{
if(isset($sAlternativeUrl)) {
$referrer = $sAlternativeUrl;
}
else
{
} else {
return App()->createUrl('admin/index');
}
}
Expand Down Expand Up @@ -131,18 +127,17 @@ public function updateNavigationStack()
}

/**
* Method to check if an url is part of the stack
* Returns true, when an url is saved in the stack
* @param $referrerURL The URL that is checked against the stack
*/
* Method to check if an url is part of the stack
* Returns true, when an url is saved in the stack
* @param string $referrerURL The URL that is checked against the stack
* @return bool
*/
protected function checkLoopInNavigationStack($referrerURL)
{
$navStack = App()->session['LSNAVSTACK'];
foreach($navStack as $url)
{
foreach($navStack as $url) {
$refEqualsUrl = ($referrerURL == $url);
if ($refEqualsUrl)
{
if ($refEqualsUrl) {
return true;
}
}
Expand Down
4 changes: 3 additions & 1 deletion application/core/LSYii_Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ public function getApi()
*/
public function getPluginManager()
{
return $this->getComponent('pluginManager');
/** @var PluginManager $pluginManager */
$pluginManager =$this->getComponent('pluginManager');
return $pluginManager;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions application/core/LSYii_Validators.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ public function xssFilter($value)
foreach($aValues as $key=>$aValue){
if($aValue[2]=="STRING")
$sNewValue.=$bCountIsOk ? $aFilteredValues[$key][0]:$filter->purify($aValue[0]);// If EM is broken : can throw invalid $key
else
{
else {
$sExpression=trim($aValue[0], '{}');
$sNewValue.="{";
$aParsedExpressions=$oExpressionManager->Tokenize($sExpression,true);
Expand Down
2 changes: 1 addition & 1 deletion application/core/plugins/AuthLDAP/AuthLDAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function beforeActivate()
/**
* Create a LDAP user
*
* @return unknown_type
* @return null
*/
public function createNewUser()
{
Expand Down
2 changes: 1 addition & 1 deletion application/core/plugins/Authdb/Authdb.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function init()
/**
* Create a DB user
*
* @return unknown_type
* @return null
*/
public function createNewUser()
{
Expand Down
9 changes: 3 additions & 6 deletions application/core/plugins/QuickMenu/QuickMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,21 +447,18 @@ public function afterQuickMenuLoad()
* Save order after drag-n-drop sorting
*
* @param LSHttpRequest $request
* @return void
* @return string
*/
public function saveOrder(LSHttpRequest $request)
{
$buttons = $request->getParam('buttons');

$userId = Yii::app()->user->getId();

try
{
try {
$this->deleteOldSortings($userId);
$this->insertNewSortings($userId, $buttons);
}
catch(Exception $ex)
{
} catch(Exception $ex) {
// Any error is sent as JSON to client
return json_encode(array(
'result' => 'error',
Expand Down
6 changes: 3 additions & 3 deletions application/helpers/common_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2514,9 +2514,9 @@ function buildLabelSetCheckSumArray()

/**
* Returns a flat array with all question attributes for the question only (and the qid we gave it)!
* @depecated : use QuestionAttribute::model()->getQuestionAttributes($iQID); directly
* @param $iQID The question ID
* @return array$bOrderByNative=>value, attribute=>value} or false if the question ID does not exist (anymore)
* @deprecated : use QuestionAttribute::model()->getQuestionAttributes($iQID); directly
* @param integer $iQID The question ID
* @return array $bOrderByNative=>value, attribute=>value} or false if the question ID does not exist (anymore)
*/
function getQuestionAttributeValues($iQID)
{
Expand Down
6 changes: 3 additions & 3 deletions application/helpers/expressions/em_core_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2175,11 +2175,11 @@ private function RDP_SetVariableValue($op,$name,$value)
}

/**
* Split a soure string into STRING vs. EXPRESSION, where the latter is surrounded by unescaped curly braces.
* This verson properly handles nested curly braces and curly braces within strings within curly braces - both of which are needed to better support JavaScript
* Split a source string into STRING vs. EXPRESSION, where the latter is surrounded by unescaped curly braces.
* This version properly handles nested curly braces and curly braces within strings within curly braces - both of which are needed to better support JavaScript
* Users still need to add a space or carriage return after opening braces (and ideally before closing braces too) to avoid having them treated as expressions.
* @param string $src
* @return string
* @return array
*/
public function asSplitStringOnExpressions($src)
{
Expand Down

0 comments on commit 56d557b

Please sign in to comment.