Skip to content

Commit

Permalink
Require PHP8
Browse files Browse the repository at this point in the history
Update SF libs to 5.4
Update internal libs
Update to use PHP8 syntax and typed properties
  • Loading branch information
dave-redfern committed Jan 4, 2022
1 parent bdc9c8a commit 30ef40e
Show file tree
Hide file tree
Showing 113 changed files with 491 additions and 1,120 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.0'
extensions: mbstring, intl, posix
ini-values: memory_limit=256M, max_execution_time=0, phar.readonly=0
tools: pecl
Expand Down
5 changes: 1 addition & 4 deletions .idea/codeStyles/Project.xml

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

14 changes: 0 additions & 14 deletions .idea/php-test-framework.xml

This file was deleted.

41 changes: 38 additions & 3 deletions .idea/php.xml

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

34 changes: 33 additions & 1 deletion .idea/project-manager.iml

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

24 changes: 12 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
"description": "A CLI utility for helping manage a micro-services project",
"license": "MIT",
"require": {
"php": ">=7.4",
"php": "^8.0",
"ext-ctype": "*",
"ext-iconv": "*",
"ext-json": "*",
"pragmarx/ia-str": "~7.3",
"somnambulist/collection": "~4.0.1",
"symfony/config": "5.2.*",
"symfony/console": "5.2.*",
"symfony/dependency-injection": "5.2.*",
"symfony/dotenv": "5.2.*",
"symfony/finder": "5.2.*",
"symfony/http-kernel": "5.2.*",
"symfony/process": "5.2.*",
"symfony/yaml": "5.2.*"
"somnambulist/collection": "^5.2",
"symfony/config": "5.4.*",
"symfony/console": "5.4.*",
"symfony/dependency-injection": "5.4.*",
"symfony/dotenv": "5.4.*",
"symfony/finder": "5.4.*",
"symfony/http-kernel": "5.4.*",
"symfony/process": "5.4.*",
"symfony/yaml": "5.4.*"
},
"require-dev": {
"phpunit/phpunit": "~9",
"symfony/var-dumper": "5.2.*"
"phpunit/phpunit": "~9.5",
"symfony/var-dumper": "5.4.*"
},
"config": {
"preferred-install": {
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ and continue on. There is no special configuration needed in any project.

## Installation

Project Manager requires PHP 7.3+ to be installed and in your shell path.
Project Manager requires PHP 8.0+ to be installed and in your shell path.

Grab the phar archive and copy it to `/usr/local/bin` or add it to your path.
Symlink the phar to `spm` or a.n.other name. Be sure to verify the SHA checksum with
Expand Down
43 changes: 14 additions & 29 deletions src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
*/
class Application extends BaseApplication
{
private $kernel;
private $commandsRegistered = false;
private $registrationErrors = [];
private KernelInterface $kernel;
private bool $commandsRegistered = false;
private array $registrationErrors = [];

public function __construct(KernelInterface $kernel, string $version)
{
Expand All @@ -43,7 +43,7 @@ public function __construct(KernelInterface $kernel, string $version)
parent::__construct('Somnambulist Project Manager', $version);
}

public function getLongVersion()
public function getLongVersion(): string
{
return trim(parent::getLongVersion()) . sprintf(' (project: <comment>%s</>)', $_SERVER['SOMNAMBULIST_ACTIVE_PROJECT'] ?: '-');
}
Expand All @@ -53,15 +53,12 @@ public function getLongVersion()
*
* @return KernelInterface A KernelInterface instance
*/
public function getKernel()
public function getKernel(): KernelInterface
{
return $this->kernel;
}

/**
* {@inheritdoc}
*/
public function reset()
public function reset(): void
{

}
Expand All @@ -75,7 +72,7 @@ public function reset()
* @return int 0 if everything went fine, or an error code
* @throws Throwable
*/
public function doRun(InputInterface $input, OutputInterface $output)
public function doRun(InputInterface $input, OutputInterface $output): int
{
$this->registerCommands();

Expand All @@ -88,10 +85,7 @@ public function doRun(InputInterface $input, OutputInterface $output)
return parent::doRun($input, $output);
}

/**
* {@inheritdoc}
*/
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output): int
{
$helper = new ConsoleHelper($input, $output);

Expand Down Expand Up @@ -132,20 +126,14 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI
return $returnCode;
}

/**
* {@inheritdoc}
*/
public function find($name)
public function find($name): Command
{
$this->registerCommands();

return parent::find($name);
}

/**
* {@inheritdoc}
*/
public function get($name)
public function get($name): Command
{
$this->registerCommands();

Expand All @@ -158,24 +146,21 @@ public function get($name)
return $command;
}

/**
* {@inheritdoc}
*/
public function all($namespace = null)
public function all($namespace = null): array
{
$this->registerCommands();

return parent::all($namespace);
}

public function add(Command $command)
public function add(Command $command): Command
{
$this->registerCommands();

return parent::add($command);
}

protected function registerCommands()
protected function registerCommands(): void
{
if ($this->commandsRegistered) {
return;
Expand Down Expand Up @@ -205,7 +190,7 @@ protected function registerCommands()
}
}

private function renderRegistrationErrors(InputInterface $input, OutputInterface $output)
private function renderRegistrationErrors(InputInterface $input, OutputInterface $output): void
{
if ($output instanceof ConsoleOutputInterface) {
$output = $output->getErrorOutput();
Expand Down
2 changes: 0 additions & 2 deletions src/Commands/AbstractCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
*/
abstract class AbstractCommand extends Command
{

use IsRunningInDebugMode;
use UseConsoleHelper;

}
1 change: 0 additions & 1 deletion src/Commands/Behaviours/CanUpdateGitRemoteRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
trait CanUpdateGitRemoteRepository
{

protected function changeGitOrigin(Project $project, $cwd, $repo): int
{
$com = 'addRemote';
Expand Down
6 changes: 1 addition & 5 deletions src/Commands/Behaviours/DockerAwareCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@
*/
trait DockerAwareCommand
{

/**
* @var DockerManager
*/
protected $docker;
protected ?DockerManager $docker = null;

public function bindDockerManager(DockerManager $docker): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Behaviours/GetLibrariesFromInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Somnambulist\ProjectManager\Commands\Behaviours;

use Somnambulist\Collection\MutableCollection;
use Somnambulist\Components\Collection\MutableCollection;
use Somnambulist\ProjectManager\Models\Config;
use Somnambulist\ProjectManager\Services\Console\ConsoleHelper;
use Symfony\Component\Console\Input\InputInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Behaviours/GetServicesFromInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Somnambulist\ProjectManager\Commands\Behaviours;

use Somnambulist\Collection\MutableCollection;
use Somnambulist\Components\Collection\MutableCollection;
use Somnambulist\ProjectManager\Models\Config;
use Somnambulist\ProjectManager\Services\Console\ConsoleHelper;
use Symfony\Component\Console\Input\InputInterface;
Expand Down
8 changes: 1 addition & 7 deletions src/Commands/Behaviours/GetTemplateFromProjectOrConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@
*/
trait GetTemplateFromProjectOrConfig
{

/**
* @param string $template
*
* @return int|Template
*/
protected function getTemplate(string $template)
protected function getTemplate(string $template): int|Template
{
if (null === $temp = $this->config->projects()->active()->templates()->get($template)) {
if (null === $temp = $this->config->templates()->get($template)) {
Expand Down
6 changes: 1 addition & 5 deletions src/Commands/Behaviours/IsRunningInDebugMode.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@
*/
trait IsRunningInDebugMode
{

/**
* @var bool
*/
protected $debug = false;
protected bool $debug = false;

protected function setIsDebugging(InputInterface $input): bool
{
Expand Down
Loading

0 comments on commit 30ef40e

Please sign in to comment.