Skip to content

Commit 5b31e99

Browse files
committed
NEXT-33734 - Fix codestyle of PHP scripts and delete obsolete one
1 parent a5d65ce commit 5b31e99

File tree

6 files changed

+28
-138
lines changed

6 files changed

+28
-138
lines changed

.gitlab/bin/split-coverage-report.php

-110
This file was deleted.

bin/ci

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ return static function (array &$context) {
3636
$_SERVER['DATABASE_URL'] = 'mysql://_placeholder.test';
3737

3838
$kernel = KernelFactory::create(
39-
environment: $env,
40-
debug: $debug,
41-
classLoader: $classLoader,
42-
pluginLoader: new ComposerPluginLoader($classLoader, null),
39+
$env,
40+
$debug,
41+
$classLoader,
42+
new ComposerPluginLoader($classLoader, null),
4343
);
4444

4545
$application = new Application($kernel);

bin/exec-with-env

+11-12
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ use Symfony\Component\Console\Input\ArgvInput;
66
use Symfony\Component\Dotenv\Dotenv;
77
use Symfony\Component\Process\Process;
88

9-
if (\PHP_VERSION_ID < 70400) {
10-
echo 'Your cli is running PHP version ' . \PHP_VERSION . ' but Shopware 6 requires at least PHP 7.4.0' . \PHP_EOL;
11-
exit(1);
12-
}
13-
149
set_time_limit(0);
1510

1611
$classLoader = require __DIR__ . '/../vendor/autoload.php';
@@ -20,12 +15,16 @@ if (!class_exists(Application::class) || !class_exists(Dotenv::class)) {
2015
}
2116

2217
$input = new ArgvInput();
23-
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
24-
putenv('APP_ENV=' . $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
18+
if ($env = $input->getParameterOption(['--env', '-e'], null, true) !== null) {
19+
$_ENV['APP_ENV'] = $env;
20+
$_SERVER['APP_ENV'] = $env;
21+
putenv('APP_ENV=' . $env);
2522
}
2623

2724
if ($input->hasParameterOption('--no-debug', true)) {
28-
putenv('APP_DEBUG=' . $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
25+
$_ENV['APP_DEBUG'] = '0';
26+
$_SERVER['APP_DEBUG'] = '0';
27+
putenv('APP_DEBUG=0');
2928
}
3029

3130
$projectRoot = dirname(__DIR__);
@@ -41,10 +40,10 @@ $cmd = escapeshellcmd($cmd);
4140
$args = array_map('escapeshellarg', $args);
4241

4342
$command = $cmd . ' ' . implode(' ', $args);
44-
$process = Symfony\Component\Process\Process::fromShellCommandline($command);
43+
$process = Process::fromShellCommandline($command);
4544
$process->setTimeout(null);
4645

47-
$isTty = (function () {
46+
$isTty = (static function () {
4847
$fd = defined('STDOUT') ? \STDOUT : fopen('php://stdout', 'wb');
4948

5049
if (function_exists('stream_isatty')) {
@@ -57,13 +56,13 @@ $isTty = (function () {
5756

5857
$stat = @fstat($fd);
5958

60-
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
59+
return $stat && ($stat['mode'] & 0170000) === 0020000;
6160
})();
6261

6362
$process->setTty($isTty);
6463
$process->run(function ($type, $buffer): void {
6564
if ($type === Process::ERR) {
66-
fwrite(\STDERR, "$buffer");
65+
fwrite(\STDERR, (string) $buffer);
6766
} else {
6867
echo $buffer;
6968
}

bin/shopware

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use Shopware\Core\Framework\Adapter\Kernel\KernelFactory;
55
use Shopware\Core\Framework\Plugin\KernelPluginLoader\DbalKernelPluginLoader;
66
use Shopware\Core\Framework\Plugin\KernelPluginLoader\StaticKernelPluginLoader;
7+
use Shopware\Core\Kernel;
78
use Symfony\Bundle\FrameworkBundle\Console\Application;
89
use Symfony\Component\Console\Input\ArgvInput;
910

@@ -39,14 +40,14 @@ return static function (array &$context) {
3940
}
4041

4142
if (trim($context['DATABASE_URL'] ?? '') !== '' && !isset($context['INSTALL'])) {
42-
$pluginLoader = new DbalKernelPluginLoader($classLoader, null, \Shopware\Core\Kernel::getConnection());
43+
$pluginLoader = new DbalKernelPluginLoader($classLoader, null, Kernel::getConnection());
4344
}
4445

4546
$kernel = KernelFactory::create(
46-
environment: $env,
47-
debug: $debug,
48-
classLoader: $classLoader,
49-
pluginLoader: $pluginLoader
47+
$env,
48+
$debug,
49+
$classLoader,
50+
$pluginLoader
5051
);
5152

5253
$application = new Application($kernel);

config/bundles.php

+1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@
2323
if (InstalledVersions::isInstalled('symfony/web-profiler-bundle')) {
2424
$bundles[Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class] = ['dev' => true, 'test' => true, 'phpstan_dev' => true];
2525
}
26+
2627
return $bundles;

public/index.php

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php declare(strict_types=1);
22

33
use Shopware\Core\DevOps\Environment\EnvironmentHelper;
4+
use Shopware\Core\Framework\Adapter\Kernel\KernelFactory;
45
use Shopware\Core\Framework\Plugin\KernelPluginLoader\ComposerPluginLoader;
56
use Shopware\Core\Installer\InstallerKernel;
6-
use Shopware\Core\Framework\Adapter\Kernel\KernelFactory;
77

88
$_SERVER['SCRIPT_FILENAME'] = __FILE__;
99

@@ -15,15 +15,14 @@
1515

1616
$_SERVER['APP_RUNTIME_OPTIONS']['prod_envs'] = ['prod', 'e2e'];
1717

18-
1918
return function (array $context) {
2019
$classLoader = require __DIR__ . '/../vendor/autoload.php';
2120

2221
if (!file_exists(dirname(__DIR__) . '/install.lock')) {
2322
$baseURL = str_replace(basename(__FILE__), '', $_SERVER['SCRIPT_NAME']);
2423
$baseURL = rtrim($baseURL, '/');
2524

26-
if (strpos($_SERVER['REQUEST_URI'], '/installer') === false) {
25+
if (!str_contains($_SERVER['REQUEST_URI'], '/installer')) {
2726
header('Location: ' . $baseURL . '/installer');
2827
exit;
2928
}
@@ -56,9 +55,9 @@
5655
}
5756

5857
return KernelFactory::create(
59-
environment: $appEnv,
60-
debug: $debug,
61-
classLoader: $classLoader,
62-
pluginLoader: $pluginLoader
58+
$appEnv,
59+
$debug,
60+
$classLoader,
61+
$pluginLoader
6362
);
6463
};

0 commit comments

Comments
 (0)