Skip to content

Commit

Permalink
[minor] require php 7.4+
Browse files Browse the repository at this point in the history
  • Loading branch information
kbond committed Sep 29, 2022
1 parent e49b924 commit ea5e9c8
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 50 deletions.
38 changes: 9 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,37 +43,17 @@ jobs:
path: bin/phpmyadmin.phar

composer-validate:
name: Validate composer.json
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]

- name: Setup PHP
uses: shivammathur/[email protected]
with:
php-version: 8.0
coverage: none

- name: Validate composer.json
run: composer validate --strict --no-check-lock
uses: zenstruck/.github/.github/workflows/php-composer-validate.yml@main

cs-check:
name: PHP Coding Standards
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]

- name: Setup PHP
uses: shivammathur/[email protected]
with:
php-version: 7.4
coverage: none
tools: php-cs-fixer

- name: Check CS
run: php-cs-fixer fix --dry-run --diff
uses: zenstruck/.github/.github/workflows/php-cs-fixer.yml@main
with:
php: 8.0

sca:
uses: zenstruck/.github/.github/workflows/php-stan.yml@main
with:
php: 8.1

test-phar:
runs-on: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in([__DIR__.'/src'])
->in([__DIR__.'/src', __DIR__.'/bin'])
->files()
->name('*')
;

return (new PhpCsFixer\Config())
Expand Down
8 changes: 4 additions & 4 deletions bin/phpmyadmin
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ use Zenstruck\PMA\Server\Command\RunCommand;
use Zenstruck\PMA\Server\Command\SelfUpdateCommand;
use Zenstruck\PMA\Server\Command\StatusCommand;

set_time_limit(0);
\set_time_limit(0);

foreach ([__DIR__ . '/../../../autoload.php', __DIR__ . '/../vendor/autoload.php'] as $autoload) {
if (file_exists($autoload)) {
foreach ([__DIR__.'/../../../autoload.php', __DIR__.'/../vendor/autoload.php'] as $autoload) {
if (\file_exists($autoload)) {
break;
}
}
Expand All @@ -22,7 +22,7 @@ $application = new Application('phpmyadmin-server', '@dev');
$application->addCommands([
$command = new RunCommand(),
new InitCommand(),
new StatusCommand()
new StatusCommand(),
]);

if (\Phar::running()) {
Expand Down
17 changes: 5 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,13 @@
},
"bin": ["bin/phpmyadmin"],
"require": {
"php": ">=7.2",
"php": ">=7.4",
"symfony/web-server-bundle": "^4.4",
"symfony/filesystem": "^4.4",
"symfony/console": "^4.4"
"symfony/filesystem": "^5.4",
"symfony/console": "^5.4"
},
"require-dev": {
"laravel-zero/phar-updater": "^1.1.1"
},
"conflict": {
"symfony/string": "*"
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
"laravel-zero/phar-updater": "^1.1.1",
"phpstan/phpstan": "^1.8"
}
}
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
parameters:
level: 8
paths:
- src
- bin
2 changes: 1 addition & 1 deletion src/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected function webserverConfig(): WebServerConfig
throw new \RuntimeException('phpMyAdmin not initialized. Run "phpmyadmin init".');
}

return new WebServerConfig($this->documentRoot(), 'dev', \file_get_contents($address), $router);
return new WebServerConfig($this->documentRoot(), 'dev', \file_get_contents($address), $router); // @phpstan-ignore-line
}

protected function folderName(): string
Expand Down
4 changes: 2 additions & 2 deletions src/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$io->comment('Generating config.inc.php');
$config = \file_get_contents(__DIR__.'/../resources/config.inc.template');
\file_put_contents($this->documentRoot().'/config.inc.php', \strtr($config, [
\file_put_contents($this->documentRoot().'/config.inc.php', \strtr($config, [ // @phpstan-ignore-line
'%%mysql_host%%' => $mysqlHost,
'%%mysql_port%%' => $mysqlPort,
'%%mysql_user%%' => $mysqlUser,
Expand Down Expand Up @@ -102,7 +102,7 @@ protected function interact(InputInterface $input, OutputInterface $output): voi
foreach (['address', 'host', 'port', 'user'] as $option) {
$input->setOption($option, $io->ask(
$definition->getOption($option)->getDescription(),
$definition->getOption($option)->getDefault()
$definition->getOption($option)->getDefault() // @phpstan-ignore-line
));
}

Expand Down
2 changes: 1 addition & 1 deletion src/SelfUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$updater->getStrategy()->setPackageName('zenstruck/phpmyadmin-server');
$updater->getStrategy()->setPharName('phpmyadmin.phar');
$updater->getStrategy()->setCurrentLocalVersion($current = $this->getApplication()->getVersion());
$updater->getStrategy()->setCurrentLocalVersion($current = $this->getApplication()->getVersion()); // @phpstan-ignore-line

if (!$updater->update()) {
$io->success(\sprintf('You are already using the latest available phpmyadmin-server (%s).', $current));
Expand Down

0 comments on commit ea5e9c8

Please sign in to comment.