버그 수정

This commit is contained in:
2019-04-21 16:57:05 +09:00
parent 186df66e81
commit da5fc417c5
60 changed files with 73 additions and 68 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ namespace sammo\Constraint;
class AdhocCallback extends Constraint{
const REQ_VALUES = Constraint::REQ_ARG;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -6,7 +6,7 @@ use \sammo\GameConst;
class AllowJoinAction extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -9,7 +9,7 @@ class AllowJoinDestNation extends Constraint{
protected $relYear;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -10,7 +10,7 @@ use \sammo\MustNotBeReachedException;
class AllowRebellion extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class AllowWar extends Constraint{
const REQ_VALUES = Constraint::REQ_NATION;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class AllowWar extends Constraint{
const REQ_VALUES = Constraint::REQ_NATION;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -7,7 +7,7 @@ namespace sammo\Constraint;
class AlwaysFail extends Constraint{
const REQ_VALUES = Constraint::REQ_STRING_ARG;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
@@ -8,7 +8,7 @@ use \sammo\DB;
class AvailableRecruitCrewType extends Constraint{
const REQ_VALUES = Constraint::REQ_NATION|Constraint::REQ_INT_ARG;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -6,7 +6,7 @@ use \sammo\DB;
class BattleGroundCity extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL|Constraint::REQ_DEST_CITY|Constraint::REQ_BOOLEAN_ARG;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class BeChief extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class BeLord extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class BeNeutral extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -7,7 +7,7 @@ class BeOpeningPart extends Constraint{
protected $relYear;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
@@ -8,7 +8,7 @@ class CheckNationNameDuplicate extends Constraint{
protected $relYear;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+10 -8
View File
@@ -77,7 +77,7 @@ abstract class Constraint{
$this->reason = null;
}
static public function build(array $input):this{
static public function build(array $input):self{
$self = new static();
foreach($input as $key=>$value){
if($value === null){
@@ -140,27 +140,27 @@ abstract class Constraint{
throw new \InvalidArgumentException('require arg');
}
if(($valueType&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) && !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) && !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) && !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) && !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');
}
@@ -170,7 +170,7 @@ abstract class Constraint{
public function reason():?string{
if(!$this->tested === false){
throw new \RuntimeException('test가 실행되지 않음');
throw new \RuntimeException(get_class($this).'::test가 실행되지 않음');
}
return $this->reason;
}
@@ -181,10 +181,12 @@ abstract class Constraint{
continue;
}
$method = $constraintArgs[0].'::build';
$method = __NAMESPACE__.'\\'.$constraintArgs[0].'::build';
/** @var \sammo\Constraint\Constraint $contraint */
$constraint = call_user_func($method,$input);
assert($constraint instanceof Constraint);
if(count($constraintArgs) > 1){
$arg = $constraintArgs[1];
+1 -1
View File
@@ -7,7 +7,7 @@ class ConstructableCity extends Constraint{
protected $relYear;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class DifferentNationDestGeneral extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL|Constraint::REQ_DEST_GENERAL;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
@@ -11,7 +11,7 @@ class DisallowDiplomacyBetweenStatus extends Constraint{
protected $destNationID;
protected $disallowStatus = [];
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
@@ -10,7 +10,7 @@ class DisallowDiplomacyStatus extends Constraint{
protected $nationID;
protected $disallowStatus = [];
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
@@ -9,7 +9,7 @@ class AllowJoinDestNation extends Constraint{
protected $relYear;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class ExistsDestGeneral extends Constraint{
const REQ_VALUES = Constraint::REQ_DEST_GENERAL;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class ExistsDestNation extends Constraint{
const REQ_VALUES = Constraint::REQ_DEST_NATION;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class FriendlyDestGeneral extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL|Constraint::REQ_DEST_GENERAL;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -4,7 +4,7 @@ namespace sammo\Constraint;
class MustBeNPC extends Constraint{
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -7,7 +7,7 @@ use sammo\DB;
class MustBeTroopLeader extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class NearCity extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL|Constraint::REQ_DEST_CITY|Constraint::REQ_NUMERIC_ARG;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class NotBeNeutral extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class NotCapital extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL|Constraint::REQ_NATION|Constraint::REQ_BOOLEAN_ARG;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class NotChief extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class NotLord extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class NotBeNeutral extends Constraint{
const REQ_VALUES = Constraint::REQ_DEST_CITY;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class NotOccupiedDestCity extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL|Constraint::REQ_DEST_CITY;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -7,7 +7,7 @@ class NotOpeningPart extends Constraint{
protected $relYear;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class NotSameDestCity extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL|Constraint::REQ_DEST_CITY;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class NotWanderingNation extends Constraint{
const REQ_VALUES = Constraint::REQ_NATION;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class OccupiedCity extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL|Constraint::REQ_CITY|Constraint::REQ_BOOLEAN_ARG;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class OccupiedDestCity extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL|Constraint::REQ_DEST_CITY;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -11,7 +11,7 @@ class RemainCityCapacity extends Constraint{
protected $maxKey;
protected $keyNick;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -11,7 +11,7 @@ class RemainCityTrust extends Constraint{
protected $maxKey;
protected $keyNick;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -13,7 +13,7 @@ class ReqCityCapacity extends Constraint{
protected $keyNick;
protected $reqVal;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class ReqCityTrader extends Constraint{
const REQ_VALUES = Constraint::REQ_CITY|Constraint::REQ_INT_ARG;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -11,7 +11,7 @@ class RemainCityTrust extends Constraint{
protected $maxKey;
protected $keyNick;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -17,7 +17,7 @@ class ReqEnvValue extends Constraint{
protected $comp;
protected $msg;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
@@ -6,7 +6,7 @@ use sammo\GameConst;
class ReqGeneralAtmosMargin extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL|Constraint::REQ_INT_ARG;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class ReqGeneralCrew extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
@@ -10,7 +10,7 @@ class ReqGeneralCrewMargin extends Constraint{
protected $crewType;
const REQ_VALUES = Constraint::REQ_GENERAL|Constraint::REQ_INT_ARG;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class ReqGeneralGold extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL|Constraint::REQ_NUMERIC_ARG;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class ReqGeneralRice extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL|Constraint::REQ_NUMERIC_ARG;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
@@ -6,7 +6,7 @@ use sammo\GameConst;
class ReqGeneralTrainMargin extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL|Constraint::REQ_INT_ARG;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -17,7 +17,7 @@ class ReqGeneralValue extends Constraint{
protected $reqVal;
protected $comp;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -17,7 +17,7 @@ class ReqNationValue extends Constraint{
protected $reqVal;
protected $comp;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class ReqNationGold extends Constraint{
const REQ_VALUES = Constraint::REQ_NATION|Constraint::REQ_NUMERIC_ARG;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class ReqNationRice extends Constraint{
const REQ_VALUES = Constraint::REQ_NATION|Constraint::REQ_NUMERIC_ARG;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -6,7 +6,7 @@ use sammo\DB;
class ReqTroopMembers extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class SuppliedCity extends Constraint{
const REQ_VALUES = Constraint::REQ_CITY;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class SuppliedDestCity extends Constraint{
const REQ_VALUES = Constraint::REQ_DEST_CITY;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace sammo\Constraint;
class WanderingNation extends Constraint{
const REQ_VALUES = Constraint::REQ_NATION;
public function checkInputValues(bool $throwExeception=true){
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}