From 0a313d55acd9a5a1b0bcc7a0d28cd280492fda04 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Thu, 20 Jun 2019 23:30:58 +0200 Subject: [PATCH] MAJOR BUGFIX: `Game::GetResult` throws fatal error `Cannot access parent:: when current class scope has no parent` --- CHANGELOG.md | 3 +++ dist/boilerplate.php | 3 +++ src/Game.php | 4 ++-- tests/ReadSws_test.php | 3 +++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82130a2..0f889d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # CHANGELOG +## v1.1.2 (Release: 21-jun-2019) +* MAJOR BUGFIX: `Game::GetResult` throws fatal error `Cannot access parent:: when current class scope has no parent` + ## v1.1.1 (Released: 20-jun-2019) * NEW FEATURE: Added clean-dist and clean-dev targets * ENHANCEMENT: Better Docs generation diff --git a/dist/boilerplate.php b/dist/boilerplate.php index 521013a..bcb4c42 100644 --- a/dist/boilerplate.php +++ b/dist/boilerplate.php @@ -56,6 +56,9 @@ echo "Absent P3: " . $reader->getTournament()->getPlayerById(2)->getBinaryDat echo "Date Round 1: " . $reader->getTournament()->getRoundByNo(0)->getDate()->format('d/m/Y') . PHP_EOL; echo "Date Round 2: " . $reader->getTournament()->getRoundByNo(1)->getDate()->format('d/m/Y') . PHP_EOL; echo "Date Round 3: " . $reader->getTournament()->getRoundByNo(2)->getDate()->format('d/m/Y') . PHP_EOL; +echo "Game Round 1: " . $sws->getTournament()->getRoundByNo(0)->getGames()[0]->getResult()->getValue() . PHP_EOL; +echo "Game Round 2: " . $sws->getTournament()->getRoundByNo(1)->getGames()[0]->getResult()->getValue() . PHP_EOL; +echo "Game Round 3: " . $sws->getTournament()->getRoundByNo(2)->getGames()[0]->getResult()->getValue() . PHP_EOL; echo "Color Pairing 1: " . $reader->getTournament()->getPairings()[1]->getColor()->getKey() . PHP_EOL; echo "Color Pairing 2: " . $reader->getTournament()->getPairings()[2]->getColor()->getKey() . PHP_EOL; echo "Color Pairing 3: " . $reader->getTournament()->getPairings()[3]->getColor()->getKey() . PHP_EOL; diff --git a/src/Game.php b/src/Game.php index 28c01f4..4023c80 100644 --- a/src/Game.php +++ b/src/Game.php @@ -45,8 +45,8 @@ class Game */ public function getResult(): Gameresult { - if (!is_null(parent::getResult())) { - return parent::getResult(); + if (!is_null($this->result)) { + return $this->result; } $whiteResult = $this->getWhite()->getResult(); diff --git a/tests/ReadSws_test.php b/tests/ReadSws_test.php index 021f08d..566ce97 100644 --- a/tests/ReadSws_test.php +++ b/tests/ReadSws_test.php @@ -64,6 +64,9 @@ echo "Absent P3: " . $sws->getTournament()->getPlayerById(2)->getBinaryData(" echo "Date Round 1: " . $sws->getTournament()->getRoundByNo(0)->getDate()->format('d/m/Y') . PHP_EOL; echo "Date Round 2: " . $sws->getTournament()->getRoundByNo(1)->getDate()->format('d/m/Y') . PHP_EOL; echo "Date Round 3: " . $sws->getTournament()->getRoundByNo(2)->getDate()->format('d/m/Y') . PHP_EOL; +echo "Game Round 1: " . $sws->getTournament()->getRoundByNo(0)->getGames()[0]->getResult()->getValue() . PHP_EOL; +echo "Game Round 2: " . $sws->getTournament()->getRoundByNo(1)->getGames()[0]->getResult()->getValue() . PHP_EOL; +echo "Game Round 3: " . $sws->getTournament()->getRoundByNo(2)->getGames()[0]->getResult()->getValue() . PHP_EOL; echo "Color Pairing 1: " . $sws->getTournament()->getPairings()[1]->getColor()->getKey() . PHP_EOL; echo "Color Pairing 2: " . $sws->getTournament()->getPairings()[2]->getColor()->getKey() . PHP_EOL; echo "Color Pairing 3: " . $sws->getTournament()->getPairings()[3]->getColor()->getKey() . PHP_EOL;