fix: phan 지시에 따라 일부 버그 수정

- null && key_exists 버그
- or assign이 integer 대상이므로 직접 연산
- false 대신 0 입력한 곳 수정
- 자체 Deprecate 처리한 함수 회피
- 초기화되지 않은 [] 확인하여 처리
- sleep은 정수만 받으므로 usleep으로 변경
- 선언하지 않고 그냥 사용하던 member 변수 선언
- boolean operation 순서 틀린 부분 수정
This commit is contained in:
2021-08-12 23:58:20 +09:00
parent 0975e925a9
commit ee8854451c
67 changed files with 51 additions and 137 deletions
@@ -9,6 +9,7 @@ class AllowDiplomacyStatus extends Constraint{
protected $nationID;
protected $allowStatus = [];
protected $errMsg = null;
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
+5 -5
View File
@@ -154,27 +154,27 @@ abstract class Constraint{
throw new \InvalidArgumentException('require arg');
}
if(($valueType&static::REQ_STRING_ARG===static::REQ_STRING_ARG) && !is_string($this->arg)){
if((($valueType&static::REQ_STRING_ARG)===static::REQ_STRING_ARG) && !is_string($this->arg)){
if(!$throwExeception){return false; }
throw new \InvalidArgumentException('require string arg');
}
if(($valueType&static::REQ_BOOLEAN_ARG===static::REQ_BOOLEAN_ARG) && !is_bool($this->arg)){
if((($valueType&static::REQ_BOOLEAN_ARG)===static::REQ_BOOLEAN_ARG) && !is_bool($this->arg)){
if(!$throwExeception){return false; }
throw new \InvalidArgumentException('require bool arg');
}
if(($valueType&static::REQ_INT_ARG===static::REQ_INT_ARG) && !is_int($this->arg)){
if((($valueType&static::REQ_INT_ARG)===static::REQ_INT_ARG) && !is_int($this->arg)){
if(!$throwExeception){return false; }
throw new \InvalidArgumentException('require int arg');
}
if(($valueType&static::REQ_NUMERIC_ARG===static::REQ_NUMERIC_ARG) && !is_numeric($this->arg)){
if((($valueType&static::REQ_NUMERIC_ARG)===static::REQ_NUMERIC_ARG) && !is_numeric($this->arg)){
if(!$throwExeception){return false; }
throw new \InvalidArgumentException('require numeric arg');
}
if(($valueType&static::REQ_ARRAY_ARG===static::REQ_ARRAY_ARG) && !is_array($this->arg)){
if((($valueType&static::REQ_ARRAY_ARG)===static::REQ_ARRAY_ARG) && !is_array($this->arg)){
if(!$throwExeception){return false; }
throw new \InvalidArgumentException('require array arg');
}
+1
View File
@@ -9,6 +9,7 @@ class RemainCityTrust extends Constraint{
protected $key;
protected $maxKey;
protected $maxVal;
protected $keyNick;
public function checkInputValues(bool $throwExeception=true):bool{
+1
View File
@@ -12,6 +12,7 @@ class ReqCityCapacity extends Constraint{
protected $maxKey;
protected $keyNick;
protected $reqVal;
protected $isPercent;
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
+1
View File
@@ -10,6 +10,7 @@ class ReqCityTrust extends Constraint{
protected $key;
protected $maxKey;
protected $keyNick;
protected $reqVal;
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
+1
View File
@@ -17,6 +17,7 @@ class ReqCityValue extends Constraint{
protected $reqVal;
protected $comp;
protected $errMsg;
protected $isPercent;
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
@@ -17,6 +17,7 @@ class ReqDestCityValue extends Constraint{
protected $reqVal;
protected $comp;
protected $errMsg;
protected $isPercent;
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
@@ -17,6 +17,7 @@ class ReqDestNationValue extends Constraint{
protected $reqVal;
protected $comp;
protected $errMsg;
protected $isPercent;
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
@@ -38,7 +38,7 @@ class ReqGeneralCrewMargin extends Constraint{
$reqCrewType = GameUnitConst::byID($this->arg);
//XXX: 왜 General -> obj -> General 변환을 하고 있나?
$generalObj = new General($this->general, null, null, null, null, false);
$generalObj = new General($this->general, null, null, null, null, null, false);
if($reqCrewType->id != $generalObj->getCrewTypeObj()->id){
return true;
@@ -14,6 +14,7 @@ class ReqNationAuxValue extends Constraint
const REQ_VALUES = Constraint::REQ_NATION | Constraint::REQ_ARRAY_ARG;
protected $key;
protected $maxKey;
protected $defaultValue;
protected $reqVal;
protected $comp;
+1
View File
@@ -17,6 +17,7 @@ class ReqNationValue extends Constraint{
protected $reqVal;
protected $comp;
protected $errMsg;
protected $isPercent;
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){