diff --git a/lib/php/libsdk/SDK/Build/PGO/Abstracts/PHP.php b/lib/php/libsdk/SDK/Build/PGO/Abstracts/PHP.php index d6090d6..d1d04e5 100644 --- a/lib/php/libsdk/SDK/Build/PGO/Abstracts/PHP.php +++ b/lib/php/libsdk/SDK/Build/PGO/Abstracts/PHP.php @@ -30,6 +30,8 @@ protected function setupPaths() } } + abstract public function getExeFilename() : string; + /* TODO Might be improved. */ public function isDist() : bool { @@ -96,7 +98,7 @@ public function getRootDir() : string public function getVersion(bool $short = false) : string { $ret = NULL; - $cli = new CLI($this->conf, $this->scenario); + $cli = new CLI($this->conf); $out = shell_exec($cli->getExeFilename() . " -n -v"); @@ -119,7 +121,7 @@ public function getVersion(bool $short = false) : string public function isThreadSafe() : bool { - $cli = new CLI($this->conf, $this->scenario); + $cli = new CLI($this->conf); $out = shell_exec($cli->getExeFilename() . " -n -v"); diff --git a/lib/php/libsdk/SDK/Build/PGO/Abstracts/Server.php b/lib/php/libsdk/SDK/Build/PGO/Abstracts/Server.php index 8a5cfd8..f8397f3 100644 --- a/lib/php/libsdk/SDK/Build/PGO/Abstracts/Server.php +++ b/lib/php/libsdk/SDK/Build/PGO/Abstracts/Server.php @@ -6,6 +6,9 @@ abstract class Server { + protected $name; + protected $php; + public function getName() : string { return $this->name; diff --git a/lib/php/libsdk/SDK/Build/PGO/Abstracts/TrainingCase.php b/lib/php/libsdk/SDK/Build/PGO/Abstracts/TrainingCase.php index 522e740..8ca21ee 100644 --- a/lib/php/libsdk/SDK/Build/PGO/Abstracts/TrainingCase.php +++ b/lib/php/libsdk/SDK/Build/PGO/Abstracts/TrainingCase.php @@ -3,9 +3,10 @@ namespace SDK\Build\PGO\Abstracts; use SDK\FileOps; +use SDK\Build\PGO\Interfaces; use SDK\Build\PGO\Tool; -abstract class TrainingCase +abstract class TrainingCase implements Interfaces\TrainingCase { use FileOps; @@ -15,6 +16,9 @@ abstract class TrainingCase protected $stat = array(); /** @var \SDK\Build\PGO\Config */ protected $conf; + protected $php; + + abstract public function getName() : string; public function getType() : string { diff --git a/lib/php/libsdk/SDK/Build/PGO/Controller.php b/lib/php/libsdk/SDK/Build/PGO/Controller.php index 076a624..644e08b 100644 --- a/lib/php/libsdk/SDK/Build/PGO/Controller.php +++ b/lib/php/libsdk/SDK/Build/PGO/Controller.php @@ -52,7 +52,6 @@ protected function setupConfig($cmd) switch ($cmd) { default: throw new Exception("Unknown action '{$cmd}'."); - break; case "check_init": $cnf = new PGOConfig(PGOConfig::MODE_CHECK_INIT); break; @@ -80,7 +79,6 @@ public function handle($force) switch ($this->cmd) { default: throw new Exception("Unknown action '{$this->cmd}'."); - break; case "init": $lk = new Lock("pgo_init"); if (!$lk->locked()) { @@ -242,7 +240,7 @@ public function up() } echo "\nStarting up PGO environment.\n\n"; - foreach ($this->vitalizeSrv("all") as $srv) { + foreach ($this->vitalizeSrv() as $srv) { $srv->up(); echo "\n"; } @@ -260,7 +258,7 @@ public function down(bool $force = false) /* XXX check it was started of course. */ echo "\nShutting down PGO environment.\n\n"; - foreach ($this->vitalizeSrv("all") as $srv) { + foreach ($this->vitalizeSrv() as $srv) { $srv->down($force); echo "\n"; } diff --git a/lib/php/libsdk/SDK/Build/PGO/Interfaces/Server.php b/lib/php/libsdk/SDK/Build/PGO/Interfaces/Server.php index edfbf10..e71b2ae 100644 --- a/lib/php/libsdk/SDK/Build/PGO/Interfaces/Server.php +++ b/lib/php/libsdk/SDK/Build/PGO/Interfaces/Server.php @@ -12,4 +12,5 @@ public function init() : void; public function up() : void; public function down(bool $force = false) : void; public function getName() : string; + public function getPhp(); } diff --git a/lib/php/libsdk/SDK/Build/PGO/TrainingCaseIterator.php b/lib/php/libsdk/SDK/Build/PGO/TrainingCaseIterator.php index df186f3..82b06d7 100644 --- a/lib/php/libsdk/SDK/Build/PGO/TrainingCaseIterator.php +++ b/lib/php/libsdk/SDK/Build/PGO/TrainingCaseIterator.php @@ -50,6 +50,7 @@ protected function getHandlerFilename(string $base) : string return $base . DIRECTORY_SEPARATOR . "TrainingCaseHandler.php"; } + #[\ReturnTypeWillChange] public function current() { $base = $this->items[$this->idx]; @@ -73,21 +74,25 @@ public function current() return $this->el; } + #[\ReturnTypeWillChange] public function next() { $this->idx++; } + #[\ReturnTypeWillChange] public function rewind() { $this->idx = 0; } + #[\ReturnTypeWillChange] public function valid() { return $this->idx < count($this->items); } + #[\ReturnTypeWillChange] public function key() { if (!is_object($this->el)) { diff --git a/lib/php/libsdk/SDK/Config.php b/lib/php/libsdk/SDK/Config.php index ccdf88e..49857db 100644 --- a/lib/php/libsdk/SDK/Config.php +++ b/lib/php/libsdk/SDK/Config.php @@ -12,7 +12,7 @@ class Config protected static $depsUriScheme = "https"; protected static $depsBaseUri = "/~windows/php-sdk/deps"; - /* protected static $sdkNugetFeedUrl = "http://127.0.0.1/sdk/nuget"; */ + protected static $sdkNugetFeedUrl = "http://127.0.0.1/sdk/nuget"; // experimental? protected static $knownBranches = array (); @@ -28,7 +28,7 @@ public static function getDepsHost() : string return self::$depsHost; }/*}}}*/ - public static function getDepsPort() : string + public static function getDepsPort() : int {/*{{{*/ return self::$depsPort; }/*}}}*/ @@ -264,6 +264,7 @@ public static function getCurrentBranchData() : array throw new Exception("Unknown branch '$current_branch_name'"); } + $crt = null; $cur_crt = Config::getCurrentCrtName(); if (count($branches[$current_branch_name]) > 1) { if (NULL === $cur_crt) { diff --git a/lib/php/libsdk/SDK/FileOps.php b/lib/php/libsdk/SDK/FileOps.php index c31e437..b4577a4 100644 --- a/lib/php/libsdk/SDK/FileOps.php +++ b/lib/php/libsdk/SDK/FileOps.php @@ -90,6 +90,7 @@ protected function cp_or_mv(string $src, string $dst, callable $cb) : bool if ($item->isFile()) { if (!call_user_func($cb, $src_path, $dst_path)) { + assert(is_string($cb)); throw new Exception("Unable to $cb '$src_path' to '$dst_path'"); } }