Skip to content

Commit e90beb1

Browse files
committed
chore: cleanup composer.json, added laravel 12
1 parent 4fc1ccf commit e90beb1

File tree

7 files changed

+36
-35
lines changed

7 files changed

+36
-35
lines changed

.github/workflows/tests.yml

+7-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches:
66
- main
7-
- '*.x'
7+
- "*.x"
88
pull_request:
99

1010
permissions:
@@ -18,23 +18,22 @@ jobs:
1818
fail-fast: true
1919
matrix:
2020
include:
21-
- php: '8.0'
22-
laravel: 9
23-
- php: '8.1'
21+
- php: "8.1"
2422
laravel: 10
25-
- php: '8.2'
23+
- php: "8.2"
2624
laravel: 11
27-
- php: '8.3'
25+
- php: "8.3"
2826
laravel: 11
27+
- php: "8.4"
28+
laravel: 12
2929

3030
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
3131

3232
steps:
33-
3433
- name: Checkout code
3534
uses: actions/checkout@v4
3635
with:
37-
path: 'dentro-nge'
36+
path: "dentro-nge"
3837

3938
- name: Setup PHP
4039
uses: shivammathur/setup-php@v2

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
/vendor
2+
3+
.DS_Store
24
composer.lock

composer.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
}
1515
],
1616
"require": {
17-
"php": "^8.0",
18-
"illuminate/console": "^9.52.16|^10.0|^11.0",
19-
"illuminate/contracts": "^9.52.16|^10.0|^11.0",
20-
"illuminate/support": "^9.52.16|^10.0|^11.0",
21-
"symfony/console": "^6.0|^7.0",
22-
"symfony/yaml": "^6.0|^7.0"
17+
"php": "^8.2",
18+
"illuminate/console": "^11.0",
19+
"illuminate/contracts": "^11.0",
20+
"illuminate/support": "^11.0",
21+
"symfony/console": "^7.0",
22+
"symfony/yaml": "^7.0"
2323
},
2424
"require-dev": {
2525
"orchestra/testbench": "^7.0|^8.0|^9.0",

phpstan.neon.dist

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ parameters:
22
paths:
33
- src
44

5-
level: 0
5+
level: 1

src/Console/AddCommand.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ class AddCommand extends Command
3030
/**
3131
* Execute the console command.
3232
*
33-
* @return int|null
33+
* @return void
3434
*/
35-
public function handle()
35+
public function handle(): void
3636
{
3737
$services = $this->gatherServicesInteractively();
3838

3939
if ($invalidServices = array_diff($services, $this->services)) {
40-
$this->components->error('Invalid services ['.implode(',', $invalidServices).'].');
40+
$this->components->error('Invalid services [' . implode(',', $invalidServices) . '].');
4141

42-
return 1;
42+
return;
4343
}
4444

4545
$this->buildDockerCompose($services);

src/Console/Concerns/InteractsWithDockerComposeServices.php

+9-7
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected function buildDockerCompose(array $services)
6262

6363
// Adds the new services as dependencies of the core service...
6464
if (! array_key_exists('core', $compose['services'])) {
65-
$this->warn('Couldn\'t find the --core-- service. Make sure you add ['.implode(',', $services).'] to the depends_on config.');
65+
$this->warn('Couldn\'t find the --core-- service. Make sure you add [' . implode(',', $services) . '] to the depends_on config.');
6666
} else {
6767
$compose['services']['core']['depends_on'] = collect($compose['services']['core']['depends_on'] ?? [])
6868
->merge($services)
@@ -111,9 +111,11 @@ protected function replaceEnvVariables(array $services)
111111
{
112112
$environment = file_get_contents($this->laravel->basePath('.env'));
113113

114-
if (in_array('mysql', $services) ||
114+
if (
115+
in_array('mysql', $services) ||
115116
in_array('mariadb', $services) ||
116-
in_array('pgsql', $services)) {
117+
in_array('pgsql', $services)
118+
) {
117119
$defaults = [
118120
'# DB_HOST=127.0.0.1',
119121
'# DB_PORT=3306',
@@ -130,7 +132,7 @@ protected function replaceEnvVariables(array $services)
130132
if (in_array('mysql', $services)) {
131133
$environment = preg_replace('/DB_CONNECTION=.*/', 'DB_CONNECTION=mysql', $environment);
132134
$environment = str_replace('DB_HOST=127.0.0.1', "DB_HOST=mysql", $environment);
133-
}elseif (in_array('pgsql', $services)) {
135+
} elseif (in_array('pgsql', $services)) {
134136
$environment = preg_replace('/DB_CONNECTION=.*/', 'DB_CONNECTION=pgsql', $environment);
135137
$environment = str_replace('DB_HOST=127.0.0.1', "DB_HOST=pgsql", $environment);
136138
$environment = str_replace('DB_PORT=3306', "DB_PORT=5432", $environment);
@@ -207,7 +209,7 @@ protected function prepareInstallation($services)
207209

208210
if (count($services) > 0) {
209211
$this->runCommands([
210-
'./vendor/bin/nge pull '.implode(' ', $services),
212+
'./vendor/bin/nge pull ' . implode(' ', $services),
211213
]);
212214
}
213215

@@ -230,12 +232,12 @@ protected function runCommands($commands)
230232
try {
231233
$process->setTty(true);
232234
} catch (\RuntimeException $e) {
233-
$this->output->writeln(' <bg=yellow;fg=black> WARN </> '.$e->getMessage().PHP_EOL);
235+
$this->output->writeln(' <bg=yellow;fg=black> WARN </> ' . $e->getMessage() . PHP_EOL);
234236
}
235237
}
236238

237239
return $process->run(function ($type, $line) {
238-
$this->output->write(' '.$line);
240+
$this->output->write(' ' . $line);
239241
});
240242
}
241243
}

src/Console/InstallCommand.php

+7-9
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
namespace Dentro\Nge\Console;
44

55
use Illuminate\Console\Command;
6-
use RuntimeException;
76
use Symfony\Component\Console\Attribute\AsCommand;
8-
use Symfony\Component\Process\Process;
97

108
#[AsCommand(name: 'nge:install')]
119
class InstallCommand extends Command
@@ -29,10 +27,8 @@ class InstallCommand extends Command
2927

3028
/**
3129
* Execute the console command.
32-
*
33-
* @return int|null
3430
*/
35-
public function handle()
31+
public function handle(): void
3632
{
3733
if ($this->option('no-interaction')) {
3834
$services = $this->defaultServices;
@@ -41,9 +37,9 @@ public function handle()
4137
}
4238

4339
if ($invalidServices = array_diff($services, $this->services)) {
44-
$this->components->error('Invalid services ['.implode(',', $invalidServices).'].');
40+
$this->components->error('Invalid services [' . implode(',', $invalidServices) . '].');
4541

46-
return 1;
42+
return;
4743
}
4844

4945
$this->buildDockerCompose($services);
@@ -57,9 +53,11 @@ public function handle()
5753

5854
$this->output->writeln('<fg=gray>➜</> <options=bold>./vendor/bin/nge up</>');
5955

60-
if (in_array('mysql', $services) ||
56+
if (
57+
in_array('mysql', $services) ||
6158
in_array('mariadb', $services) ||
62-
in_array('pgsql', $services)) {
59+
in_array('pgsql', $services)
60+
) {
6361
$this->components->warn('A database service was installed. Run "artisan migrate" to prepare your database:');
6462

6563
$this->output->writeln('<fg=gray>➜</> <options=bold>./vendor/bin/nge artisan migrate</>');

0 commit comments

Comments
 (0)