Skip to content

Commit c3da51a

Browse files
committed
[fix] fix confilict
2 parents cbeddd8 + 1bec27f commit c3da51a

File tree

103 files changed

+457
-900
lines changed

Some content is hidden

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

103 files changed

+457
-900
lines changed

composer.json

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,78 @@
11
{
2-
"name": "nwidart/laravel-modules",
3-
"description": "Laravel Module management",
4-
"keywords": [
5-
"modules",
6-
"laravel",
7-
"nwidart",
8-
"module",
9-
"rad"
10-
],
11-
"license": "MIT",
12-
"authors": [
13-
{
14-
"name": "Nicolas Widart",
15-
"email": "[email protected]",
16-
"homepage": "https://nicolaswidart.com",
17-
"role": "Developer"
18-
}
19-
],
20-
"require": {
21-
"php": ">=8.2",
22-
"ext-dom": "*",
23-
"ext-json": "*",
24-
"ext-simplexml": "*",
25-
"wikimedia/composer-merge-plugin": "^2.1"
26-
},
27-
"require-dev": {
28-
"phpunit/phpunit": "^11.0",
29-
"mockery/mockery": "^1.6",
30-
"orchestra/testbench": "^v9.0",
31-
"friendsofphp/php-cs-fixer": "^v3.52",
32-
"laravel/framework": "^v11.33",
33-
"laravel/pint": "^1.16",
34-
"spatie/phpunit-snapshot-assertions": "^5.0",
35-
"phpstan/phpstan": "^1.4"
36-
},
37-
"autoload": {
38-
"psr-4": {
39-
"Nwidart\\Modules\\": "src"
2+
"name": "nwidart/laravel-modules",
3+
"description": "Laravel Module management",
4+
"keywords": [
5+
"modules",
6+
"laravel",
7+
"nwidart",
8+
"module",
9+
"rad"
10+
],
11+
"license": "MIT",
12+
"authors": [
13+
{
14+
"name": "Nicolas Widart",
15+
"email": "[email protected]",
16+
"homepage": "https://nicolaswidart.com",
17+
"role": "Developer"
18+
}
19+
],
20+
"require": {
21+
"php": ">=8.2",
22+
"ext-dom": "*",
23+
"ext-json": "*",
24+
"ext-simplexml": "*",
25+
"wikimedia/composer-merge-plugin": "^2.1"
4026
},
41-
"files": [
42-
"src/helpers.php"
43-
]
44-
},
45-
"autoload-dev": {
46-
"psr-4": {
47-
"Nwidart\\Modules\\Tests\\": "tests",
48-
"Modules\\Recipe\\": "tests/stubs/valid/Recipe"
49-
}
50-
},
51-
"extra": {
52-
"laravel": {
53-
"providers": [
54-
"Nwidart\\Modules\\LaravelModulesServiceProvider"
55-
],
56-
"aliases": {
57-
"Module": "Nwidart\\Modules\\Facades\\Module"
58-
}
27+
"require-dev": {
28+
"phpunit/phpunit": "^11.0",
29+
"mockery/mockery": "^1.6",
30+
"orchestra/testbench": "^v9.0",
31+
"friendsofphp/php-cs-fixer": "^v3.52",
32+
"laravel/framework": "^v11.33",
33+
"laravel/pint": "^1.16",
34+
"spatie/phpunit-snapshot-assertions": "^5.0",
35+
"phpstan/phpstan": "^1.4"
5936
},
60-
"branch-alias": {
61-
"dev-master": "11.0-dev"
62-
}
63-
},
64-
"config": {
65-
"allow-plugins": {
66-
"wikimedia/composer-merge-plugin": true
67-
}
68-
},
69-
"scripts": {
70-
"update-snapshots": "./phpunit --no-coverage -d --update-snapshots",
71-
"lint": "pint",
72-
"test": "phpunit",
73-
"test-coverage": "phpunit --coverage-html coverage",
74-
"pcf": "vendor/bin/php-cs-fixer fix --verbose"
75-
},
76-
"minimum-stability": "dev",
77-
"prefer-stable": true
37+
"autoload": {
38+
"psr-4": {
39+
"Nwidart\\Modules\\": "src"
40+
},
41+
"files": [
42+
"src/helpers.php"
43+
]
44+
},
45+
"autoload-dev": {
46+
"psr-4": {
47+
"Nwidart\\Modules\\Tests\\": "tests",
48+
"Modules\\Recipe\\": "tests/stubs/valid/Recipe"
49+
}
50+
},
51+
"extra": {
52+
"laravel": {
53+
"providers": [
54+
"Nwidart\\Modules\\LaravelModulesServiceProvider"
55+
],
56+
"aliases": {
57+
"Module": "Nwidart\\Modules\\Facades\\Module"
58+
}
59+
},
60+
"branch-alias": {
61+
"dev-master": "11.0-dev"
62+
}
63+
},
64+
"config": {
65+
"allow-plugins": {
66+
"wikimedia/composer-merge-plugin": true
67+
}
68+
},
69+
"scripts": {
70+
"update-snapshots": "phpunit --no-coverage -d --update-snapshots",
71+
"lint": "pint",
72+
"test": "phpunit",
73+
"test-coverage": "phpunit --coverage-html coverage",
74+
"pcf": "vendor/bin/php-cs-fixer fix --verbose"
75+
},
76+
"minimum-stability": "dev",
77+
"prefer-stable": true
7878
}

config/config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
'vite' => ['LOWER_NAME', 'STUDLY_NAME', 'KEBAB_NAME'],
4545
'json' => ['LOWER_NAME', 'STUDLY_NAME', 'KEBAB_NAME', 'MODULE_NAMESPACE', 'PROVIDER_NAMESPACE'],
4646
'views/index' => ['LOWER_NAME'],
47-
'views/master' => ['LOWER_NAME', 'STUDLY_NAME', 'KEBAB_NAME',],
47+
'views/master' => ['LOWER_NAME', 'STUDLY_NAME', 'KEBAB_NAME'],
4848
'scaffold/config' => ['STUDLY_NAME'],
4949
'composer' => [
5050
'LOWER_NAME',

src/Activators/FileActivator.php

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,23 @@ class FileActivator implements ActivatorInterface
1313
{
1414
/**
1515
* Laravel Filesystem instance
16-
*
17-
* @var Filesystem
1816
*/
19-
private $files;
17+
private Filesystem $files;
2018

2119
/**
2220
* Laravel config instance
23-
*
24-
* @var Config
2521
*/
26-
private $config;
22+
private Config $config;
2723

2824
/**
2925
* Array of modules activation statuses
30-
*
31-
* @var array
3226
*/
33-
private $modulesStatuses;
27+
private array $modulesStatuses;
3428

3529
/**
3630
* File used to store activation statuses
37-
*
38-
* @var string
3931
*/
40-
private $statusesFile;
32+
private string $statusesFile;
4133

4234
public function __construct(Container $app)
4335
{
@@ -149,8 +141,6 @@ private function readJson(): array
149141

150142
/**
151143
* Reads a config parameter under the 'activators.file' key
152-
*
153-
* @return mixed
154144
*/
155145
private function config(string $key, $default = null)
156146
{

src/Collection.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,16 @@ class Collection extends BaseCollection
99
{
1010
/**
1111
* Get items collections.
12-
*
13-
* @return array
1412
*/
15-
public function getItems()
13+
public function getItems(): array
1614
{
1715
return $this->items;
1816
}
1917

2018
/**
2119
* Get the collection of items as a plain array.
22-
*
23-
* @return array
2420
*/
25-
public function toArray()
21+
public function toArray(): array
2622
{
2723
return array_map(function ($value) {
2824
if ($value instanceof Module) {

src/Commands/Actions/CheckLangCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ private function getDirectories($module)
9898

9999
private function checkMissingFiles(Collection $directories)
100100
{
101-
//show missing files
101+
// show missing files
102102
$missingFilesMessage = [];
103103

104104
$uniqeLangFiles = $directories->pluck('files')->flatten()->unique()->values();
@@ -135,7 +135,7 @@ private function checkMissingFiles(Collection $directories)
135135

136136
private function checkMissingKeys(Collection $directories)
137137
{
138-
//show missing keys
138+
// show missing keys
139139
$uniqeLangFiles = $directories->pluck('files')->flatten()->unique();
140140
$langDirectories = $directories->pluck('name');
141141

src/Commands/Actions/ModelPruneCommand.php

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
use Illuminate\Support\Str;
99
use InvalidArgumentException;
1010
use Nwidart\Modules\Facades\Module;
11+
use Symfony\Component\Console\Attribute\AsCommand;
1112
use Symfony\Component\Console\Input\InputInterface;
1213
use Symfony\Component\Console\Output\OutputInterface;
1314
use Symfony\Component\Finder\Finder;
1415

1516
use function Laravel\Prompts\multiselect;
1617

18+
#[AsCommand(name: 'module:prune')]
1719
class ModelPruneCommand extends PruneCommand implements PromptsForMissingInput
1820
{
1921
public const ALL = 'All';
@@ -48,12 +50,17 @@ protected function promptForMissingArguments(InputInterface $input, OutputInterf
4850
return;
4951
}
5052

53+
if (! empty($input->getArgument('module'))) {
54+
return;
55+
}
56+
5157
$selected_item = multiselect(
5258
label : 'Select Modules',
53-
options : [
54-
self::ALL,
55-
...array_keys(Module::all()),
56-
],
59+
options : collect(Module::allEnabled())
60+
->map(fn (\Nwidart\Modules\Module $module) => $module->getName())
61+
->prepend(self::ALL)
62+
->values()
63+
->toArray(),
5764
required: 'You must select at least one module',
5865
);
5966

@@ -82,19 +89,23 @@ protected function models(): Collection
8289
throw new InvalidArgumentException('The --models and --except options cannot be combined.');
8390
}
8491

85-
if ($this->argument('module') == [self::ALL]) {
92+
$modules = collect($this->argument('module'));
93+
94+
if ($modules->contains(self::ALL)) {
8695
$path = sprintf(
8796
'%s/*/%s',
8897
config('modules.paths.modules'),
8998
config('modules.paths.generator.model.path')
9099
);
91100
} else {
92-
$path = sprintf(
93-
'%s/{%s}/%s',
101+
$path = collect($modules)->map(fn ($module) => sprintf(
102+
'%s/%s/%s',
94103
config('modules.paths.modules'),
95-
collect($this->argument('module'))->implode(','),
104+
$module,
96105
config('modules.paths.generator.model.path')
97-
);
106+
))
107+
->filter(fn ($path) => is_dir($path))
108+
->toArray();
98109
}
99110

100111
return collect(Finder::create()->in($path)->files()->name('*.php'))
@@ -107,7 +118,8 @@ protected function models(): Collection
107118
['\\', ''],
108119
Str::after($model->getRealPath(), realpath(config('modules.paths.modules')))
109120
);
110-
})->values()
121+
})
122+
->values()
111123
->when(! empty($except), function ($models) use ($except) {
112124
return $models->reject(function ($model) use ($except) {
113125
return in_array($model, $except);

src/Commands/Database/SeedCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ public function moduleSeed(Module $module)
102102
}
103103
}
104104
} else {
105-
$class = $this->getSeederName($name); //legacy support
105+
$class = $this->getSeederName($name); // legacy support
106106

107107
$class = implode('\\', array_map('ucwords', explode('\\', $class)));
108108

109109
if (class_exists($class)) {
110110
$seeders[] = $class;
111111
} else {
112-
//look at other namespaces
112+
// look at other namespaces
113113
$classes = $this->getSeederNames($name);
114114
foreach ($classes as $class) {
115115
if (class_exists($class)) {

0 commit comments

Comments
 (0)