Skip to content

Commit

Permalink
Dev: Code inspection app/models Return type incompatible (#819)
Browse files Browse the repository at this point in the history
  • Loading branch information
TonisOrmisson authored and LouisGac committed Oct 9, 2017
1 parent 703da1d commit d139237
Show file tree
Hide file tree
Showing 42 changed files with 131 additions and 54 deletions.
4 changes: 3 additions & 1 deletion application/models/Answer.php
Expand Up @@ -33,7 +33,9 @@ class Answer extends LSActiveRecord
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
4 changes: 3 additions & 1 deletion application/models/Assessment.php
Expand Up @@ -34,7 +34,9 @@ class Assessment extends LSActiveRecord
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
4 changes: 3 additions & 1 deletion application/models/Boxes.php
Expand Up @@ -221,6 +221,8 @@ public function getIcons_length()
*/
public static function model($className=__CLASS__)
{
return parent::model($className);
/** @var self $model */
$model =parent::model($className);
return $model;
}
}
6 changes: 4 additions & 2 deletions application/models/Condition.php
Expand Up @@ -36,7 +36,9 @@ class Condition extends LSActiveRecord
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/**
Expand Down Expand Up @@ -302,7 +304,7 @@ public function getConditionCountToken($qid, Condition $scenarionr)
/**
* @param int $qid
* @param Condition $scenarionr
* @return array
* @return CDbDataReader
*/
public function getConditionsToken($qid, Condition $scenarionr)
{
Expand Down
4 changes: 3 additions & 1 deletion application/models/DefaultValue.php
Expand Up @@ -37,7 +37,9 @@ class DefaultValue extends LSActiveRecord
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
4 changes: 3 additions & 1 deletion application/models/Dynamic.php
Expand Up @@ -33,7 +33,9 @@ public static function model($className = null) {
elseif (is_numeric($className)) {
$className = get_called_class() . '_' . $className;
}
return parent::model($className);
/** @var self $model */
$model =parent::model($className);
return $model;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion application/models/ExpressionError.php
Expand Up @@ -35,7 +35,9 @@ class ExpressionError extends LSActiveRecord
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
4 changes: 3 additions & 1 deletion application/models/FailedLoginAttempt.php
Expand Up @@ -28,7 +28,9 @@ class FailedLoginAttempt extends LSActiveRecord
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
4 changes: 3 additions & 1 deletion application/models/Label.php
Expand Up @@ -48,7 +48,9 @@ public function primaryKey()
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
4 changes: 3 additions & 1 deletion application/models/LabelSet.php
Expand Up @@ -40,7 +40,9 @@ public function primaryKey()
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
4 changes: 3 additions & 1 deletion application/models/Notification.php
Expand Up @@ -257,7 +257,9 @@ public static function getUpdateUrl($surveyId = null) {
*/
public static function model($className=__CLASS__)
{
return parent::model($className);
/** @var self $model */
$model =parent::model($className);
return $model;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion application/models/Participant.php
Expand Up @@ -59,7 +59,9 @@ class Participant extends LSActiveRecord
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
4 changes: 3 additions & 1 deletion application/models/ParticipantAttribute.php
Expand Up @@ -33,7 +33,9 @@ class ParticipantAttribute extends LSActiveRecord
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
4 changes: 3 additions & 1 deletion application/models/ParticipantAttributeName.php
Expand Up @@ -37,7 +37,9 @@ public function primaryKey() {
* @return ParticipantAttributeName
*/
public static function model($class = __CLASS__) {
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
4 changes: 3 additions & 1 deletion application/models/ParticipantAttributeNameLang.php
Expand Up @@ -36,7 +36,9 @@ public function primaryKey()
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
4 changes: 3 additions & 1 deletion application/models/ParticipantShare.php
Expand Up @@ -36,7 +36,9 @@ class ParticipantShare extends LSActiveRecord
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
6 changes: 4 additions & 2 deletions application/models/Permission.php
Expand Up @@ -46,7 +46,9 @@ public function tableName()
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/**
Expand Down Expand Up @@ -704,6 +706,6 @@ protected function getOwnerId($iEntityID, $sEntityName)
if($sEntityName=='survey') {
return $sEntityName::Model()->findByPk($iEntityID)->owner_id; // ALternative : if owner_id exist in $sEntityName::model()->findByPk($iEntityID), but unsure actually $sEntityName have always a model
}
return;
return null;
}
}
4 changes: 3 additions & 1 deletion application/models/Plugin.php
Expand Up @@ -29,7 +29,9 @@ class Plugin extends CActiveRecord {
* @return Plugin
*/
public static function model($className = __CLASS__) {
return parent::model($className);
/** @var self $model */
$model =parent::model($className);
return $model;
}

/** @inheritdoc */
Expand Down
4 changes: 3 additions & 1 deletion application/models/PluginSetting.php
Expand Up @@ -30,7 +30,9 @@ class PluginSetting extends CActiveRecord {
* @return PluginSetting
*/
public static function model($className = __CLASS__) {
return parent::model($className);
/** @var self $model */
$model =parent::model($className);
return $model;
}

/** @inheritdoc */
Expand Down
4 changes: 3 additions & 1 deletion application/models/Question.php
Expand Up @@ -55,7 +55,9 @@ class Question extends LSActiveRecord
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
6 changes: 4 additions & 2 deletions application/models/QuestionAttribute.php
Expand Up @@ -31,7 +31,9 @@ class QuestionAttribute extends LSActiveRecord
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down Expand Up @@ -150,7 +152,7 @@ public function setMultiple($iSid, $aQidsAndLang, $aAttributesToUpdate, $aValidQ
* @access public
* @param int $iQuestionID
* @param string $sLanguage restrict to this language (@todo : add it in qanda)
* @return array
* @return array|boolean
* @throws CException
*/
public function getQuestionAttributes($iQuestionID,$sLanguage=null)
Expand Down
4 changes: 3 additions & 1 deletion application/models/QuestionGroup.php
Expand Up @@ -37,7 +37,9 @@ class QuestionGroup extends LSActiveRecord
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
4 changes: 3 additions & 1 deletion application/models/QuotaLanguageSetting.php
Expand Up @@ -32,7 +32,9 @@ class QuotaLanguageSetting extends LSActiveRecord
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var QuotaLanguageSetting $model */
$model = parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
4 changes: 3 additions & 1 deletion application/models/QuotaMember.php
Expand Up @@ -35,7 +35,9 @@ class QuotaMember extends LSActiveRecord
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
4 changes: 3 additions & 1 deletion application/models/Response.php
Expand Up @@ -20,7 +20,9 @@ public function beforeDelete() {
* @return Response
*/
public static function model($className = null) {
return parent::model($className);
/** @var self $model */
$model =parent::model($className);
return $model;
}
/**
*
Expand Down
4 changes: 3 additions & 1 deletion application/models/Session.php
Expand Up @@ -28,7 +28,9 @@ class Session extends CActiveRecord
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
4 changes: 3 additions & 1 deletion application/models/SettingsUser.php
Expand Up @@ -102,6 +102,8 @@ public function search()
*/
public static function model($className=__CLASS__)
{
return parent::model($className);
/** @var self $model */
$model =parent::model($className);
return $model;
}
}
9 changes: 4 additions & 5 deletions application/models/SurveyDynamic.php
Expand Up @@ -48,6 +48,7 @@ public static function model($sid = NULL)
$refresh = true;
}

/** @var self $model */
$model = parent::model(__CLASS__);

//We need to refresh if we changed sid
Expand Down Expand Up @@ -695,20 +696,18 @@ protected function filterColumns(CDbCriteria $criteria)
* @param boolean $bHonorConditions
* @param boolean $subquestion
* @param boolean $getComment
* @return array
* @return array | boolean
*/
public function getQuestionArray($oQuestion, $oResponses, $bHonorConditions, $subquestion=false, $getComment=false){
$attributes = QuestionAttribute::model()->getQuestionAttributes($oQuestion->qid);

if (!(LimeExpressionManager::QuestionIsRelevant($oQuestion->qid) || $bHonorConditions==false) && $attributes['hidden'] === 1)
{
if (!(LimeExpressionManager::QuestionIsRelevant($oQuestion->qid) || $bHonorConditions==false) && $attributes['hidden'] === 1) {
return false;
}

$aQuestionAttributes = $oQuestion->attributes;

if(count($oQuestion->subquestions) > 0)
{
if(count($oQuestion->subquestions) > 0) {
$aQuestionAttributes['subquestions'] = array();
foreach($oQuestion->subquestions as $oSubquestion){
//dont collect scale_id > 0
Expand Down
4 changes: 3 additions & 1 deletion application/models/SurveyLanguageSetting.php
Expand Up @@ -64,7 +64,9 @@ public function primaryKey()
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
4 changes: 3 additions & 1 deletion application/models/SurveyLink.php
Expand Up @@ -41,7 +41,9 @@ class SurveyLink extends LSActiveRecord
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down
3 changes: 2 additions & 1 deletion application/models/SurveyTimingDynamic.php
Expand Up @@ -37,7 +37,8 @@ public static function model($sid = NULL)
self::$survey = $survey;
$refresh = true;
}


/** @var self $model */
$model = parent::model(__CLASS__);

//We need to refresh if we changed sid
Expand Down
4 changes: 3 additions & 1 deletion application/models/SurveyURLParameter.php
Expand Up @@ -28,7 +28,9 @@ class SurveyURLParameter extends LSActiveRecord {
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
/** @var self $model */
$model =parent::model($class);
return $model;
}

/** @inheritdoc */
Expand Down

0 comments on commit d139237

Please sign in to comment.