From b933171883f32f5c5b6c0b23d46964bae1a0dd46 Mon Sep 17 00:00:00 2001 From: user Date: Tue, 2 Aug 2022 21:13:30 +0000 Subject: [PATCH 01/11] fixed: if planet is unnamed, page titles look incomplete, like 'Bauhof des Planeten ' (without any name after) --- htdocs/content/buildings.php | 2 +- htdocs/content/bunker.php | 2 +- htdocs/content/crypto.php | 4 ++-- htdocs/content/defense.php | 4 ++-- htdocs/content/economy.php | 2 +- htdocs/content/haven.php | 2 +- htdocs/content/market.php | 2 +- htdocs/content/missiles.php | 4 ++-- htdocs/content/population.php | 2 +- htdocs/content/recycle.php | 2 +- htdocs/content/research.php | 4 ++-- htdocs/content/shipyard.php | 2 +- htdocs/content/techtree.php | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/content/buildings.php b/htdocs/content/buildings.php index e424bb8ae..e616dadce 100644 --- a/htdocs/content/buildings.php +++ b/htdocs/content/buildings.php @@ -54,7 +54,7 @@ if (isset($cp)) { $planet = $planetRepo->find($cp->id); - echo "

Bauhof des Planeten " . $planet->name . "

"; + echo "

Bauhof" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/bunker.php b/htdocs/content/bunker.php index 31ef8d4e2..aed720201 100644 --- a/htdocs/content/bunker.php +++ b/htdocs/content/bunker.php @@ -31,7 +31,7 @@ if ($cp) { $planet = $planetRepo->find($cp->id); - echo "

Bunker des Planeten " . $planet->name . "

"; + echo "

Bunker" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/crypto.php b/htdocs/content/crypto.php index e7a4fc76f..6fb94da0e 100644 --- a/htdocs/content/crypto.php +++ b/htdocs/content/crypto.php @@ -184,13 +184,13 @@ function applyBookmark() countDown("cdcd", $userCooldown); } } else { - echo "

Kryptocenter des Planeten " . $planet->name . "

"; + echo "

Kryptocenter" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); info_msg("Das Kryptocenter wurde noch nicht gebaut!"); } } else { - echo "

Kryptocenter des Planeten " . $planet->name . "

"; + echo "

Kryptocenter" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); info_msg("Aufgrund eines intergalaktischen Moratoriums der Völkerföderation der Galaxie Andromeda diff --git a/htdocs/content/defense.php b/htdocs/content/defense.php index d15cd7d12..986585c8c 100644 --- a/htdocs/content/defense.php +++ b/htdocs/content/defense.php @@ -94,7 +94,7 @@ $peopleWorking = $buildingRepository->getPeopleWorking($planet->id); // Titel - echo "

Waffenfabrik (Stufe " . $factoryBuilding->currentLevel . ") des Planeten " . $planet->name . "

"; + echo "

Waffenfabrik (Stufe " . $factoryBuilding->currentLevel . ")" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; // Ressourcen anzeigen echo $resourceBoxDrawer->getHTML($planet); @@ -1055,7 +1055,7 @@ } } else { // Titel - echo "

Waffenfabrik des Planeten " . $planet->name . "

"; + echo "

Waffenfabrik" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; // Ressourcen anzeigen echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/economy.php b/htdocs/content/economy.php index 52a744aa7..0c6753c1e 100644 --- a/htdocs/content/economy.php +++ b/htdocs/content/economy.php @@ -72,7 +72,7 @@ } } - echo "

Wirtschaft des Planeten " . $planet->name . "

"; + echo "

Wirtschaft" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); if (isset($_GET['action']) && $_GET['action'] == "update") { diff --git a/htdocs/content/haven.php b/htdocs/content/haven.php index e7ad82330..8b5318033 100644 --- a/htdocs/content/haven.php +++ b/htdocs/content/haven.php @@ -33,7 +33,7 @@ if ($cp) { $planet = $planetRepo->find($cp->id); - echo '

Raumschiffhafen des Planeten ' . $planet->name . '

'; + echo "

Raumschiffhafen" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); if (!$cu->isVerified) { diff --git a/htdocs/content/market.php b/htdocs/content/market.php index 54c57e258..7da2cd79a 100644 --- a/htdocs/content/market.php +++ b/htdocs/content/market.php @@ -72,7 +72,7 @@ define("MARKET_TAX", max(1, MARKET_SELL_TAX * ($specialist !== null ? $specialist->tradeBonus : 1))); // Show title - echo '

Marktplatz (Stufe ' . $market->currentLevel . ') des Planeten ' . $planet->name . '

'; + echo "

Marktplatz (Stufe " . $market->currentLevel . ")" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); if (!$market->isDeactivated()) { diff --git a/htdocs/content/missiles.php b/htdocs/content/missiles.php index b11b68fd4..910eb6619 100644 --- a/htdocs/content/missiles.php +++ b/htdocs/content/missiles.php @@ -71,7 +71,7 @@ $max_flights = $missileBuilding->currentLevel * MISSILE_SILO_FLIGHTS_PER_LEVEL; // Titel - echo "

Raketensilo (Stufe " . $missileBuilding->currentLevel . ") des Planeten " . $planet->name . "

"; + echo "

Raketensilo (Stufe " . $missileBuilding->currentLevel . ")" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; // Ressourcen anzeigen echo $resourceBoxDrawer->getHTML($planet); @@ -733,7 +733,7 @@ function applyBookmark() } } else { // Titel - echo "

Raketensilo des Planeten " . $planet->name . "

"; + echo "

Raketensilo" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; // Ressourcen anzeigen echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/population.php b/htdocs/content/population.php index 77a105391..3f9aafb95 100644 --- a/htdocs/content/population.php +++ b/htdocs/content/population.php @@ -36,7 +36,7 @@ if ($cp) { $planet = $planetRepo->find($cp->id); - echo '

Bevölkerungsübersicht des Planeten ' . $planet->name . '

'; + echo "

Bevölkerungsübersicht" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; echo '
'; // Nur zu testzwecken echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/recycle.php b/htdocs/content/recycle.php index 743e15b5c..1a4241b5c 100644 --- a/htdocs/content/recycle.php +++ b/htdocs/content/recycle.php @@ -44,7 +44,7 @@ $planet = $planetRepo->find($cp->id); -echo "

Recyclingstation des Planeten " . $planet->name . "

"; +echo "

Recyclingstation" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); //Recycling Level laden diff --git a/htdocs/content/research.php b/htdocs/content/research.php index e1b3a263f..7d4688419 100644 --- a/htdocs/content/research.php +++ b/htdocs/content/research.php @@ -67,7 +67,7 @@ $minBuildTimeFactor = (0.1 - (GEN_TECH_LEVEL / 100)); // Überschrift - echo "

Forschungslabor (Stufe " . $researchBuilding->currentLevel . ") des Planeten " . $planet->name . "

"; + echo "

Forschungslabor (Stufe " . $researchBuilding->currentLevel . ")" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); // Forschungsliste laden && Gentech level definieren @@ -922,7 +922,7 @@ function setCountdown() } } } else { - echo "

Forschungslabor des Planeten " . $planet->name . "

"; + echo "

Forschungslabor" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); info_msg("Das Forschungslabor wurde noch nicht gebaut!"); } diff --git a/htdocs/content/shipyard.php b/htdocs/content/shipyard.php index 19c66594a..2423371e3 100644 --- a/htdocs/content/shipyard.php +++ b/htdocs/content/shipyard.php @@ -1085,7 +1085,7 @@ } } else { // Titel - echo "

Raumschiffswerft des Planeten " . $planet->name . "

"; + echo "

Raumschiffswerft" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; // Ressourcen anzeigen echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/techtree.php b/htdocs/content/techtree.php index c6e508b7a..f62d2d217 100644 --- a/htdocs/content/techtree.php +++ b/htdocs/content/techtree.php @@ -137,7 +137,7 @@ if (isset($cp)) { // Daten anzeigen - echo "

Technikbaum des Planeten " . $cp->name() . "

"; + echo "

Technikbaum" . ($cp->name() ? " des Planeten " . $cp->name() : "") . "

"; // Tab-Navigation anzeigen show_tab_menu("mode", array( From 870d57c4aae8a85f0d4e61bd246d329960954b06 Mon Sep 17 00:00:00 2001 From: user Date: Tue, 2 Aug 2022 21:28:21 +0000 Subject: [PATCH 02/11] fixed linter errors, using empty() for string checking --- htdocs/content/buildings.php | 2 +- htdocs/content/bunker.php | 2 +- htdocs/content/crypto.php | 4 ++-- htdocs/content/defense.php | 4 ++-- htdocs/content/economy.php | 2 +- htdocs/content/haven.php | 2 +- htdocs/content/market.php | 2 +- htdocs/content/missiles.php | 4 ++-- htdocs/content/population.php | 2 +- htdocs/content/recycle.php | 2 +- htdocs/content/research.php | 4 ++-- htdocs/content/shipyard.php | 2 +- htdocs/content/techtree.php | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/content/buildings.php b/htdocs/content/buildings.php index e616dadce..c2d0edfb0 100644 --- a/htdocs/content/buildings.php +++ b/htdocs/content/buildings.php @@ -54,7 +54,7 @@ if (isset($cp)) { $planet = $planetRepo->find($cp->id); - echo "

Bauhof" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; + echo "

Bauhof" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/bunker.php b/htdocs/content/bunker.php index aed720201..b03b71cd4 100644 --- a/htdocs/content/bunker.php +++ b/htdocs/content/bunker.php @@ -31,7 +31,7 @@ if ($cp) { $planet = $planetRepo->find($cp->id); - echo "

Bunker" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; + echo "

Bunker" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/crypto.php b/htdocs/content/crypto.php index 6fb94da0e..75d406c4d 100644 --- a/htdocs/content/crypto.php +++ b/htdocs/content/crypto.php @@ -184,13 +184,13 @@ function applyBookmark() countDown("cdcd", $userCooldown); } } else { - echo "

Kryptocenter" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; + echo "

Kryptocenter" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); info_msg("Das Kryptocenter wurde noch nicht gebaut!"); } } else { - echo "

Kryptocenter" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; + echo "

Kryptocenter" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); info_msg("Aufgrund eines intergalaktischen Moratoriums der Völkerföderation der Galaxie Andromeda diff --git a/htdocs/content/defense.php b/htdocs/content/defense.php index 986585c8c..8eb424cc7 100644 --- a/htdocs/content/defense.php +++ b/htdocs/content/defense.php @@ -94,7 +94,7 @@ $peopleWorking = $buildingRepository->getPeopleWorking($planet->id); // Titel - echo "

Waffenfabrik (Stufe " . $factoryBuilding->currentLevel . ")" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; + echo "

Waffenfabrik (Stufe " . $factoryBuilding->currentLevel . ")" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; // Ressourcen anzeigen echo $resourceBoxDrawer->getHTML($planet); @@ -1055,7 +1055,7 @@ } } else { // Titel - echo "

Waffenfabrik" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; + echo "

Waffenfabrik" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; // Ressourcen anzeigen echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/economy.php b/htdocs/content/economy.php index 0c6753c1e..1c6ce27b9 100644 --- a/htdocs/content/economy.php +++ b/htdocs/content/economy.php @@ -72,7 +72,7 @@ } } - echo "

Wirtschaft" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; + echo "

Wirtschaft" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); if (isset($_GET['action']) && $_GET['action'] == "update") { diff --git a/htdocs/content/haven.php b/htdocs/content/haven.php index 8b5318033..53e4ae43d 100644 --- a/htdocs/content/haven.php +++ b/htdocs/content/haven.php @@ -33,7 +33,7 @@ if ($cp) { $planet = $planetRepo->find($cp->id); - echo "

Raumschiffhafen" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; + echo "

Raumschiffhafen" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); if (!$cu->isVerified) { diff --git a/htdocs/content/market.php b/htdocs/content/market.php index 7da2cd79a..fe96bd83e 100644 --- a/htdocs/content/market.php +++ b/htdocs/content/market.php @@ -72,7 +72,7 @@ define("MARKET_TAX", max(1, MARKET_SELL_TAX * ($specialist !== null ? $specialist->tradeBonus : 1))); // Show title - echo "

Marktplatz (Stufe " . $market->currentLevel . ")" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; + echo "

Marktplatz (Stufe " . $market->currentLevel . ")" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); if (!$market->isDeactivated()) { diff --git a/htdocs/content/missiles.php b/htdocs/content/missiles.php index 910eb6619..dc1b44e95 100644 --- a/htdocs/content/missiles.php +++ b/htdocs/content/missiles.php @@ -71,7 +71,7 @@ $max_flights = $missileBuilding->currentLevel * MISSILE_SILO_FLIGHTS_PER_LEVEL; // Titel - echo "

Raketensilo (Stufe " . $missileBuilding->currentLevel . ")" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; + echo "

Raketensilo (Stufe " . $missileBuilding->currentLevel . ")" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; // Ressourcen anzeigen echo $resourceBoxDrawer->getHTML($planet); @@ -733,7 +733,7 @@ function applyBookmark() } } else { // Titel - echo "

Raketensilo" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; + echo "

Raketensilo" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; // Ressourcen anzeigen echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/population.php b/htdocs/content/population.php index 3f9aafb95..2fa58a939 100644 --- a/htdocs/content/population.php +++ b/htdocs/content/population.php @@ -36,7 +36,7 @@ if ($cp) { $planet = $planetRepo->find($cp->id); - echo "

Bevölkerungsübersicht" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; + echo "

Bevölkerungsübersicht" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo '
'; // Nur zu testzwecken echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/recycle.php b/htdocs/content/recycle.php index 1a4241b5c..3f40bea7e 100644 --- a/htdocs/content/recycle.php +++ b/htdocs/content/recycle.php @@ -44,7 +44,7 @@ $planet = $planetRepo->find($cp->id); -echo "

Recyclingstation" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; +echo "

Recyclingstation" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); //Recycling Level laden diff --git a/htdocs/content/research.php b/htdocs/content/research.php index 7d4688419..1165d56cf 100644 --- a/htdocs/content/research.php +++ b/htdocs/content/research.php @@ -67,7 +67,7 @@ $minBuildTimeFactor = (0.1 - (GEN_TECH_LEVEL / 100)); // Überschrift - echo "

Forschungslabor (Stufe " . $researchBuilding->currentLevel . ")" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; + echo "

Forschungslabor (Stufe " . $researchBuilding->currentLevel . ")" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); // Forschungsliste laden && Gentech level definieren @@ -922,7 +922,7 @@ function setCountdown() } } } else { - echo "

Forschungslabor" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; + echo "

Forschungslabor" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); info_msg("Das Forschungslabor wurde noch nicht gebaut!"); } diff --git a/htdocs/content/shipyard.php b/htdocs/content/shipyard.php index 2423371e3..36e643567 100644 --- a/htdocs/content/shipyard.php +++ b/htdocs/content/shipyard.php @@ -1085,7 +1085,7 @@ } } else { // Titel - echo "

Raumschiffswerft" . ($planet->name ? " des Planeten " . $planet->name : "") . "

"; + echo "

Raumschiffswerft" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; // Ressourcen anzeigen echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/techtree.php b/htdocs/content/techtree.php index f62d2d217..b3789a194 100644 --- a/htdocs/content/techtree.php +++ b/htdocs/content/techtree.php @@ -137,7 +137,7 @@ if (isset($cp)) { // Daten anzeigen - echo "

Technikbaum" . ($cp->name() ? " des Planeten " . $cp->name() : "") . "

"; + echo "

Technikbaum" . (!empty($cp->name()) ? " des Planeten " . $cp->name() : "") . "

"; // Tab-Navigation anzeigen show_tab_menu("mode", array( From f93ab74e5bd2757483c5584325d155bc6d64e439 Mon Sep 17 00:00:00 2001 From: user Date: Fri, 9 Sep 2022 17:07:07 +0000 Subject: [PATCH 03/11] added strict null or zerolength string checking helper function --- src/Support/StringUtils.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Support/StringUtils.php b/src/Support/StringUtils.php index 9ed0f9389..a46debe6d 100644 --- a/src/Support/StringUtils.php +++ b/src/Support/StringUtils.php @@ -404,4 +404,9 @@ public static function hasAlphaDotsOrUnderlines(string $str): bool { return ctype_alpha(str_replace('_', '', str_replace('.', '', $str))); } + + public static function empty_strict(string $str): bool + { + return $str === null || $str === ''; + } } From 3cdb251f11dfe6f054eb7e54b41a9bace1431682 Mon Sep 17 00:00:00 2001 From: user Date: Fri, 9 Sep 2022 18:33:09 +0000 Subject: [PATCH 04/11] replaced builtin empty() with more strict checker function --- htdocs/content/buildings.php | 2 +- htdocs/content/bunker.php | 2 +- htdocs/content/crypto.php | 4 ++-- htdocs/content/defense.php | 4 ++-- htdocs/content/economy.php | 2 +- htdocs/content/haven.php | 2 +- htdocs/content/market.php | 2 +- htdocs/content/missiles.php | 4 ++-- htdocs/content/population.php | 2 +- htdocs/content/recycle.php | 2 +- htdocs/content/research.php | 4 ++-- htdocs/content/shipyard.php | 2 +- htdocs/content/techtree.php | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/content/buildings.php b/htdocs/content/buildings.php index c2d0edfb0..ce40da47a 100644 --- a/htdocs/content/buildings.php +++ b/htdocs/content/buildings.php @@ -54,7 +54,7 @@ if (isset($cp)) { $planet = $planetRepo->find($cp->id); - echo "

Bauhof" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; + echo "

Bauhof" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/bunker.php b/htdocs/content/bunker.php index b03b71cd4..68c4a6a02 100644 --- a/htdocs/content/bunker.php +++ b/htdocs/content/bunker.php @@ -31,7 +31,7 @@ if ($cp) { $planet = $planetRepo->find($cp->id); - echo "

Bunker" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; + echo "

Bunker" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/crypto.php b/htdocs/content/crypto.php index 75d406c4d..2821756ea 100644 --- a/htdocs/content/crypto.php +++ b/htdocs/content/crypto.php @@ -184,13 +184,13 @@ function applyBookmark() countDown("cdcd", $userCooldown); } } else { - echo "

Kryptocenter" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; + echo "

Kryptocenter" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); info_msg("Das Kryptocenter wurde noch nicht gebaut!"); } } else { - echo "

Kryptocenter" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; + echo "

Kryptocenter" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); info_msg("Aufgrund eines intergalaktischen Moratoriums der Völkerföderation der Galaxie Andromeda diff --git a/htdocs/content/defense.php b/htdocs/content/defense.php index 8eb424cc7..4c5419c33 100644 --- a/htdocs/content/defense.php +++ b/htdocs/content/defense.php @@ -94,7 +94,7 @@ $peopleWorking = $buildingRepository->getPeopleWorking($planet->id); // Titel - echo "

Waffenfabrik (Stufe " . $factoryBuilding->currentLevel . ")" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; + echo "

Waffenfabrik (Stufe " . $factoryBuilding->currentLevel . ")" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; // Ressourcen anzeigen echo $resourceBoxDrawer->getHTML($planet); @@ -1055,7 +1055,7 @@ } } else { // Titel - echo "

Waffenfabrik" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; + echo "

Waffenfabrik" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; // Ressourcen anzeigen echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/economy.php b/htdocs/content/economy.php index 1c6ce27b9..36e267d40 100644 --- a/htdocs/content/economy.php +++ b/htdocs/content/economy.php @@ -72,7 +72,7 @@ } } - echo "

Wirtschaft" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; + echo "

Wirtschaft" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); if (isset($_GET['action']) && $_GET['action'] == "update") { diff --git a/htdocs/content/haven.php b/htdocs/content/haven.php index 53e4ae43d..1a6497e3c 100644 --- a/htdocs/content/haven.php +++ b/htdocs/content/haven.php @@ -33,7 +33,7 @@ if ($cp) { $planet = $planetRepo->find($cp->id); - echo "

Raumschiffhafen" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; + echo "

Raumschiffhafen" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); if (!$cu->isVerified) { diff --git a/htdocs/content/market.php b/htdocs/content/market.php index fe96bd83e..7c305ea75 100644 --- a/htdocs/content/market.php +++ b/htdocs/content/market.php @@ -72,7 +72,7 @@ define("MARKET_TAX", max(1, MARKET_SELL_TAX * ($specialist !== null ? $specialist->tradeBonus : 1))); // Show title - echo "

Marktplatz (Stufe " . $market->currentLevel . ")" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; + echo "

Marktplatz (Stufe " . $market->currentLevel . ")" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); if (!$market->isDeactivated()) { diff --git a/htdocs/content/missiles.php b/htdocs/content/missiles.php index dc1b44e95..1521ce659 100644 --- a/htdocs/content/missiles.php +++ b/htdocs/content/missiles.php @@ -71,7 +71,7 @@ $max_flights = $missileBuilding->currentLevel * MISSILE_SILO_FLIGHTS_PER_LEVEL; // Titel - echo "

Raketensilo (Stufe " . $missileBuilding->currentLevel . ")" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; + echo "

Raketensilo (Stufe " . $missileBuilding->currentLevel . ")" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; // Ressourcen anzeigen echo $resourceBoxDrawer->getHTML($planet); @@ -733,7 +733,7 @@ function applyBookmark() } } else { // Titel - echo "

Raketensilo" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; + echo "

Raketensilo" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; // Ressourcen anzeigen echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/population.php b/htdocs/content/population.php index 2fa58a939..c6ee539eb 100644 --- a/htdocs/content/population.php +++ b/htdocs/content/population.php @@ -36,7 +36,7 @@ if ($cp) { $planet = $planetRepo->find($cp->id); - echo "

Bevölkerungsübersicht" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; + echo "

Bevölkerungsübersicht" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo '
'; // Nur zu testzwecken echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/recycle.php b/htdocs/content/recycle.php index 3f40bea7e..df54fdc0f 100644 --- a/htdocs/content/recycle.php +++ b/htdocs/content/recycle.php @@ -44,7 +44,7 @@ $planet = $planetRepo->find($cp->id); -echo "

Recyclingstation" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; +echo "

Recyclingstation" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); //Recycling Level laden diff --git a/htdocs/content/research.php b/htdocs/content/research.php index 1165d56cf..652f39214 100644 --- a/htdocs/content/research.php +++ b/htdocs/content/research.php @@ -67,7 +67,7 @@ $minBuildTimeFactor = (0.1 - (GEN_TECH_LEVEL / 100)); // Überschrift - echo "

Forschungslabor (Stufe " . $researchBuilding->currentLevel . ")" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; + echo "

Forschungslabor (Stufe " . $researchBuilding->currentLevel . ")" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); // Forschungsliste laden && Gentech level definieren @@ -922,7 +922,7 @@ function setCountdown() } } } else { - echo "

Forschungslabor" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; + echo "

Forschungslabor" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); info_msg("Das Forschungslabor wurde noch nicht gebaut!"); } diff --git a/htdocs/content/shipyard.php b/htdocs/content/shipyard.php index 36e643567..352b310ad 100644 --- a/htdocs/content/shipyard.php +++ b/htdocs/content/shipyard.php @@ -1085,7 +1085,7 @@ } } else { // Titel - echo "

Raumschiffswerft" . (!empty($planet->name) ? " des Planeten " . $planet->name : "") . "

"; + echo "

Raumschiffswerft" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; // Ressourcen anzeigen echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/techtree.php b/htdocs/content/techtree.php index b3789a194..30ddf1359 100644 --- a/htdocs/content/techtree.php +++ b/htdocs/content/techtree.php @@ -137,7 +137,7 @@ if (isset($cp)) { // Daten anzeigen - echo "

Technikbaum" . (!empty($cp->name()) ? " des Planeten " . $cp->name() : "") . "

"; + echo "

Technikbaum" . (!StringUtils::empty_strict($cp->name()) ? " des Planeten " . $cp->name() : "") . "

"; // Tab-Navigation anzeigen show_tab_menu("mode", array( From 7f3764a3b18939d5a97f8b332d92e5ca8adf99cf Mon Sep 17 00:00:00 2001 From: user Date: Fri, 9 Sep 2022 18:37:02 +0000 Subject: [PATCH 05/11] added missing stringutils class use refs --- htdocs/content/haven.php | 1 + htdocs/content/techtree.php | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/content/haven.php b/htdocs/content/haven.php index 1a6497e3c..b46e65cff 100644 --- a/htdocs/content/haven.php +++ b/htdocs/content/haven.php @@ -7,6 +7,7 @@ use EtoA\Ship\ShipRepository; use EtoA\Ship\ShipTransformRepository; use EtoA\Support\BBCodeUtils; +use EtoA\Support\StringUtils; use EtoA\UI\ResourceBoxDrawer; use EtoA\Universe\Planet\PlanetRepository; diff --git a/htdocs/content/techtree.php b/htdocs/content/techtree.php index 30ddf1359..7f4b20561 100644 --- a/htdocs/content/techtree.php +++ b/htdocs/content/techtree.php @@ -24,6 +24,7 @@ use EtoA\Technology\TechnologyRepository; use EtoA\Technology\TechnologyRequirementRepository; use EtoA\Technology\TechnologyTypeRepository; +use EtoA\Support\StringUtils; /** @var BuildingDataRepository $buildRepository */ $buildRepository = $app[BuildingDataRepository::class]; From b2ffa2cc6f9485923922c0fc2900bdde7b75f7f7 Mon Sep 17 00:00:00 2001 From: user Date: Fri, 9 Sep 2022 18:45:32 +0000 Subject: [PATCH 06/11] change type hint to nullable --- src/Support/StringUtils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Support/StringUtils.php b/src/Support/StringUtils.php index a46debe6d..2f71df7e2 100644 --- a/src/Support/StringUtils.php +++ b/src/Support/StringUtils.php @@ -405,7 +405,7 @@ public static function hasAlphaDotsOrUnderlines(string $str): bool return ctype_alpha(str_replace('_', '', str_replace('.', '', $str))); } - public static function empty_strict(string $str): bool + public static function empty_strict(?string $str): bool { return $str === null || $str === ''; } From 36abb7f69d03bbcc7bab09d39f3da035ff2f6d9f Mon Sep 17 00:00:00 2001 From: user Date: Fri, 9 Sep 2022 18:57:43 +0000 Subject: [PATCH 07/11] testfix null planet for buildings.php --- htdocs/content/buildings.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/content/buildings.php b/htdocs/content/buildings.php index ce40da47a..5412ec876 100644 --- a/htdocs/content/buildings.php +++ b/htdocs/content/buildings.php @@ -53,6 +53,10 @@ if (isset($cp)) { $planet = $planetRepo->find($cp->id); + if(null === $planet) + { + return; + } echo "

Bauhof" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; From ddf7c006aa834fe9289a7c3d3433e7174e8765dc Mon Sep 17 00:00:00 2001 From: user Date: Sat, 10 Sep 2022 12:55:05 +0000 Subject: [PATCH 08/11] null checks for all planet vars --- htdocs/content/bunker.php | 4 ++++ htdocs/content/crypto.php | 5 +++++ htdocs/content/defense.php | 4 ++++ htdocs/content/economy.php | 4 ++++ htdocs/content/haven.php | 4 ++++ htdocs/content/market.php | 4 ++++ htdocs/content/missiles.php | 5 +++++ htdocs/content/population.php | 4 ++++ htdocs/content/recycle.php | 4 ++++ htdocs/content/research.php | 4 ++++ htdocs/content/shipyard.php | 4 ++++ 11 files changed, 46 insertions(+) diff --git a/htdocs/content/bunker.php b/htdocs/content/bunker.php index 68c4a6a02..beb559c53 100644 --- a/htdocs/content/bunker.php +++ b/htdocs/content/bunker.php @@ -30,6 +30,10 @@ if ($cp) { $planet = $planetRepo->find($cp->id); + if(null === $planet) + { + return; + } echo "

Bunker" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; diff --git a/htdocs/content/crypto.php b/htdocs/content/crypto.php index 2821756ea..22cb7f315 100644 --- a/htdocs/content/crypto.php +++ b/htdocs/content/crypto.php @@ -52,6 +52,11 @@ $request = Request::createFromGlobals(); $planet = $planetRepository->find($cp->id); +if(null === $planet) +{ + return; +} + $currentUser = $userRepository->getUser($cu->id); // Gebäude Level und Arbeiter laden diff --git a/htdocs/content/defense.php b/htdocs/content/defense.php index 4c5419c33..5b40b3b0e 100644 --- a/htdocs/content/defense.php +++ b/htdocs/content/defense.php @@ -80,6 +80,10 @@ define("DEFQUEUE_CANCEL_END", $config->getFloat('defqueue_cancel_end')); $planet = $planetRepo->find($cp->id); +if(null === $planet) +{ + return; +} // BEGIN SKRIPT // diff --git a/htdocs/content/economy.php b/htdocs/content/economy.php index 36e267d40..e5e902b0d 100644 --- a/htdocs/content/economy.php +++ b/htdocs/content/economy.php @@ -47,6 +47,10 @@ if ($cp) { $planet = $planetRepo->find($cp->id); + if(null === $planet) + { + return; + } $race = $raceRespository->getRace($cu->raceId); /** @var SpecialistService $specialistService */ diff --git a/htdocs/content/haven.php b/htdocs/content/haven.php index b46e65cff..778b03065 100644 --- a/htdocs/content/haven.php +++ b/htdocs/content/haven.php @@ -33,6 +33,10 @@ if ($cp) { $planet = $planetRepo->find($cp->id); + if(null === $planet) + { + return; + } echo "

Raumschiffhafen" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/market.php b/htdocs/content/market.php index 7c305ea75..073283910 100644 --- a/htdocs/content/market.php +++ b/htdocs/content/market.php @@ -53,6 +53,10 @@ ********/ $planet = $planetRepo->find($cp->id); +if(null === $planet) +{ + return; +} if ($config->getBoolean('market_enabled')) { $mode = isset($_GET['mode']) ? $_GET['mode'] : ""; diff --git a/htdocs/content/missiles.php b/htdocs/content/missiles.php index 1521ce659..bfc9c7ab7 100644 --- a/htdocs/content/missiles.php +++ b/htdocs/content/missiles.php @@ -57,7 +57,12 @@ define("MISSILE_SILO_FLIGHTS_PER_LEVEL", $config->getInt('missile_silo_flights_per_level')); $planet = $planetRepo->find($cp->id); +if(null === $planet) +{ + return; +} +// TODO: needed? echo "
"; // Gebäude Level und Arbeiter laden diff --git a/htdocs/content/population.php b/htdocs/content/population.php index c6ee539eb..4e15e4a6f 100644 --- a/htdocs/content/population.php +++ b/htdocs/content/population.php @@ -35,6 +35,10 @@ if ($cp) { $planet = $planetRepo->find($cp->id); + if(null === $planet) + { + return; + } echo "

Bevölkerungsübersicht" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo '
'; // Nur zu testzwecken diff --git a/htdocs/content/recycle.php b/htdocs/content/recycle.php index df54fdc0f..446256459 100644 --- a/htdocs/content/recycle.php +++ b/htdocs/content/recycle.php @@ -43,6 +43,10 @@ define("RECYC_MAX_PAYBACK", $config->getFloat('recyc_max_payback')); $planet = $planetRepo->find($cp->id); +if(null === $planet) +{ + return; +} echo "

Recyclingstation" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "

"; echo $resourceBoxDrawer->getHTML($planet); diff --git a/htdocs/content/research.php b/htdocs/content/research.php index 652f39214..21d8edbb6 100644 --- a/htdocs/content/research.php +++ b/htdocs/content/research.php @@ -60,6 +60,10 @@ if (isset($cp)) { $planet = $planetRepo->find($cp->id); + if(null === $planet) + { + return; + } $researchBuilding = $buildingRepository->getEntityBuilding($cu->getId(), $planet->id, BuildingId::TECHNOLOGY); if ($researchBuilding !== null && $researchBuilding->currentLevel > 0) { diff --git a/htdocs/content/shipyard.php b/htdocs/content/shipyard.php index 352b310ad..11bb7c83e 100644 --- a/htdocs/content/shipyard.php +++ b/htdocs/content/shipyard.php @@ -85,6 +85,10 @@ define("SHIPQUEUE_CANCEL_END", $config->getFloat('shipqueue_cancel_end')); $planet = $planetRepo->find($cp->id); +if(null === $planet) +{ + return; +} /** @var TechnologyRepository $technologyRepository */ $technologyRepository = $app[TechnologyRepository::class]; From fd6f7a7f34257efbdf84b2ce34679cd1c02052c1 Mon Sep 17 00:00:00 2001 From: user Date: Sat, 10 Sep 2022 13:06:38 +0000 Subject: [PATCH 09/11] attempted removal of now-obsolete phpstan msgs --- phpstan-baseline.neon | 50 ------------------------------------------- 1 file changed, 50 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a2eb5f085..3afafc351 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1185,21 +1185,6 @@ parameters: count: 1 path: htdocs/content/buddylist.php - - - message: "#^Cannot access property \\$id on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 4 - path: htdocs/content/buildings.php - - - - message: "#^Cannot access property \\$name on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/buildings.php - - - - message: "#^Cannot access property \\$people on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/buildings.php - - message: "#^If condition is always true\\.$#" count: 1 @@ -1210,11 +1195,6 @@ parameters: count: 1 path: htdocs/content/buildings.php - - - message: "#^Parameter \\#1 \\$planet of method EtoA\\\\UI\\\\ResourceBoxDrawer\\:\\:getHTML\\(\\) expects EtoA\\\\Universe\\\\Planet\\\\Planet, EtoA\\\\Universe\\\\Planet\\\\Planet\\|null given\\.$#" - count: 1 - path: htdocs/content/buildings.php - - message: "#^Variable \\$color might not be defined\\.$#" count: 1 @@ -1250,16 +1230,6 @@ parameters: count: 2 path: htdocs/content/bunker.php - - - message: "#^Cannot access property \\$id on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 8 - path: htdocs/content/bunker.php - - - - message: "#^Cannot access property \\$name on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/bunker.php - - message: "#^Cannot call method calculateBunkerFleetCount\\(\\) on EtoA\\\\Building\\\\Building\\|null\\.$#" count: 3 @@ -1275,11 +1245,6 @@ parameters: count: 3 path: htdocs/content/bunker.php - - - message: "#^Parameter \\#1 \\$planet of method EtoA\\\\UI\\\\ResourceBoxDrawer\\:\\:getHTML\\(\\) expects EtoA\\\\Universe\\\\Planet\\\\Planet, EtoA\\\\Universe\\\\Planet\\\\Planet\\|null given\\.$#" - count: 1 - path: htdocs/content/bunker.php - - message: "#^Cannot access property \\$id on EtoA\\\\Universe\\\\Cell\\\\Cell\\|null\\.$#" count: 2 @@ -1365,21 +1330,11 @@ parameters: count: 1 path: htdocs/content/crypto.php - - - message: "#^Cannot access property \\$id on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/crypto.php - - message: "#^Cannot access property \\$id on EtoA\\\\User\\\\User\\|null\\.$#" count: 4 path: htdocs/content/crypto.php - - - message: "#^Cannot access property \\$name on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/crypto.php - - message: "#^Cannot access property \\$nameWithTag on EtoA\\\\Alliance\\\\AllianceWithMemberCount\\|null\\.$#" count: 1 @@ -1390,11 +1345,6 @@ parameters: count: 1 path: htdocs/content/crypto.php - - - message: "#^Cannot access property \\$resFuel on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/crypto.php - - message: "#^Cannot access property \\$sx on EtoA\\\\Universe\\\\Entity\\\\Entity\\|null\\.$#" count: 1 From a5a3d0dbf5827b65e69d6f8c20f271bad580b642 Mon Sep 17 00:00:00 2001 From: user Date: Sat, 10 Sep 2022 13:13:48 +0000 Subject: [PATCH 10/11] phpstan fixes, part 2 --- phpstan-baseline.neon | 50 ------------------------------------------- 1 file changed, 50 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 3afafc351..9d2f33faa 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1370,61 +1370,11 @@ parameters: count: 1 path: htdocs/content/crypto.php - - - message: "#^Parameter \\#1 \\$planet of method EtoA\\\\UI\\\\ResourceBoxDrawer\\:\\:getHTML\\(\\) expects EtoA\\\\Universe\\\\Planet\\\\Planet, EtoA\\\\Universe\\\\Planet\\\\Planet\\|null given\\.$#" - count: 3 - path: htdocs/content/crypto.php - - - - message: "#^Parameter \\#2 \\$planet of method EtoA\\\\Fleet\\\\FleetScanService\\:\\:scanFleets\\(\\) expects EtoA\\\\Universe\\\\Planet\\\\Planet, EtoA\\\\Universe\\\\Planet\\\\Planet\\|null given\\.$#" - count: 1 - path: htdocs/content/crypto.php - - message: "#^Parameter \\#2 \\$user of method EtoA\\\\Alliance\\\\AllianceService\\:\\:getUserAlliancePermissions\\(\\) expects EtoA\\\\User\\\\User, EtoA\\\\User\\\\User\\|null given\\.$#" count: 1 path: htdocs/content/crypto.php - - - message: "#^Cannot access property \\$fields on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/defense.php - - - - message: "#^Cannot access property \\$fieldsExtra on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/defense.php - - - - message: "#^Cannot access property \\$fieldsUsed on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/defense.php - - - - message: "#^Cannot access property \\$id on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 15 - path: htdocs/content/defense.php - - - - message: "#^Cannot access property \\$name on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/defense.php - - - - message: "#^Cannot access property \\$people on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/defense.php - - - - message: "#^Cannot access property \\$prodCrystal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/defense.php - - - - message: "#^Cannot access property \\$prodFood on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/defense.php - - message: "#^Cannot access property \\$prodFuel on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" count: 2 From d049f5b59d9eeb28e18bed40a7b1ac8e4d91fe16 Mon Sep 17 00:00:00 2001 From: user Date: Sat, 10 Sep 2022 13:31:02 +0000 Subject: [PATCH 11/11] phpstan fixes, part 3 --- phpstan-baseline.neon | 445 ------------------------------------------ 1 file changed, 445 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 9d2f33faa..0205effdc 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1375,56 +1375,11 @@ parameters: count: 1 path: htdocs/content/crypto.php - - - message: "#^Cannot access property \\$prodFuel on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/defense.php - - - - message: "#^Cannot access property \\$prodMetal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/defense.php - - - - message: "#^Cannot access property \\$prodPlastic on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/defense.php - - - - message: "#^Cannot access property \\$resCrystal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 7 - path: htdocs/content/defense.php - - - - message: "#^Cannot access property \\$resFood on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 8 - path: htdocs/content/defense.php - - - - message: "#^Cannot access property \\$resFuel on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 7 - path: htdocs/content/defense.php - - - - message: "#^Cannot access property \\$resMetal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 7 - path: htdocs/content/defense.php - - - - message: "#^Cannot access property \\$resPlastic on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 7 - path: htdocs/content/defense.php - - message: "#^Parameter \\#1 \\$num of function floor expects float\\|int, float\\|false given\\.$#" count: 2 path: htdocs/content/defense.php - - - message: "#^Parameter \\#1 \\$planet of method EtoA\\\\UI\\\\ResourceBoxDrawer\\:\\:getHTML\\(\\) expects EtoA\\\\Universe\\\\Planet\\\\Planet, EtoA\\\\Universe\\\\Planet\\\\Planet\\|null given\\.$#" - count: 2 - path: htdocs/content/defense.php - - message: "#^Parameter \\#2 \\$timestamp of function date expects int\\|null, float\\|int given\\.$#" count: 1 @@ -1470,11 +1425,6 @@ parameters: count: 3 path: htdocs/content/economy.php - - - message: "#^Cannot access property \\$id on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 6 - path: htdocs/content/economy.php - - message: "#^Cannot access property \\$metal on EtoA\\\\Race\\\\Race\\|null\\.$#" count: 3 @@ -1490,11 +1440,6 @@ parameters: count: 1 path: htdocs/content/economy.php - - - message: "#^Cannot access property \\$name on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/economy.php - - message: "#^Cannot access property \\$plastic on EtoA\\\\Race\\\\Race\\|null\\.$#" count: 3 @@ -1510,91 +1455,16 @@ parameters: count: 3 path: htdocs/content/economy.php - - - message: "#^Cannot access property \\$prodPower on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 5 - path: htdocs/content/economy.php - - - - message: "#^Cannot access property \\$resCrystal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/economy.php - - - - message: "#^Cannot access property \\$resFood on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/economy.php - - - - message: "#^Cannot access property \\$resFuel on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/economy.php - - - - message: "#^Cannot access property \\$resMetal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/economy.php - - - - message: "#^Cannot access property \\$resPlastic on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/economy.php - - message: "#^Cannot access property \\$researchTime on EtoA\\\\Race\\\\Race\\|null\\.$#" count: 2 path: htdocs/content/economy.php - - - message: "#^Cannot access property \\$storeCrystal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/economy.php - - - - message: "#^Cannot access property \\$storeFood on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/economy.php - - - - message: "#^Cannot access property \\$storeFuel on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/economy.php - - - - message: "#^Cannot access property \\$storeMetal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/economy.php - - - - message: "#^Cannot access property \\$storePlastic on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/economy.php - - message: "#^Cannot call method calculateBunkerResources\\(\\) on EtoA\\\\Building\\\\Building\\|null\\.$#" count: 1 path: htdocs/content/economy.php - - - message: "#^Cannot call method fuelProductionBonus\\(\\) on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/economy.php - - - - message: "#^Cannot call method getFuelProductionBonusFactor\\(\\) on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/economy.php - - - - message: "#^Cannot call method solarPowerBonus\\(\\) on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/economy.php - - - - message: "#^Parameter \\#1 \\$planet of method EtoA\\\\UI\\\\ResourceBoxDrawer\\:\\:getHTML\\(\\) expects EtoA\\\\Universe\\\\Planet\\\\Planet, EtoA\\\\Universe\\\\Planet\\\\Planet\\|null given\\.$#" - count: 1 - path: htdocs/content/economy.php - - message: "#^Cannot access property \\$description on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" count: 3 @@ -1765,21 +1635,6 @@ parameters: count: 2 path: htdocs/content/fleets.php - - - message: "#^Cannot access property \\$id on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 9 - path: htdocs/content/haven.php - - - - message: "#^Cannot access property \\$name on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/haven.php - - - - message: "#^Parameter \\#1 \\$planet of method EtoA\\\\UI\\\\ResourceBoxDrawer\\:\\:getHTML\\(\\) expects EtoA\\\\Universe\\\\Planet\\\\Planet, EtoA\\\\Universe\\\\Planet\\\\Planet\\|null given\\.$#" - count: 1 - path: htdocs/content/haven.php - - message: "#^Parameter \\#1 \\$string of static method EtoA\\\\Support\\\\BBCodeUtils\\:\\:toHTML\\(\\) expects string\\|null, bool\\|float\\|int\\|string given\\.$#" count: 1 @@ -1800,21 +1655,6 @@ parameters: count: 1 path: htdocs/content/help.php - - - message: "#^Cannot access property \\$id on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/market.php - - - - message: "#^Cannot access property \\$name on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/market.php - - - - message: "#^Parameter \\#1 \\$planet of method EtoA\\\\UI\\\\ResourceBoxDrawer\\:\\:getHTML\\(\\) expects EtoA\\\\Universe\\\\Planet\\\\Planet, EtoA\\\\Universe\\\\Planet\\\\Planet\\|null given\\.$#" - count: 3 - path: htdocs/content/market.php - - message: "#^Variable \\$cstr might not be defined\\.$#" count: 2 @@ -1920,76 +1760,11 @@ parameters: count: 2 path: htdocs/content/missiles.php - - - message: "#^Cannot access property \\$id on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 11 - path: htdocs/content/missiles.php - - - - message: "#^Cannot access property \\$name on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/missiles.php - - message: "#^Cannot access property \\$pos on EtoA\\\\Universe\\\\Entity\\\\Entity\\|null\\.$#" count: 2 path: htdocs/content/missiles.php - - - message: "#^Cannot access property \\$prodCrystal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/missiles.php - - - - message: "#^Cannot access property \\$prodFood on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/missiles.php - - - - message: "#^Cannot access property \\$prodFuel on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/missiles.php - - - - message: "#^Cannot access property \\$prodMetal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/missiles.php - - - - message: "#^Cannot access property \\$prodPlastic on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/missiles.php - - - - message: "#^Cannot access property \\$prodPower on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/missiles.php - - - - message: "#^Cannot access property \\$resCrystal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 4 - path: htdocs/content/missiles.php - - - - message: "#^Cannot access property \\$resFood on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 4 - path: htdocs/content/missiles.php - - - - message: "#^Cannot access property \\$resFuel on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 4 - path: htdocs/content/missiles.php - - - - message: "#^Cannot access property \\$resMetal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 4 - path: htdocs/content/missiles.php - - - - message: "#^Cannot access property \\$resPlastic on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 4 - path: htdocs/content/missiles.php - - message: "#^Cannot access property \\$sx on EtoA\\\\Universe\\\\Entity\\\\Entity\\|null\\.$#" count: 2 @@ -2000,21 +1775,11 @@ parameters: count: 2 path: htdocs/content/missiles.php - - - message: "#^Cannot access property \\$usePower on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/missiles.php - - message: "#^If condition is always false\\.$#" count: 1 path: htdocs/content/missiles.php - - - message: "#^Parameter \\#1 \\$planet of method EtoA\\\\UI\\\\ResourceBoxDrawer\\:\\:getHTML\\(\\) expects EtoA\\\\Universe\\\\Planet\\\\Planet, EtoA\\\\Universe\\\\Planet\\\\Planet\\|null given\\.$#" - count: 2 - path: htdocs/content/missiles.php - - message: "#^Parameter \\#1 \\$string of function stripslashes expects string, string\\|null given\\.$#" count: 1 @@ -2230,31 +1995,11 @@ parameters: count: 1 path: htdocs/content/planetstats.php - - - message: "#^Cannot access property \\$id on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 12 - path: htdocs/content/population.php - - message: "#^Cannot access property \\$name on EtoA\\\\Race\\\\Race\\|null\\.$#" count: 1 path: htdocs/content/population.php - - - message: "#^Cannot access property \\$name on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/population.php - - - - message: "#^Cannot access property \\$people on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 6 - path: htdocs/content/population.php - - - - message: "#^Cannot access property \\$peoplePlace on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/population.php - - message: "#^Cannot access property \\$population on EtoA\\\\Race\\\\Race\\|null\\.$#" count: 3 @@ -2265,56 +2010,11 @@ parameters: count: 1 path: htdocs/content/population.php - - - message: "#^Parameter \\#1 \\$planet of method EtoA\\\\UI\\\\ResourceBoxDrawer\\:\\:getHTML\\(\\) expects EtoA\\\\Universe\\\\Planet\\\\Planet, EtoA\\\\Universe\\\\Planet\\\\Planet\\|null given\\.$#" - count: 1 - path: htdocs/content/population.php - - - - message: "#^Cannot access property \\$id on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 10 - path: htdocs/content/recycle.php - - - - message: "#^Cannot access property \\$name on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 3 - path: htdocs/content/recycle.php - - - - message: "#^Cannot access property \\$resCrystal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/recycle.php - - - - message: "#^Cannot access property \\$resFood on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/recycle.php - - - - message: "#^Cannot access property \\$resFuel on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/recycle.php - - - - message: "#^Cannot access property \\$resMetal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/recycle.php - - - - message: "#^Cannot access property \\$resPlastic on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/recycle.php - - message: "#^Parameter \\#1 \\$defenseId of class EtoA\\\\Defense\\\\Event\\\\DefenseRecycle constructor expects int, int\\|string given\\.$#" count: 1 path: htdocs/content/recycle.php - - - message: "#^Parameter \\#1 \\$planet of method EtoA\\\\UI\\\\ResourceBoxDrawer\\:\\:getHTML\\(\\) expects EtoA\\\\Universe\\\\Planet\\\\Planet, EtoA\\\\Universe\\\\Planet\\\\Planet\\|null given\\.$#" - count: 1 - path: htdocs/content/recycle.php - - message: "#^Parameter \\#2 \\$amount of method EtoA\\\\Defense\\\\DefenseRepository\\:\\:removeDefense\\(\\) expects int, float\\|int given\\.$#" count: 1 @@ -2340,71 +2040,6 @@ parameters: count: 1 path: htdocs/content/recycle.php - - - message: "#^Cannot access property \\$id on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 16 - path: htdocs/content/research.php - - - - message: "#^Cannot access property \\$name on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/research.php - - - - message: "#^Cannot access property \\$people on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/research.php - - - - message: "#^Cannot access property \\$prodCrystal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/research.php - - - - message: "#^Cannot access property \\$prodFood on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/research.php - - - - message: "#^Cannot access property \\$prodFuel on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/research.php - - - - message: "#^Cannot access property \\$prodMetal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/research.php - - - - message: "#^Cannot access property \\$prodPlastic on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/research.php - - - - message: "#^Cannot access property \\$resCrystal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 8 - path: htdocs/content/research.php - - - - message: "#^Cannot access property \\$resFood on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 9 - path: htdocs/content/research.php - - - - message: "#^Cannot access property \\$resFuel on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 8 - path: htdocs/content/research.php - - - - message: "#^Cannot access property \\$resMetal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 8 - path: htdocs/content/research.php - - - - message: "#^Cannot access property \\$resPlastic on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 8 - path: htdocs/content/research.php - - message: "#^Cannot access property \\$researchTime on EtoA\\\\Race\\\\Race\\|null\\.$#" count: 2 @@ -2420,11 +2055,6 @@ parameters: count: 1 path: htdocs/content/research.php - - - message: "#^Parameter \\#1 \\$planet of method EtoA\\\\UI\\\\ResourceBoxDrawer\\:\\:getHTML\\(\\) expects EtoA\\\\Universe\\\\Planet\\\\Planet, EtoA\\\\Universe\\\\Planet\\\\Planet\\|null given\\.$#" - count: 2 - path: htdocs/content/research.php - - message: "#^Parameter \\#2 \\$timestamp of function date expects int\\|null, float\\|int given\\.$#" count: 1 @@ -2565,76 +2195,6 @@ parameters: count: 2 path: htdocs/content/ship_upgrade.php - - - message: "#^Cannot access property \\$id on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 16 - path: htdocs/content/shipyard.php - - - - message: "#^Cannot access property \\$mainPlanet on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/shipyard.php - - - - message: "#^Cannot access property \\$name on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/shipyard.php - - - - message: "#^Cannot access property \\$people on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 1 - path: htdocs/content/shipyard.php - - - - message: "#^Cannot access property \\$prodCrystal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/shipyard.php - - - - message: "#^Cannot access property \\$prodFood on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/shipyard.php - - - - message: "#^Cannot access property \\$prodFuel on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/shipyard.php - - - - message: "#^Cannot access property \\$prodMetal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/shipyard.php - - - - message: "#^Cannot access property \\$prodPlastic on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 2 - path: htdocs/content/shipyard.php - - - - message: "#^Cannot access property \\$resCrystal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 7 - path: htdocs/content/shipyard.php - - - - message: "#^Cannot access property \\$resFood on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 8 - path: htdocs/content/shipyard.php - - - - message: "#^Cannot access property \\$resFuel on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 7 - path: htdocs/content/shipyard.php - - - - message: "#^Cannot access property \\$resMetal on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 7 - path: htdocs/content/shipyard.php - - - - message: "#^Cannot access property \\$resPlastic on EtoA\\\\Universe\\\\Planet\\\\Planet\\|null\\.$#" - count: 7 - path: htdocs/content/shipyard.php - - message: "#^Offset 'crystal' does not exist on array\\{\\}\\|array\\{metal\\: mixed, crystal\\: mixed, plastic\\: mixed, fuel\\: mixed, food\\: mixed\\}\\.$#" count: 1 @@ -2670,11 +2230,6 @@ parameters: count: 2 path: htdocs/content/shipyard.php - - - message: "#^Parameter \\#1 \\$planet of method EtoA\\\\UI\\\\ResourceBoxDrawer\\:\\:getHTML\\(\\) expects EtoA\\\\Universe\\\\Planet\\\\Planet, EtoA\\\\Universe\\\\Planet\\\\Planet\\|null given\\.$#" - count: 2 - path: htdocs/content/shipyard.php - - message: "#^Parameter \\#2 \\$timestamp of function date expects int\\|null, float\\|int given\\.$#" count: 2