Skip to content

Commit a3fe058

Browse files
authored
Merge pull request #2007 from solomon-ochepa/refactor-docblocks-for-clarity
Refactor DocBlocks for clarity
2 parents 932b861 + 50277f3 commit a3fe058

File tree

102 files changed

+442
-914
lines changed

Some content is hidden

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

102 files changed

+442
-914
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/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)) {

src/Commands/UpdatePhpunitCoverage.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,31 @@ class UpdatePhpunitCoverage extends Command
2323

2424
/**
2525
* Execute the console command.
26-
*
27-
* @return int
2826
*/
2927
public function handle(): int
3028
{
3129
$appFolder = config('modules.paths.app_folder', 'app/');
32-
$appFolder = rtrim($appFolder, '/') . '/';
30+
$appFolder = rtrim($appFolder, '/').'/';
3331
$phpunitXmlPath = base_path('phpunit.xml');
3432
$modulesStatusPath = base_path('modules_statuses.json');
3533

36-
if (!file_exists($phpunitXmlPath)) {
34+
if (! file_exists($phpunitXmlPath)) {
3735
$this->error("phpunit.xml file not found: {$phpunitXmlPath}");
36+
3837
return 100;
3938
}
4039

41-
if (!file_exists($modulesStatusPath)) {
40+
if (! file_exists($modulesStatusPath)) {
4241
$this->error("Modules statuses file not found: {$modulesStatusPath}");
42+
4343
return 99;
4444
}
4545

4646
$enabledModules = json_decode(file_get_contents($modulesStatusPath), true);
4747

4848
if (json_last_error() !== JSON_ERROR_NONE) {
49-
$this->error("Error decoding JSON from {$modulesStatusPath}: " . json_last_error_msg());
49+
$this->error("Error decoding JSON from {$modulesStatusPath}: ".json_last_error_msg());
50+
5051
return 98;
5152
}
5253

@@ -55,15 +56,13 @@ public function handle(): int
5556

5657
foreach ($enabledModules as $module => $status) {
5758
if ($status) { // Only add enabled modules
58-
$moduleDir = $modulesPath . $module . '/' . $appFolder;
59+
$moduleDir = $modulesPath.$module.'/'.$appFolder;
5960
if (is_dir($moduleDir)) {
6061
$moduleDirs[] = $moduleDir;
6162
}
6263
}
6364
}
6465

65-
66-
6766
$phpunitXml = simplexml_load_file($phpunitXmlPath);
6867

6968
$sourceInclude = $phpunitXml->xpath('//source/include')[0];
@@ -77,13 +76,13 @@ public function handle(): int
7776
$directory->addAttribute('suffix', '.php');
7877
}
7978

80-
$dom = new DOMDocument();
79+
$dom = new DOMDocument;
8180
$dom->preserveWhiteSpace = false;
8281
$dom->formatOutput = true;
8382
$dom->loadXML($phpunitXml->asXML());
8483
$dom->save($phpunitXmlPath);
8584

86-
$this->info("phpunit.xml updated with enabled module directories.");
85+
$this->info('phpunit.xml updated with enabled module directories.');
8786

8887
return 0;
8988
}

src/Contracts/ConfirmableCommand.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22

33
namespace Nwidart\Modules\Contracts;
44

5-
interface ConfirmableCommand
6-
{
7-
}
5+
interface ConfirmableCommand {}

src/Contracts/PublisherInterface.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ interface PublisherInterface
66
{
77
/**
88
* Publish something.
9-
*
10-
* @return mixed
119
*/
1210
public function publish();
1311
}

0 commit comments

Comments
 (0)