Skip to content

Commit

Permalink
PHP 8 update
Browse files Browse the repository at this point in the history
  • Loading branch information
g105b committed Feb 7, 2021
1 parent 759137d commit 8c7347d
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 66 deletions.
5 changes: 3 additions & 2 deletions bin/gt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<?php
namespace Gt\Installer;

use Gt\Cli\Application;
use Gt\Cli\Argument\ArgumentList;
use Gt\Installer\Command\BuildCommand;
use Gt\Installer\Command\CreateCommand;
Expand All @@ -18,7 +19,7 @@ foreach([ __DIR__ . "/../../..", __DIR__ . "/../vendor" ] as $vendor) {
}
}

$app = new \Gt\Cli\Application(
$app = new Application(
"PHP.Gt Command Line Interface",
new ArgumentList(...$argv),
new CreateCommand(),
Expand All @@ -28,4 +29,4 @@ $app = new \Gt\Cli\Application(
new ServeCommand(),
new MigrateCommand()
);
$app->run();
$app->run();
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
],

"require": {
"php": ">=7.4",
"php": ">=8.0",
"phpgt/cli": "*",
"phpgt/daemon": "*",
"phpgt/cron": "*",
Expand Down
60 changes: 33 additions & 27 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 1 addition & 21 deletions src/Command/AbstractWebEngineCommand.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
namespace Gt\Installer\Command;

use Gt\Cli\Argument\Argument;
use Gt\Cli\Argument\ArgumentValueList;
use Gt\Cli\Command\Command;
use Gt\Cli\Stream;
Expand All @@ -13,25 +12,6 @@ public function executeScript(
ArgumentValueList $arguments = null,
array...$scriptsToRun
):void {
$stringArgumentArray = [];
//
// foreach($arguments as $arg) {
// $key = $arg->getKey();
//
// if($key !== Argument::USER_DATA) {
// $stringArgumentArray .= "--";
// $stringArgumentArray .= $key;
// }
//
// $value = $arg->get();
// if(!empty($value)) {
// $stringArgumentArray .= " ";
// $stringArgumentArray .= $value;
// }
// }

// var_dump($arguments);die();

$processPool = new Pool();

foreach($scriptsToRun as $scriptParts) {
Expand Down Expand Up @@ -74,4 +54,4 @@ public function executeScript(
}
while($processPool->numRunning() > 0);
}
}
}
4 changes: 2 additions & 2 deletions src/Command/CreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Gt\Cli\Stream;
use Gt\Daemon\Process;

class CreateCommand extends Command {
class CreateCommand extends AbstractWebEngineCommand {
public function run(ArgumentValueList $arguments = null):void {
$cwd = getcwd();
$appDir = implode(DIRECTORY_SEPARATOR, [
Expand Down Expand Up @@ -84,4 +84,4 @@ public function getOptionalParameterList():array {
public function getRequiredParameterList():array {
return [];
}
}
}
4 changes: 1 addition & 3 deletions src/Command/CronCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
namespace Gt\Installer\Command;

use Gt\Cli\Argument\ArgumentValueList;
use Gt\Cli\Command\Command;
use Gt\Cli\Parameter\NamedParameter;
use Gt\Cli\Parameter\Parameter;
use Gt\Cli\Stream;

class CronCommand extends AbstractWebEngineCommand {
public function run(ArgumentValueList $arguments = null):void {
Expand Down Expand Up @@ -44,4 +42,4 @@ public function getOptionalParameterList():array {
$baseCommand = new \Gt\Cron\Command\RunCommand();
return $baseCommand->getOptionalParameterList();
}
}
}
17 changes: 7 additions & 10 deletions src/Command/ServeCommand.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<?php

namespace Gt\Installer\Command;

use Gt\Cli\Argument\ArgumentValueList;
use Gt\Cli\Command\Command;
use Gt\Cli\Parameter\NamedParameter;
use Gt\Cli\Parameter\Parameter;
use Gt\Cli\Stream;
use Gt\Daemon\Process;
use Gt\Server\Command\StartCommand;

class ServeCommand extends AbstractWebEngineCommand {
public function run(ArgumentValueList $arguments = null):void {
Expand All @@ -19,31 +16,31 @@ public function getName():string {
}

public function getDescription():string {
$baseCommand = new \Gt\Server\Command\StartCommand();
$baseCommand = new StartCommand();
return $baseCommand->getDescription();
}

/** @return NamedParameter[] */
public function getRequiredNamedParameterList():array {
$baseCommand = new \Gt\Server\Command\StartCommand();
$baseCommand = new StartCommand();
return $baseCommand->getRequiredNamedParameterList();
}

/** @return NamedParameter[] */
public function getOptionalNamedParameterList():array {
$baseCommand = new \Gt\Server\Command\StartCommand();
$baseCommand = new StartCommand();
return $baseCommand->getOptionalNamedParameterList();
}

/** @return Parameter[] */
public function getRequiredParameterList():array {
$baseCommand = new \Gt\Server\Command\StartCommand();
$baseCommand = new StartCommand();
return $baseCommand->getRequiredParameterList();
}

/** @return Parameter[] */
public function getOptionalParameterList():array {
$baseCommand = new \Gt\Server\Command\StartCommand();
$baseCommand = new StartCommand();
return $baseCommand->getOptionalParameterList();
}
}
}

0 comments on commit 8c7347d

Please sign in to comment.