Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions misc/module/common/deck.game.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -46,7 +46,7 @@ function init($table) {
// "nbr" => <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;
}

Expand All @@ -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) {

}

Expand Down
22 changes: 11 additions & 11 deletions misc/module/table/table.game.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand All @@ -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();
}
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -307,7 +307,7 @@ function loadPlayersBasicInfos() {
return $values;
}

protected function getCurrentPlayerId() {
protected function getCurrentPlayerId(): string {
return 1;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
Expand All @@ -489,7 +489,7 @@ function applyDbUpgradeToAllDB($sql) {
}


function getGameinfos() {
function getGameinfos(): array {
unset($gameinfos);
require('gameinfos.inc.php');
if (isset($gameinfos)) {
Expand Down