Skip to content

Commit e1d1bcd

Browse files
authored
Merge pull request #9 from dicoding-dev/feature/symfony-6
Upgrade Symfony components to 6.x
2 parents 8db410b + 1a36900 commit e1d1bcd

Some content is hidden

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

63 files changed

+414
-239
lines changed

.github/workflows/pull-request-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ jobs:
2323
- name: Running unit test
2424
uses: php-actions/phpunit@v3
2525
with:
26-
version: 9.5
26+
version: 9.6
2727
php_version: 8.1
2828
configuration: phpunit.xml

composer.json

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,31 @@
1212
"require": {
1313
"php": ">=8.1.0",
1414
"d11wtq/boris": "~1.0",
15+
"filp/whoops": "~2.11",
1516
"ircmaxell/password-compat": "~1.0",
17+
"laravel/serializable-closure": "^1.2",
1618
"monolog/monolog": "~1.6",
17-
"nesbot/carbon": "~2.0",
19+
"nesbot/carbon": "^2.71",
20+
"opis/closure": "~3.6",
21+
"pda/pheanstalk": "~4.0",
1822
"phpseclib/phpseclib": "~2.0",
1923
"predis/predis": "^1.1",
20-
"stack/builder": "~1.0",
2124
"swiftmailer/swiftmailer": "^6.0",
22-
"symfony/browser-kit": "~4.4",
23-
"symfony/console": "~4.4",
24-
"symfony/css-selector": "~4.4",
25-
"symfony/dom-crawler": "~4.4",
26-
"symfony/finder": "~4.4",
27-
"symfony/http-foundation": "~4.4",
28-
"symfony/http-kernel": "~4.4",
29-
"symfony/process": "~4.4",
30-
"symfony/routing": "~4.4",
31-
"symfony/security-core": "~4.4",
32-
"symfony/translation": "~4.4",
33-
"symfony/event-dispatcher": "~4.4",
34-
"symfony/mime": "~5.0.0",
35-
"symfony/error-handler": "~4.4",
36-
"pda/pheanstalk": "~4.0",
37-
"opis/closure": "~3.6",
38-
"voku/portable-ascii": "~1.5",
39-
"filp/whoops": "~2.11",
40-
"laravel/serializable-closure": "^1.2"
25+
"symfony/browser-kit": "~6.4",
26+
"symfony/console": "~6.4",
27+
"symfony/css-selector": "~6.4",
28+
"symfony/dom-crawler": "~6.4",
29+
"symfony/error-handler": "~6.4",
30+
"symfony/event-dispatcher": "~6.4",
31+
"symfony/finder": "~6.4",
32+
"symfony/http-foundation": "~6.4",
33+
"symfony/http-kernel": "~6.4",
34+
"symfony/mime": "~6.4",
35+
"symfony/process": "~6.4",
36+
"symfony/routing": "~6.4",
37+
"symfony/security-core": "~6.4",
38+
"symfony/translation": "~6.4",
39+
"voku/portable-ascii": "~1.5"
4140
},
4241
"replace": {
4342
"illuminate/auth": "self.version",
@@ -71,10 +70,9 @@
7170
},
7271
"require-dev": {
7372
"mockery/mockery": "~1.3",
74-
"phpunit/phpunit": "~9.5",
73+
"phpunit/phpunit": "~9.6",
7574
"phpspec/prophecy-phpunit": "~2.0",
76-
"symfony/debug": "~4.4",
77-
"symfony/var-dumper": "~4.4"
75+
"symfony/var-dumper": "~6.4"
7876
},
7977
"autoload": {
8078
"classmap": [
@@ -104,5 +102,8 @@
104102
"suggest": {
105103
"doctrine/dbal": "Allow renaming columns and dropping SQLite columns."
106104
},
107-
"minimum-stability": "stable"
105+
"minimum-stability": "stable",
106+
"config": {
107+
"sort-packages": true
108+
}
108109
}

phpunit.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,8 @@
2929
<directory suffix="Test.php">./tests</directory>
3030
</testsuite>
3131
</testsuites>
32+
<php>
33+
<ini name="display_errors" value="On" />
34+
<ini name="display_startup_errors" value="On" />
35+
</php>
3236
</phpunit>

src/Illuminate/Console/Application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ public function resolveCommands($commands)
160160
*
161161
* @return \Symfony\Component\Console\Input\InputDefinition
162162
*/
163-
protected function getDefaultInputDefinition()
164-
{
163+
protected function getDefaultInputDefinition(): \Symfony\Component\Console\Input\InputDefinition
164+
{
165165
$definition = parent::getDefaultInputDefinition();
166166

167167
$definition->addOption($this->getEnvironmentOption());

src/Illuminate/Console/Command.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Command extends \Symfony\Component\Console\Command\Command {
4444
*
4545
* @var string
4646
*/
47-
protected $description;
47+
protected $description = '';
4848

4949
/**
5050
* Create a new console command instance.
@@ -91,8 +91,8 @@ protected function specifyParameters()
9191
* @param \Symfony\Component\Console\Output\OutputInterface $output
9292
* @return int
9393
*/
94-
public function run(InputInterface $input, OutputInterface $output)
95-
{
94+
public function run(InputInterface $input, OutputInterface $output): int
95+
{
9696
$this->input = $input;
9797

9898
$this->output = $output;
@@ -107,9 +107,12 @@ public function run(InputInterface $input, OutputInterface $output)
107107
* @param \Symfony\Component\Console\Output\OutputInterface $output
108108
* @return mixed
109109
*/
110-
protected function execute(InputInterface $input, OutputInterface $output)
111-
{
112-
return $this->fire();
110+
protected function execute(InputInterface $input, OutputInterface $output): mixed
111+
{
112+
// Symfony 5 removed support of returning null, so we cast the returned value as integer.
113+
// In this case, void-returned fire() method will be casted to 0.
114+
// @see https://github.com/symfony/console/blob/6.3/CHANGELOG.md#500
115+
return (int) $this->fire();
113116
}
114117

115118
/**

src/Illuminate/Cookie/Guard.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ public function __construct(HttpKernelInterface $app, Encrypter $encrypter)
4646
* @param bool $catch
4747
* @return \Symfony\Component\HttpFoundation\Response
4848
*/
49-
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
50-
{
49+
public function handle(Request $request, $type = HttpKernelInterface::MAIN_REQUEST, $catch = true): Response
50+
{
5151
return $this->encrypt($this->app->handle($this->decrypt($request), $type, $catch));
5252
}
5353

src/Illuminate/Cookie/Queue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public function __construct(HttpKernelInterface $app, CookieJar $cookies)
4242
* @param bool $catch
4343
* @return \Symfony\Component\HttpFoundation\Response
4444
*/
45-
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
46-
{
45+
public function handle(Request $request, $type = HttpKernelInterface::MAIN_REQUEST, $catch = true): \Symfony\Component\HttpFoundation\Response
46+
{
4747
$response = $this->app->handle($request, $type, $catch);
4848

4949
foreach ($this->cookies->getQueuedCookies() as $cookie)

src/Illuminate/Database/Console/Migrations/InstallCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,17 @@ public function __construct(MigrationRepositoryInterface $repository)
4343
/**
4444
* Execute the console command.
4545
*
46-
* @return void
47-
*/
46+
* @return int
47+
*/
4848
public function fire()
4949
{
5050
$this->repository->setSource($this->input->getOption('database'));
5151

5252
$this->repository->createRepository();
5353

5454
$this->info("Migration table created successfully.");
55+
56+
return 0;
5557
}
5658

5759
/**

src/Illuminate/Database/Console/Migrations/MigrateCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public function __construct(Migrator $migrator, $packagePath)
5252
/**
5353
* Execute the console command.
5454
*
55-
* @return void
56-
*/
55+
* @return int
56+
*/
5757
public function fire()
5858
{
5959
if ( ! $this->confirmToProceed()) return;
@@ -84,6 +84,8 @@ public function fire()
8484
{
8585
$this->call('db:seed', ['--force' => true]);
8686
}
87+
88+
return 0;
8789
}
8890

8991
/**

src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public function __construct(MigrationCreator $creator, $packagePath)
5252
/**
5353
* Execute the console command.
5454
*
55-
* @return void
56-
*/
55+
* @return int
56+
*/
5757
public function fire()
5858
{
5959
// It's possible for the developer to specify the tables to modify in this
@@ -73,6 +73,8 @@ public function fire()
7373
$this->writeMigration($name, $table, $create);
7474

7575
$this->call('dump-autoload');
76+
77+
return 0;
7678
}
7779

7880
/**

0 commit comments

Comments
 (0)