From de5fe818e695083b055f81de3a67565f2cfb6ccf Mon Sep 17 00:00:00 2001 From: Hide_D Date: Mon, 9 May 2022 00:06:41 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20phan=20=EC=B6=9C=EB=A0=A5=20=EA=B2=B0?= =?UTF-8?q?=EA=B3=BC=EC=97=90=20=EB=94=B0=EB=9D=BC=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?-=20switch=EC=97=90=20=EB=B3=80=EC=88=98=EB=A5=BC=20=EC=A0=95?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=EA=B2=BD=EC=9A=B0=20default=EC=97=90=20th?= =?UTF-8?q?row=20-=20Util::getPost=EC=97=90=20=EC=9D=BC=EB=B6=80=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=20=EA=B0=95=EC=A0=9C=20-=20array=EC=9D=B8=20?= =?UTF-8?q?=EC=9D=BC=EB=B6=80=20=EA=B0=92=EB=93=A4=EC=97=90=20PHPDoc=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=20=EC=A7=80=EC=A0=95=20-=20Enum=EC=97=90=20t?= =?UTF-8?q?oString=EC=9D=B4=20=EC=97=86=EC=9C=BC=EB=AF=80=EB=A1=9C=20value?= =?UTF-8?q?=EA=B0=92=20=EC=A7=80=EC=A0=95=20-=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20use=20function=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .phan/config.php | 4 +--- hwe/_admin1_submit.php | 1 + hwe/_admin5.php | 2 ++ hwe/_admin8.php | 2 ++ hwe/a_emperior_detail.php | 1 + hwe/func_tournament.php | 2 ++ hwe/sammo/API/Betting/GetBettingDetail.php | 3 --- hwe/sammo/API/Command/PushCommand.php | 1 - hwe/sammo/API/Command/RepeatCommand.php | 1 - hwe/sammo/API/Global/GeneralList.php | 5 ---- hwe/sammo/API/Global/GeneralListWithToken.php | 23 ------------------- hwe/sammo/API/Global/GetHistory.php | 3 --- hwe/sammo/API/Nation/GeneralList.php | 4 ---- .../API/NationCommand/GetReservedCommand.php | 2 -- hwe/sammo/API/NationCommand/PushCommand.php | 1 - hwe/sammo/API/NationCommand/RepeatCommand.php | 2 -- hwe/sammo/Command/General/che_강행.php | 7 ------ hwe/sammo/Command/General/che_건국.php | 3 --- hwe/sammo/Command/General/che_등용.php | 2 -- hwe/sammo/Command/General/che_등용수락.php | 13 ++--------- hwe/sammo/Command/General/che_숙련전환.php | 8 ------- hwe/sammo/Command/General/che_은퇴.php | 7 +----- hwe/sammo/Command/General/che_이동.php | 7 ------ hwe/sammo/Command/General/che_임관.php | 7 ------ .../Command/General/che_장수대상임관.php | 4 ---- hwe/sammo/Command/General/che_징병.php | 7 ------ hwe/sammo/Command/General/che_첩보.php | 4 ---- hwe/sammo/Command/General/che_화계.php | 3 --- hwe/sammo/Command/Nation/che_국기변경.php | 12 ---------- hwe/sammo/DefaultAction.php | 4 ++++ hwe/sammo/InheritancePointManager.php | 6 ++--- src/sammo/KVStorage.php | 2 +- src/sammo/LiteHashDRBG.php | 2 +- src/sammo/Util.php | 5 ++-- 34 files changed, 23 insertions(+), 137 deletions(-) diff --git a/.phan/config.php b/.phan/config.php index bd733e7a..8ac1d219 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -16,6 +16,7 @@ return [ // that functions removed in php 7.0 exist. // (See `backward_compatibility_checks` for additional options) "target_php_version" => '8.1', + "minimum_target_php_version" => '8.1', 'backward_compatibility_checks ' => true, 'minimum_severity' => \Phan\Issue::SEVERITY_NORMAL, @@ -42,7 +43,6 @@ return [ 'hwe/a_kingdomList.php', 'hwe/a_npcList.php', 'hwe/api.php', - 'hwe/a_status.php', 'hwe/a_traffic.php', 'hwe/a_vote.php', 'hwe/battle_simulator.php', @@ -98,10 +98,8 @@ return [ 'hwe/j_general_set_permission.php', 'hwe/j_get_basic_general_list.php', 'hwe/j_get_city_list.php', - 'hwe/j_get_reserved_command.php', 'hwe/j_get_select_npc_token.php', 'hwe/j_get_select_pool.php', - 'hwe/j_image_upload.php', 'hwe/j_install_db.php', 'hwe/j_install.php', 'hwe/j_load_scenarios.php', diff --git a/hwe/_admin1_submit.php b/hwe/_admin1_submit.php index a8cde9fc..deedb0e1 100644 --- a/hwe/_admin1_submit.php +++ b/hwe/_admin1_submit.php @@ -72,6 +72,7 @@ switch ($btn) { case "30분턴": $turnterm = 30; break; case "60분턴": $turnterm = 60; break; case "120분턴": $turnterm = 120; break; + default: throw new \Exception("알 수 없는 턴 기간"); } $oldunit = $admin['turnterm'] * 60; $unit = $turnterm * 60; diff --git a/hwe/_admin5.php b/hwe/_admin5.php index 10e4ea77..ffe49cd5 100644 --- a/hwe/_admin5.php +++ b/hwe/_admin5.php @@ -5,7 +5,9 @@ namespace sammo; include "lib.php"; include "func.php"; +/** @var int */ $type = Util::getPost('type', 'int', 0); +/** @var int */ $type2 = Util::getPost('type2', 'int', 0); if ($type < 0 || $type > 17) { diff --git a/hwe/_admin8.php b/hwe/_admin8.php index b9fb03c0..fdab5f99 100644 --- a/hwe/_admin8.php +++ b/hwe/_admin8.php @@ -95,6 +95,8 @@ $sel[$type] = "selected"; case 7: $state = "불가침"; break; + default: + throw new \Exception("알 수 없는 외교 상태: {$dip['state']}"); } $date = TimeUtil::now(); diff --git a/hwe/a_emperior_detail.php b/hwe/a_emperior_detail.php index a852745c..b0c059df 100644 --- a/hwe/a_emperior_detail.php +++ b/hwe/a_emperior_detail.php @@ -175,6 +175,7 @@ $serverID = $emperior['server_id'] ?? ($emperior['serverID'] ?? null); } $nation += Json::decode($nation['data']); + /** @var array $nation */ $nation['typeName'] = getNationType($nation['type']); $nation['levelName'] = getNationLevel($nation['level']); /** @var int[]|null $nationGenerals */ diff --git a/hwe/func_tournament.php b/hwe/func_tournament.php index a7afea52..e70eff95 100644 --- a/hwe/func_tournament.php +++ b/hwe/func_tournament.php @@ -517,6 +517,7 @@ function fillLowGenAll($tnmt_type) }; //자동신청하고, 돈 있고, 아직 참가 안한 장수 + /** @var array */ $freeJoinerCandidate = []; foreach ($db->query( @@ -535,6 +536,7 @@ function fillLowGenAll($tnmt_type) break; } $general = Util::choiceRandomUsingWeightPair($freeJoinerCandidate); + /** @var array $general */ unset($freeJoinerCandidate[$general['no']]); $grpIdx = array_keys($grpCount, min($grpCount))[0]; diff --git a/hwe/sammo/API/Betting/GetBettingDetail.php b/hwe/sammo/API/Betting/GetBettingDetail.php index 99548309..7e8a6857 100644 --- a/hwe/sammo/API/Betting/GetBettingDetail.php +++ b/hwe/sammo/API/Betting/GetBettingDetail.php @@ -6,13 +6,10 @@ use sammo\Session; use DateTimeInterface; use sammo\DB; use sammo\DTO\BettingInfo; -use sammo\General; use sammo\KVStorage; use sammo\Util; use sammo\Validator; -use function sammo\increaseRefresh; - class GetBettingDetail extends \sammo\BaseAPI { public function validateArgs(): ?string diff --git a/hwe/sammo/API/Command/PushCommand.php b/hwe/sammo/API/Command/PushCommand.php index dd3f8bf1..cb543a2e 100644 --- a/hwe/sammo/API/Command/PushCommand.php +++ b/hwe/sammo/API/Command/PushCommand.php @@ -6,7 +6,6 @@ use sammo\Session; use DateTimeInterface; use sammo\Validator; -use function sammo\cutTurn; use function sammo\pushGeneralCommand; class PushCommand extends \sammo\BaseAPI diff --git a/hwe/sammo/API/Command/RepeatCommand.php b/hwe/sammo/API/Command/RepeatCommand.php index b48e571c..a6669e1f 100644 --- a/hwe/sammo/API/Command/RepeatCommand.php +++ b/hwe/sammo/API/Command/RepeatCommand.php @@ -6,7 +6,6 @@ use sammo\Session; use DateTimeInterface; use sammo\Validator; -use function sammo\cutTurn; use function sammo\repeatGeneralCommand; class RepeatCommand extends \sammo\BaseAPI diff --git a/hwe/sammo/API/Global/GeneralList.php b/hwe/sammo/API/Global/GeneralList.php index cd29efa9..26eb9f5c 100644 --- a/hwe/sammo/API/Global/GeneralList.php +++ b/hwe/sammo/API/Global/GeneralList.php @@ -3,19 +3,14 @@ namespace sammo\API\Global; use sammo\DB; -use sammo\General; use sammo\Json; use sammo\KVStorage; use sammo\RootDB; use sammo\Session; -use sammo\Util; -use sammo\Validator; use function sammo\calcLeadershipBonus; use function sammo\checkLimit; -use function sammo\checkSecretPermission; use function sammo\getDed; -use function sammo\getDedLevelText; use function sammo\getExpLevel; use function sammo\getGenChar; use function sammo\getGeneralSpecialDomesticName; diff --git a/hwe/sammo/API/Global/GeneralListWithToken.php b/hwe/sammo/API/Global/GeneralListWithToken.php index 8dc6ff00..5d6c54db 100644 --- a/hwe/sammo/API/Global/GeneralListWithToken.php +++ b/hwe/sammo/API/Global/GeneralListWithToken.php @@ -2,29 +2,6 @@ namespace sammo\API\Global; -use sammo\DB; -use sammo\General; -use sammo\Json; -use sammo\KVStorage; -use sammo\RootDB; -use sammo\Session; -use sammo\Util; -use sammo\Validator; - -use function sammo\calcLeadershipBonus; -use function sammo\checkLimit; -use function sammo\checkSecretPermission; -use function sammo\getDed; -use function sammo\getDedLevelText; -use function sammo\getExpLevel; -use function sammo\getGenChar; -use function sammo\getGeneralSpecialDomesticName; -use function sammo\getGeneralSpecialWarName; -use function sammo\getHonor; -use function sammo\getNationStaticInfo; -use function sammo\getOfficerLevelText; -use function sammo\increaseRefresh; - class GeneralListWithToken extends GeneralList { static $withToken = true; diff --git a/hwe/sammo/API/Global/GetHistory.php b/hwe/sammo/API/Global/GetHistory.php index e97acc40..12baf728 100644 --- a/hwe/sammo/API/Global/GetHistory.php +++ b/hwe/sammo/API/Global/GetHistory.php @@ -7,14 +7,11 @@ use DateTimeInterface; use sammo\APICacheResult; use sammo\DB; use sammo\Json; -use sammo\KVStorage; use sammo\UniqueConst; use sammo\Util; use sammo\Validator; use function sammo\checkLimit; -use function sammo\getAllNationStaticInfo; -use function sammo\getNationStaticInfo; use function sammo\increaseRefresh; use function sammo\templateLimitMsg; diff --git a/hwe/sammo/API/Nation/GeneralList.php b/hwe/sammo/API/Nation/GeneralList.php index 7ec65995..64492165 100644 --- a/hwe/sammo/API/Nation/GeneralList.php +++ b/hwe/sammo/API/Nation/GeneralList.php @@ -6,16 +6,12 @@ use sammo\DB; use sammo\General; use sammo\Session; use sammo\Util; -use sammo\Validator; use function sammo\calcLeadershipBonus; use function sammo\checkLimit; use function sammo\checkSecretPermission; use function sammo\getBillByLevel; use function sammo\getDedLevelText; -use function sammo\getGenChar; -use function sammo\getGeneralSpecialDomesticName; -use function sammo\getGeneralSpecialWarName; use function sammo\getHonor; use function sammo\getNationStaticInfo; use function sammo\getOfficerLevelText; diff --git a/hwe/sammo/API/NationCommand/GetReservedCommand.php b/hwe/sammo/API/NationCommand/GetReservedCommand.php index f4c43c55..c6cbab42 100644 --- a/hwe/sammo/API/NationCommand/GetReservedCommand.php +++ b/hwe/sammo/API/NationCommand/GetReservedCommand.php @@ -13,9 +13,7 @@ use sammo\TimeUtil; use function sammo\checkLimit; use function sammo\checkSecretPermission; -use function sammo\cutTurn; use function sammo\getChiefCommandTable; -use function sammo\getNationChiefLevel; use function sammo\getOfficerLevelText; use function sammo\increaseRefresh; diff --git a/hwe/sammo/API/NationCommand/PushCommand.php b/hwe/sammo/API/NationCommand/PushCommand.php index cda4c40c..8f61e73a 100644 --- a/hwe/sammo/API/NationCommand/PushCommand.php +++ b/hwe/sammo/API/NationCommand/PushCommand.php @@ -7,7 +7,6 @@ use DateTimeInterface; use sammo\DB; use sammo\Validator; -use function sammo\cutTurn; use function sammo\pushNationCommand; class PushCommand extends \sammo\BaseAPI diff --git a/hwe/sammo/API/NationCommand/RepeatCommand.php b/hwe/sammo/API/NationCommand/RepeatCommand.php index 837b59dc..410c9267 100644 --- a/hwe/sammo/API/NationCommand/RepeatCommand.php +++ b/hwe/sammo/API/NationCommand/RepeatCommand.php @@ -7,8 +7,6 @@ use DateTimeInterface; use sammo\DB; use sammo\Validator; -use function sammo\cutTurn; -use function sammo\repeatGeneralCommand; use function sammo\repeatNationCommand; class RepeatCommand extends \sammo\BaseAPI diff --git a/hwe/sammo/Command/General/che_강행.php b/hwe/sammo/Command/General/che_강행.php index 88d011c7..23b79c05 100644 --- a/hwe/sammo/Command/General/che_강행.php +++ b/hwe/sammo/Command/General/che_강행.php @@ -3,20 +3,13 @@ namespace sammo\Command\General; use \sammo\DB; -use \sammo\Util; use \sammo\JosaUtil; -use \sammo\General; use \sammo\ActionLogger; -use \sammo\GameConst; -use \sammo\GameUnitConst; use \sammo\LastTurn; use \sammo\Command; -use function sammo\getMapTheme; -use function \sammo\printCitiesBasedOnDistance; use function sammo\tryUniqueItemLottery; -use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\CityConst; diff --git a/hwe/sammo/Command/General/che_건국.php b/hwe/sammo/Command/General/che_건국.php index 6f3a190a..5495d397 100644 --- a/hwe/sammo/Command/General/che_건국.php +++ b/hwe/sammo/Command/General/che_건국.php @@ -16,15 +16,12 @@ use \sammo\Json; use function \sammo\tryUniqueItemLottery; use function \sammo\getAllNationStaticInfo; -use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; -use sammo\CityConst; use sammo\Enums\InheritanceKey; use function sammo\buildNationTypeClass; use function sammo\refreshNationStaticInfo; use function sammo\GetNationColors; -use function sammo\newColor; class che_건국 extends Command\GeneralCommand diff --git a/hwe/sammo/Command/General/che_등용.php b/hwe/sammo/Command/General/che_등용.php index 13f7f327..8c0d5c70 100644 --- a/hwe/sammo/Command/General/che_등용.php +++ b/hwe/sammo/Command/General/che_등용.php @@ -18,10 +18,8 @@ use \sammo\{ use function \sammo\getAllNationStaticInfo; use function \sammo\getNationStaticInfo; -use function \sammo\newColor; use function sammo\tryUniqueItemLottery; -use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; diff --git a/hwe/sammo/Command/General/che_등용수락.php b/hwe/sammo/Command/General/che_등용수락.php index e060ffcf..d50b8b35 100644 --- a/hwe/sammo/Command/General/che_등용수락.php +++ b/hwe/sammo/Command/General/che_등용수락.php @@ -2,21 +2,12 @@ namespace sammo\Command\General; use \sammo\{ - DB, Util, JosaUtil, - General, DummyGeneral, - ActionLogger, + DB, JosaUtil, + General, GameConst, - LastTurn, - Json, - GameUnitConst, Command, - ScoutMessage }; -use function \sammo\getAllNationStaticInfo; -use function \sammo\getNationStaticInfo; - -use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\Enums\InheritanceKey; diff --git a/hwe/sammo/Command/General/che_숙련전환.php b/hwe/sammo/Command/General/che_숙련전환.php index a8664be5..1b4d0e0f 100644 --- a/hwe/sammo/Command/General/che_숙련전환.php +++ b/hwe/sammo/Command/General/che_숙련전환.php @@ -5,21 +5,13 @@ namespace sammo\Command\General; use \sammo\DB; use \sammo\Util; use \sammo\JosaUtil; -use \sammo\Session; -use \sammo\KVStorage; -use \sammo\General; -use \sammo\ActionLogger; -use \sammo\GameConst; use \sammo\GameUnitConst; use \sammo\LastTurn; use \sammo\Command; -use \sammo\ServConfig; -use function \sammo\getDexCall; use function sammo\getDexLevelList; use function \sammo\tryUniqueItemLottery; -use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; diff --git a/hwe/sammo/Command/General/che_은퇴.php b/hwe/sammo/Command/General/che_은퇴.php index 47e815a6..570a73f7 100644 --- a/hwe/sammo/Command/General/che_은퇴.php +++ b/hwe/sammo/Command/General/che_은퇴.php @@ -2,18 +2,13 @@ namespace sammo\Command\General; use \sammo\{ - DB, Util, JosaUtil, - General, - ActionLogger, - GameConst, GameUnitConst, + DB, LastTurn, Command }; -use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; -use function sammo\tryRollbackInheritUniqueItem; use function sammo\tryUniqueItemLottery; class che_은퇴 extends Command\GeneralCommand{ diff --git a/hwe/sammo/Command/General/che_이동.php b/hwe/sammo/Command/General/che_이동.php index 1ad87f32..b3ff7583 100644 --- a/hwe/sammo/Command/General/che_이동.php +++ b/hwe/sammo/Command/General/che_이동.php @@ -3,20 +3,13 @@ namespace sammo\Command\General; use \sammo\DB; -use \sammo\Util; use \sammo\JosaUtil; -use \sammo\General; use \sammo\ActionLogger; -use \sammo\GameConst; -use \sammo\GameUnitConst; use \sammo\LastTurn; use \sammo\Command; -use function sammo\getMapTheme; -use function \sammo\printCitiesBasedOnDistance; use function sammo\tryUniqueItemLottery; -use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\CityConst; diff --git a/hwe/sammo/Command/General/che_임관.php b/hwe/sammo/Command/General/che_임관.php index 823172e9..c4333c0a 100644 --- a/hwe/sammo/Command/General/che_임관.php +++ b/hwe/sammo/Command/General/che_임관.php @@ -6,23 +6,16 @@ use \sammo\{ DB, Util, JosaUtil, - General, - ActionLogger, GameConst, - GameUnitConst, LastTurn, Command, - Json, KVStorage }; use function \sammo\tryUniqueItemLottery; -use function \sammo\getInvitationList; use function \sammo\getNationStaticInfo; -use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; -use sammo\CityConst; use sammo\Enums\InheritanceKey; class che_임관 extends Command\GeneralCommand diff --git a/hwe/sammo/Command/General/che_장수대상임관.php b/hwe/sammo/Command/General/che_장수대상임관.php index 2688e81d..e2c299aa 100644 --- a/hwe/sammo/Command/General/che_장수대상임관.php +++ b/hwe/sammo/Command/General/che_장수대상임관.php @@ -13,14 +13,10 @@ use \sammo\{ }; use function sammo\getAllNationStaticInfo; -use function \sammo\formatName; use function \sammo\tryUniqueItemLottery; -use function \sammo\getInvitationList; use function \sammo\getNationStaticInfo; -use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; -use sammo\CityConst; use sammo\Enums\InheritanceKey; class che_장수대상임관 extends Command\GeneralCommand{ diff --git a/hwe/sammo/Command/General/che_징병.php b/hwe/sammo/Command/General/che_징병.php index fd271678..b548d778 100644 --- a/hwe/sammo/Command/General/che_징병.php +++ b/hwe/sammo/Command/General/che_징병.php @@ -4,23 +4,16 @@ namespace sammo\Command\General; use \sammo\DB; use \sammo\Util; -use \sammo\JosaUtil; -use \sammo\Session; -use \sammo\KVStorage; -use \sammo\General; -use \sammo\ActionLogger; use \sammo\GameConst; use \sammo\GameUnitConst; use \sammo\LastTurn; use \sammo\Command; use \sammo\ServConfig; -use function \sammo\getTechCall; use function \sammo\tryUniqueItemLottery; use function \sammo\getTechAbil; use function sammo\getTechLevel; -use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; diff --git a/hwe/sammo/Command/General/che_첩보.php b/hwe/sammo/Command/General/che_첩보.php index 36090efb..276441a3 100644 --- a/hwe/sammo/Command/General/che_첩보.php +++ b/hwe/sammo/Command/General/che_첩보.php @@ -5,19 +5,15 @@ namespace sammo\Command\General; use \sammo\DB; use \sammo\Util; use \sammo\JosaUtil; -use \sammo\General; use \sammo\ActionLogger; -use \sammo\GameConst; use \sammo\GameUnitConst; use \sammo\LastTurn; use \sammo\Command; use \sammo\Json; use function \sammo\searchDistance; -use function \sammo\printCitiesBasedOnDistance; use function sammo\tryRollbackInheritUniqueItem; -use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\CityConst; use sammo\Enums\InheritanceKey; diff --git a/hwe/sammo/Command/General/che_화계.php b/hwe/sammo/Command/General/che_화계.php index ce7bda56..5b33bd5f 100644 --- a/hwe/sammo/Command/General/che_화계.php +++ b/hwe/sammo/Command/General/che_화계.php @@ -8,15 +8,12 @@ use \sammo\JosaUtil; use \sammo\General; use \sammo\ActionLogger; use \sammo\GameConst; -use \sammo\GameUnitConst; use \sammo\LastTurn; use \sammo\Command; use function \sammo\searchDistance; -use function \sammo\printCitiesBasedOnDistance; use function sammo\tryRollbackInheritUniqueItem; -use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\CityConst; use sammo\Enums\RankColumn; diff --git a/hwe/sammo/Command/Nation/che_국기변경.php b/hwe/sammo/Command/Nation/che_국기변경.php index cbcb5875..9250a228 100644 --- a/hwe/sammo/Command/Nation/che_국기변경.php +++ b/hwe/sammo/Command/Nation/che_국기변경.php @@ -3,27 +3,15 @@ namespace sammo\Command\Nation; use \sammo\DB; -use \sammo\Util; use \sammo\JosaUtil; -use \sammo\General; -use \sammo\DummyGeneral; -use \sammo\ActionLogger; -use \sammo\GameConst; use \sammo\LastTurn; -use \sammo\GameUnitConst; use \sammo\Command; -use \sammo\MessageTarget; -use \sammo\Message; -use \sammo\CityConst; use \sammo\Json; use function \sammo\GetNationColors; -use function \sammo\newColor; -use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\Enums\InheritanceKey; -use sammo\Event\Action; class che_국기변경 extends Command\NationCommand { diff --git a/hwe/sammo/DefaultAction.php b/hwe/sammo/DefaultAction.php index 7b9cb9e0..a50f5927 100644 --- a/hwe/sammo/DefaultAction.php +++ b/hwe/sammo/DefaultAction.php @@ -1,6 +1,10 @@ name; diff --git a/hwe/sammo/InheritancePointManager.php b/hwe/sammo/InheritancePointManager.php index b39fb213..716405e5 100644 --- a/hwe/sammo/InheritancePointManager.php +++ b/hwe/sammo/InheritancePointManager.php @@ -142,10 +142,10 @@ class InheritancePointManager $storeType = $inheritType->storeType; $multiplier = $inheritType->pointCoeff; if ($storeType !== true) { - throw new \InvalidArgumentException("{$key}는 직접 저장형 유산 포인트가 아님"); + throw new \InvalidArgumentException("{$key->value}는 직접 저장형 유산 포인트가 아님"); } if ($multiplier != 1 && $value != 0) { - throw new \InvalidArgumentException("{$key}는 1:1 유산 포인트가 아님"); + throw new \InvalidArgumentException("{$key->value}는 1:1 유산 포인트가 아님"); } $ownerID = $general->getVar('owner'); @@ -177,7 +177,7 @@ class InheritancePointManager $storeType = $inheritType->storeType; $multiplier = $inheritType->pointCoeff; if ($storeType !== true) { - throw new \InvalidArgumentException("{$key}는 직접 저장형 유산 포인트가 아님"); + throw new \InvalidArgumentException("{$key->value}는 직접 저장형 유산 포인트가 아님"); } $ownerID = $general->getVar('owner'); diff --git a/src/sammo/KVStorage.php b/src/sammo/KVStorage.php index 79d1d933..b8e9cc75 100644 --- a/src/sammo/KVStorage.php +++ b/src/sammo/KVStorage.php @@ -199,7 +199,7 @@ class KVStorage $keys = Util::valuesFromEnumArray($keys); if ($this->cacheData === null) { - return $this->getDBValues($keys); + return $this->getDBValues($keys)->toArray(); } $result = []; diff --git a/src/sammo/LiteHashDRBG.php b/src/sammo/LiteHashDRBG.php index 35aaa3f5..6a205d3c 100644 --- a/src/sammo/LiteHashDRBG.php +++ b/src/sammo/LiteHashDRBG.php @@ -5,7 +5,7 @@ namespace sammo; //NOTE: JavaScript 버전과 일치 const MAX_RNG_SUPPORT_BIT = 53; if (PHP_INT_SIZE * 8 < MAX_RNG_SUPPORT_BIT) { - throw new \RangeException("PHP not support {$MAX_RNG_SUPPORT_BIT} bit integer"); + throw new \RangeException('PHP not support '.MAX_RNG_SUPPORT_BIT.' bit integer'); } /** diff --git a/src/sammo/Util.php b/src/sammo/Util.php index 0f3efd66..249d1c02 100644 --- a/src/sammo/Util.php +++ b/src/sammo/Util.php @@ -520,9 +520,8 @@ class Util extends \utilphp\util /** * 각 값의 비중에 따라 랜덤한 값을 선택. * - * @param array $items 각 수치와 비중. [값, weight] 으로 보관 - * - * @return object 선택된 랜덤 값의 첫번째 값 + * @param array<{0:array|object,1:float|int}> $items 각 수치와 비중. [값, weight] 으로 보관 + * @return array|object 선택된 랜덤 값의 첫번째 값 */ public static function choiceRandomUsingWeightPair(array $items) {