diff --git a/misc/module/common/deck.game.php b/misc/module/common/deck.game.php index d29876e..04c1ceb 100644 --- a/misc/module/common/deck.game.php +++ b/misc/module/common/deck.game.php @@ -32,7 +32,7 @@ function __construct() { } // MUST be called before any other method if db table is not called 'card' - function init($table) { + function init(string $table) { $this->table = $table; } @@ -46,7 +46,7 @@ function init($table) { // "nbr" => // Number of cards with this card type to create in game // // If location_arg is not specified, cards are placed at location extreme position - function createCards($cards, $location_global, $card_state_global = null) { + function createCards(array $cards, string $location_global, ?int $card_state_global = null) { return; } @@ -56,7 +56,7 @@ function getExtremePosition($getMax, $location, $card_key = null) { } // Shuffle card of a specified location, result of the operation will changes state of the card to be a position after shuffling - function shuffle($location) { + function shuffle(string $location) { } diff --git a/misc/module/table/table.game.php b/misc/module/table/table.game.php index 51c8e3f..fd5b76b 100644 --- a/misc/module/table/table.game.php +++ b/misc/module/table/table.game.php @@ -42,7 +42,7 @@ function error($msg) { class APP_DbObject extends APP_Object { public $query; - function DbQuery($str) { + function DbQuery(string $str) { $this->query = $str; echo "dbquery: $str\n"; } @@ -51,7 +51,7 @@ function getUniqueValueFromDB($sql) { return 0; } - function getCollectionFromDB($query, $single = false) { + function getCollectionFromDB(string $query, bool $single = false) { echo "dbquery coll: $query\n"; return array(); } @@ -138,7 +138,7 @@ function setAllPlayersMultiactive() { function setPlayersMultiactive($players, $next_state, $bExclusive = false) { } - function setPlayerNonMultiactive($player_id, $next_state) { + function setPlayerNonMultiactive(string $player_id, string $next_state) { } public function isMutiactiveState() { @@ -173,7 +173,7 @@ public function isPlayerActive($player_id) { function updateMultiactiveOrNextState($next_state_if_none) { } - function nextState($transition) { + function nextState(string $transition) { $x = $this->getStateNumberByTransition($transition); $this->jumpToState($x); } @@ -307,7 +307,7 @@ function loadPlayersBasicInfos() { return $values; } - protected function getCurrentPlayerId() { + protected function getCurrentPlayerId(): string { return 1; } @@ -342,13 +342,13 @@ function eliminatePlayer($player_id) { * Setup correspondance "labels to id" * @param [] $labels - map string -> int (label of state variable -> numeric id in the database) */ - function initGameStateLabels($labels) { + function initGameStateLabels(array $labels) { } function setGameStateInitialValue(string $value_label, int $value_value) { } - function getGameStateValue($value_label, int $def = null) { + function getGameStateValue(string $value_label, int $def = null): int { return 0; } @@ -466,14 +466,14 @@ function getPlayersNumber() { return 2; } - function reattributeColorsBasedOnPreferences($players, $colors) { + function reattributeColorsBasedOnPreferences(array $players, array $colors) { } function reloadPlayersBasicInfos() { } - function getNew($deck_definition): object { - return null; + protected function getNew(string $deck_definition): Deck { + return new Deck(); } // Give standard extra time to this player @@ -489,7 +489,7 @@ function applyDbUpgradeToAllDB($sql) { } - function getGameinfos() { + function getGameinfos(): array { unset($gameinfos); require('gameinfos.inc.php'); if (isset($gameinfos)) {