Skip to content

Commit 28f00bb

Browse files
Merge branch 'feature/sulu-upgrade-2-4-2' into 'master'
Upgrade demo to sulu 2.4.2 See merge request webapps/sulu-demo!128
2 parents 293aa51 + 7db320b commit 28f00bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+848
-730
lines changed

.php-cs-fixer.dist.php

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
'multi_line_extends_each_single_line' => true,
1616
],
1717
'linebreak_after_opening_tag' => true,
18+
'native_constant_invocation' => true,
19+
'native_function_casing' => true,
20+
'native_function_invocation' => ['include' => ['@internal']],
1821
'no_php4_constructor' => true,
1922
'no_superfluous_phpdoc_tags' => true,
2023
'no_unreachable_default_argument_value' => true,
@@ -25,6 +28,7 @@
2528
'semicolon_after_instruction' => true,
2629
'strict_comparison' => true,
2730
'strict_param' => true,
31+
'single_line_comment_spacing' => false,
2832
])
2933
->setFinder(
3034
PhpCsFixer\Finder::create()

bin/adminconsole

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
#!/usr/bin/env php
22
<?php
33

4-
require __DIR__.'/../vendor/autoload.php';
5-
6-
$suluContext = \Sulu\Component\HttpKernel\SuluKernel::CONTEXT_ADMIN;
7-
include __DIR__ . DIRECTORY_SEPARATOR. 'console.php';
4+
return include __DIR__ . DIRECTORY_SEPARATOR. 'console.php';

bin/console

+1-19
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,4 @@
11
#!/usr/bin/env php
22
<?php
33

4-
use Sulu\Component\HttpKernel\SuluKernel;
5-
use Symfony\Component\Console\Input\ArgvInput;
6-
use Symfony\Component\Console\Output\ConsoleOutput;
7-
use Symfony\Component\Console\Style\SymfonyStyle;
8-
9-
require __DIR__.'/../vendor/autoload.php';
10-
11-
$input = new ArgvInput();
12-
$output = new ConsoleOutput();
13-
$io = new SymfonyStyle($input, $output);
14-
15-
$ansi = $input->getParameterOption(['--ansi']);
16-
17-
if (!$ansi) {
18-
$io->warning('This command will be executed in the "admin" context. For the "website" context, run ./bin/websiteconsole');
19-
}
20-
21-
$suluContext = SuluKernel::CONTEXT_ADMIN;
22-
include __DIR__ . DIRECTORY_SEPARATOR. 'console.php';
4+
return include __DIR__ . DIRECTORY_SEPARATOR. 'console.php';

bin/console.php

+9-31
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,19 @@
1111

1212
use App\Kernel;
1313
use Symfony\Bundle\FrameworkBundle\Console\Application;
14-
use Symfony\Component\Console\Input\ArgvInput;
15-
use Symfony\Component\Dotenv\Dotenv;
16-
use Symfony\Component\ErrorHandler\Debug;
1714

18-
if (!in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
19-
echo 'Warning: The console should be invoked via the CLI version of PHP, not the ' . \PHP_SAPI . ' SAPI' . \PHP_EOL;
15+
if (!\is_file(\dirname(__DIR__) . '/vendor/autoload_runtime.php')) {
16+
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
2017
}
2118

22-
set_time_limit(0);
19+
require_once \dirname(__DIR__) . '/vendor/autoload_runtime.php';
2320

24-
require dirname(__DIR__) . '/vendor/autoload.php';
25-
26-
if (!class_exists(Application::class) || !class_exists(Dotenv::class)) {
27-
throw new LogicException('You need to add "symfony/framework-bundle" and "symfony/dotenv" as Composer dependencies.');
28-
}
29-
30-
$input = new ArgvInput();
31-
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
32-
putenv('APP_ENV=' . $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
33-
}
34-
35-
if ($input->hasParameterOption('--no-debug', true)) {
36-
putenv('APP_DEBUG=' . $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
21+
if (!isset($suluContext)) {
22+
$suluContext = Kernel::CONTEXT_ADMIN;
3723
}
3824

39-
(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
40-
41-
if ($_SERVER['APP_DEBUG']) {
42-
umask(0000);
43-
44-
if (class_exists(Debug::class)) {
45-
Debug::enable();
46-
}
47-
}
25+
return function (array $context) use ($suluContext) {
26+
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG'], $suluContext);
4827

49-
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG'], $suluContext);
50-
$application = new Application($kernel);
51-
$application->run($input);
28+
return new Application($kernel);
29+
};

bin/phpunit

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
#!/usr/bin/env php
22
<?php
33

4-
if (!ini_get('date.timezone')) {
5-
ini_set('date.timezone', 'UTC');
4+
if (!\ini_get('date.timezone')) {
5+
\ini_set('date.timezone', 'UTC');
66
}
77

8-
if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
9-
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
8+
if (\is_file(\dirname(__DIR__) . '/vendor/phpunit/phpunit/phpunit')) {
9+
\define('PHPUNIT_COMPOSER_INSTALL', \dirname(__DIR__) . '/vendor/autoload.php');
1010
require PHPUNIT_COMPOSER_INSTALL;
1111
PHPUnit\TextUI\Command::main();
1212
} else {
13-
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
13+
if (!\is_file(\dirname(__DIR__) . '/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
1414
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
1515
exit(1);
1616
}
1717

18-
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
18+
require \dirname(__DIR__) . '/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
1919
}

bin/websiteconsole

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env php
22
<?php
33

4-
require __DIR__.'/../vendor/autoload.php';
4+
// we are not allowed to load the autoloader here to get constant because symfony/runtime does else not work correctly
5+
$suluContext = 'website';
56

6-
$suluContext = \Sulu\Component\HttpKernel\SuluKernel::CONTEXT_WEBSITE;
7-
include __DIR__ . DIRECTORY_SEPARATOR. 'console.php';
7+
return include __DIR__ . DIRECTORY_SEPARATOR. 'console.php';

composer.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@
2424
"sulu/article-bundle": "^2.3",
2525
"sulu/automation-bundle": "^2.0",
2626
"sulu/redirect-bundle": "^2.0",
27-
"sulu/sulu": "~2.4.0",
27+
"sulu/sulu": "~2.4.2",
2828
"sulu/web-twig": "^2.4",
2929
"symfony/config": "^5.4",
3030
"symfony/dotenv": "^5.4",
3131
"symfony/flex": "^1.17 || ^2.0",
3232
"symfony/framework-bundle": "^5.4",
3333
"symfony/monolog-bridge": "^5.4",
3434
"symfony/monolog-bundle": "^3.7",
35+
"symfony/runtime": "^5.4",
3536
"symfony/security-bundle": "^5.4",
3637
"symfony/swiftmailer-bundle": "^3.5",
3738
"symfony/twig-bundle": "^5.4"
@@ -154,7 +155,8 @@
154155
"sort-packages": true,
155156
"allow-plugins": {
156157
"symfony/flex": true,
157-
"symfony/thanks": true
158+
"symfony/thanks": true,
159+
"symfony/runtime": true
158160
}
159161
},
160162
"extra": {

0 commit comments

Comments
 (0)