From c89c8afcae6c2fef7fc4ae917f8da7049e62c2e6 Mon Sep 17 00:00:00 2001 From: Oskars Germovs Date: Sun, 12 Feb 2023 12:10:33 +0200 Subject: [PATCH] 1.) added: code format ReComposerController: 1.) added: direct di injection the laravel way 2.) added: code format ReComposer: 1.) replaced: array_first to Arr::first to avoid breaking on newer versions composer.json: 1.) removed: support for laravel 8 and below 2.) removed: support for php 7.4 3.) added: bugfix to dependencies install --- CONTRIBUTING.md | 14 +- LICENSE.md | 25 +- README.md | 28 +- REPORT.md | 32 +- composer.json | 7 +- config/recomposer.php | 14 +- src/Controllers/ReComposerController.php | 32 +- src/ReComposer.php | 434 ++++++++++++----------- src/ReComposerServiceProvider.php | 8 +- tests/ReComposerTest.php | 14 +- 10 files changed, 317 insertions(+), 291 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 275b33f..e594aff 100755 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,9 @@ Contributions are welcome and will be fully credited. Contributions are accepted via Pull Requests on [Github](https://github.com/solumdesignum/recomposer). # Things you could do + If you want to contribute but do not know where to start, this list provides some starting points. + - Add license text - Remove rewriteRules.php - Set up TravisCI, StyleCI, ScrutinizerCI @@ -17,13 +19,17 @@ If you want to contribute but do not know where to start, this list provides som - **Add tests!** - Your patch won't be accepted if it doesn't have tests. -- **Document any change in behaviour** - Make sure the `readme.md` and any other relevant documentation are kept up-to-date. +- **Document any change in behaviour** - Make sure the `readme.md` and any other relevant documentation are kept + up-to-date. -- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. +- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs + is not an option. - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. -- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. - +- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make + multiple intermediate commits while developing, + please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) + before submitting. **Happy coding**! diff --git a/LICENSE.md b/LICENSE.md index 610b3cb..5545682 100755 --- a/LICENSE.md +++ b/LICENSE.md @@ -2,20 +2,15 @@ MIT License Copyright (c) Oskars Germovs -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the +Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index a98fb12..fb788a6 100755 --- a/README.md +++ b/README.md @@ -6,19 +6,26 @@ [![MIT Licensed](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) ## Introduction -Laravel ReComposer decomposes and lists all the installed packages with their -dependencies along with the Laravel & the Server environment details your app is running in. + +Laravel ReComposer decomposes and lists all the installed packages with their dependencies along with the Laravel & the +Server environment details your app is running in. ## Required before installation + Please make sure du is installed on linux, or unix, mac. ### Important -I regret to inform windows currently is not supported. + +I regret to inform windows currently is not supported. + #### Exceptions to this is rule is + Any type of virtualization docker, Virtual Machine and anything similar to it. ## Installation + To get started, install ReComposer using the Composer package manager: + ```shell composer require solumdesignum/recomposer ``` @@ -29,11 +36,12 @@ Next, publish ReComposer resources using the vendor:publish command: php artisan vendor:publish --provider="SolumDeSignum\ReComposer\ReComposerServiceProvider" ``` -This command will publish a config to your config directory, which will be -created if it does not exist. +This command will publish a config to your config directory, which will be created if it does not exist. ### ReComposer Features + The configuration file contains configurations. + ```php base_path(), - 'binary' => [ - 'format' => 'kilobytes', - 'search' => 'MiB', + 'binary' => [ + 'format' => 'kilobytes', + 'search' => 'MiB', 'replace' => 'mb', ], - 'view' => 'solumdesignum/recomposer::index', + 'view' => 'solumdesignum/recomposer::index', 'cache' => [ 'feature' => false, - 'hours' => 1, + 'hours' => 1, ], 'icon' => [ - 'check' => '', + 'check' => '', 'uncheck' => '', ], 'exclude' => [ @@ -34,7 +34,7 @@ ], ], 'packages' => [ - 'enabled' => true, + 'enabled' => true, 'blacklist' => [ 'php', 'roave/security-advisories', diff --git a/src/Controllers/ReComposerController.php b/src/Controllers/ReComposerController.php index 356f9b3..5b44c9a 100755 --- a/src/Controllers/ReComposerController.php +++ b/src/Controllers/ReComposerController.php @@ -4,38 +4,30 @@ namespace SolumDeSignum\ReComposer\Controllers; -use function config; use Illuminate\View\View; use SolumDeSignum\ReComposer\ReComposer; +use function config; + class ReComposerController { - private ReComposer $recomposer; - - /** - * ReComposerController constructor. - */ - public function __construct() - { - $this->recomposer = new ReComposer(); - } - /** + * @param ReComposer $recomposer * @return View */ - public function index(): View + public function index(ReComposer $recomposer): View { return view( config('recomposer.view', 'solumdesignum/recomposer::index'), [ - 'packages' => $this->recomposer->packages, - 'laravelEnv' => $this->recomposer->laravelEnvironment(), - 'serverEnv' => $this->recomposer->serverEnvironment(), - 'serverExtras' => $this->recomposer->serverExtras(), - 'laravelExtras' => $this->recomposer->laravelExtras(), - 'extraStats' => $this->recomposer->extraStats(), - 'iconCheck' => config('recomposer.icon.check'), - 'iconUncheck' => config('recomposer.icon.uncheck'), + 'packages' => $recomposer->packages, + 'laravelEnv' => $recomposer->laravelEnvironment(), + 'serverEnv' => $recomposer->serverEnvironment(), + 'serverExtras' => $recomposer->serverExtras(), + 'laravelExtras' => $recomposer->laravelExtras(), + 'extraStats' => $recomposer->extraStats(), + 'iconCheck' => config('recomposer.icon.check'), + 'iconUncheck' => config('recomposer.icon.uncheck'), ] ); } diff --git a/src/ReComposer.php b/src/ReComposer.php index 25bcefc..d97ded3 100755 --- a/src/ReComposer.php +++ b/src/ReComposer.php @@ -5,27 +5,35 @@ namespace SolumDeSignum\ReComposer; use App; -use function array_first; +use ByteUnits\Binary; +use Illuminate\Contracts\Filesystem\FileNotFoundException; +use Illuminate\Support\Arr; +use Illuminate\Support\Facades\Cache; +use Illuminate\Support\Facades\File; +use Illuminate\Support\Facades\Request; +use Illuminate\Support\Str; +use JsonException; + +use function array_key_exists; use function array_merge; use function base_path; -use ByteUnits\Binary; use function collect; use function config; use function exec; use function explode; +use function extension_loaded; +use function file_get_contents; use function get_loaded_extensions; -use Illuminate\Contracts\Filesystem\FileNotFoundException; -use Illuminate\Support\Facades\Cache; -use Illuminate\Support\Facades\File; -use Illuminate\Support\Facades\Request; -use Illuminate\Support\Str; use function implode; use function in_array; -use const JSON_THROW_ON_ERROR; -use JsonException; +use function is_writable; +use function json_decode; use function now; +use function php_uname; use function strtolower; +use const JSON_THROW_ON_ERROR; + class ReComposer { public string $packageName; @@ -50,89 +58,185 @@ public function __construct() { $this->composer = $this->composerJson(); $this->packages = $this->packagesWithDependencies(); - $this->packageName = ReComposerServiceProvider::$namespaceSuffix.'/'.ReComposerServiceProvider::$alias; + $this->packageName = ReComposerServiceProvider::$namespaceSuffix . '/' . ReComposerServiceProvider::$alias; } /** - * Get the ReComposer system report as a PHP array. + * Get the Composer file contents as an array. * - * @throws FileNotFoundException + * @return array * @throws JsonException * + */ + private function composerJson(): array + { + $composerJson = file_get_contents(base_path('composer.json')); + + return json_decode((string)$composerJson, true, 512, JSON_THROW_ON_ERROR); + } + + /** * @return array + * @throws JsonException + * + * @throws FileNotFoundException */ - final public function report(): array + private function packagesWithDependencies(): array { - $reportResponse = []; - $reportResponse['Server Environment'] = $this->serverEnvironment(); - $reportResponse['Laravel Environment'] = $this->laravelEnvironment(); - $reportResponse['Installed Packages'] = $this->installedPackages(); + $responseRequirePackages = $this->collectPackages('require'); + $responseRequireDevPackages = $this->collectPackages('require-dev'); - if (!empty($this->extraStats())) { - $reportResponse['Extra Stats'] = $this->extraStats(); + return array_merge($responseRequirePackages, $responseRequireDevPackages); + } + + /** + * Get Installed packages & their Dependencies. + * + * @param string $requireType + * + * @return array + * @throws JsonException + * + * @throws FileNotFoundException + */ + private function collectPackages(string $requireType): array + { + $responsePackages = []; + foreach ($this->composer[$requireType] as $packageName => $version) { + if (!in_array($packageName, $this->excludeBlacklistPackages(), true)) { + $packageComposerJson = base_path( + "/vendor/{$packageName}/composer.json" + ); + + $packageComposerJson = File::get($packageComposerJson); + $responseDependencies = json_decode( + $packageComposerJson, + true, + 512, + JSON_THROW_ON_ERROR + ); + + $responsePackages[] = [ + 'name' => $packageName, + 'version' => $version, + 'dependencies' => $this->dependencies( + 'require', + $responseDependencies + ), + 'dev-dependencies' => $this->dependencies( + 'require-dev', + $responseDependencies + ), + ]; + } } - return $reportResponse; + return $responsePackages; } /** - * Add Extra stats by app or any other package dev. - * - * @param array $extraStats + * @return array */ - final public function addExtraStats(array $extraStats): void + private function excludeBlacklistPackages(): array { - $this->extraStats = \array_merge($this->extraStats, $extraStats); + $extensions = collect(get_loaded_extensions()) + ->map( + function (string $ext) { + return 'ext-' . strtolower($ext); + } + ); + + if (config('recomposer.exclude.packages.enabled')) { + foreach (config('recomposer.exclude.packages.blacklist') as $package) { + $extensions->add($package); + } + } + + return $extensions->toArray(); } /** - * Add Laravel specific stats by app or any other package dev. + * @param string $key + * @param array $responseDependencies * - * @param array $laravelStats + * @return mixed */ - final public function addLaravelStats(array $laravelStats): void + private function dependencies(string $key, array $responseDependencies) { - $this->laravelExtras = \array_merge($this->laravelExtras, $laravelStats); + return array_key_exists( + $key, + $responseDependencies + ) ? + $responseDependencies[$key] : + 'No dependencies'; } /** - * Add Server specific stats by app or any other package dev. + * Get the ReComposer system report as a PHP array. * - * @param array $serverStats + * @return array + * @throws JsonException + * + * @throws FileNotFoundException */ - final public function addServerStats(array $serverStats): void + final public function report(): array { - $this->serverExtras = \array_merge($this->serverExtras, $serverStats); + $reportResponse = []; + $reportResponse['Server Environment'] = $this->serverEnvironment(); + $reportResponse['Laravel Environment'] = $this->laravelEnvironment(); + $reportResponse['Installed Packages'] = $this->installedPackages(); + + if (!empty($this->extraStats())) { + $reportResponse['Extra Stats'] = $this->extraStats(); + } + + return $reportResponse; } /** - * Get the extra stats added by the app or any other package dev. + * Get PHP/Server environment details. * * @return array */ - final public function extraStats(): array + public function serverEnvironment(): array { - return $this->extraStats; + return array_merge( + [ + 'version' => PHP_VERSION, + 'server_software' => $_SERVER['SERVER_SOFTWARE'], + 'server_os' => php_uname(), + 'database_connection_name' => config('database.default'), + 'ssl_installed' => $this->isSecure(), + 'cache_driver' => config('cache.default'), + 'session_driver' => config('session.driver'), + 'openssl' => extension_loaded('openssl'), + 'pdo' => extension_loaded('pdo'), + 'mbstring' => extension_loaded('mbstring'), + 'tokenizer' => extension_loaded('tokenizer'), + 'xml' => extension_loaded('xml'), + ], + $this->serverExtras() + ); } /** - * Get additional server info added by the app or any other package dev. + * Check if SSL is installed or not. * - * @return array + * @return bool */ - final public function serverExtras(): array + private function isSecure(): bool { - return $this->serverExtras; + return Request::isSecure(); } /** - * Get additional laravel info added by the app or any other package dev. + * Get additional server info added by the app or any other package dev. * * @return array */ - final public function laravelExtras(): array + final public function serverExtras(): array { - return $this->laravelExtras; + return $this->serverExtras; } /** @@ -142,18 +246,18 @@ final public function laravelExtras(): array */ final public function laravelEnvironment(): array { - return \array_merge( + return array_merge( [ - 'version' => App::version(), - 'timezone' => config('app.timezone'), - 'debug_mode' => config('app.debug'), - 'storage_dir_writable' => \is_writable(base_path('storage')), - 'cache_dir_writable' => \is_writable(base_path('bootstrap/cache')), - 'decomposer_version' => $this->packageVersion(), - 'app_size' => Str::replaceFirst( + 'version' => App::version(), + 'timezone' => config('app.timezone'), + 'debug_mode' => config('app.debug'), + 'storage_dir_writable' => is_writable(base_path('storage')), + 'cache_dir_writable' => is_writable(base_path('bootstrap/cache')), + 'decomposer_version' => $this->packageVersion(), + 'app_size' => Str::replaceFirst( config('recomposer.binary.search', 'MiB'), config('recomposer.binary.replace', 'mb'), - (string) $this->appSize() + (string)$this->appSize() ), ], $this->laravelExtras() @@ -161,27 +265,27 @@ final public function laravelEnvironment(): array } /** + * Get current installed ReComposer version. + * * @return string */ - final public function binaryFormat(): string + private function packageVersion(): string { - $binaryFormat = config('recomposer.binary.format'); + $version = $this->composer['require-dev'][$this->packageName] ?? + $this->composer['require'][$this->packageName] ?? + 'unknown'; - return Binary::$binaryFormat($this->directorySize())->format(); - } + foreach ($this->packages as $package) { + if (isset($package['dependencies'][$this->packageName])) { + $version = $package['dependencies'][$this->packageName]; + } - /** - * @return string|null - */ - final public function cacheRemember(): ?string - { - return Cache::remember( - 'recomposer.folderSize', - now()->addHours(config('recomposer.cache.hours', 1)), - function () { - return $this->binaryFormat(); + if (isset($package['dev-dependencies'][$this->packageName])) { + $version = $package['dev-dependencies'][$this->packageName]; } - ); + } + + return $version; } /** @@ -195,148 +299,63 @@ final public function appSize(): ?string } /** - * Get PHP/Server environment details. - * - * @return array + * @return string|null */ - public function serverEnvironment(): array + final public function cacheRemember(): ?string { - return \array_merge( - [ - 'version' => PHP_VERSION, - 'server_software' => $_SERVER['SERVER_SOFTWARE'], - 'server_os' => \php_uname(), - 'database_connection_name' => config('database.default'), - 'ssl_installed' => $this->isSecure(), - 'cache_driver' => config('cache.default'), - 'session_driver' => config('session.driver'), - 'openssl' => \extension_loaded('openssl'), - 'pdo' => \extension_loaded('pdo'), - 'mbstring' => \extension_loaded('mbstring'), - 'tokenizer' => \extension_loaded('tokenizer'), - 'xml' => \extension_loaded('xml'), - ], - $this->serverExtras() + return Cache::remember( + 'recomposer.folderSize', + now()->addHours(config('recomposer.cache.hours', 1)), + function () { + return $this->binaryFormat(); + } ); } /** - * Get the Composer file contents as an array. - * - * @throws JsonException - * - * @return array - */ - private function composerJson(): array - { - $composerJson = \file_get_contents(base_path('composer.json')); - - return \json_decode((string) $composerJson, true, 512, JSON_THROW_ON_ERROR); - } - - /** - * @param string $key - * @param array $responseDependencies - * - * @return mixed - */ - private function dependencies(string $key, array $responseDependencies) - { - return \array_key_exists( - $key, - $responseDependencies - ) ? - $responseDependencies[$key] : - 'No dependencies'; - } - - /** - * @return array + * @return string */ - private function excludeBlacklistPackages(): array + final public function binaryFormat(): string { - $extensions = collect(get_loaded_extensions()) - ->map( - function (string $ext) { - return 'ext-'.strtolower($ext); - } - ); - - if (config('recomposer.exclude.packages.enabled')) { - foreach (config('recomposer.exclude.packages.blacklist') as $package) { - $extensions->add($package); - } - } + $binaryFormat = config('recomposer.binary.format'); - return $extensions->toArray(); + return Binary::$binaryFormat($this->directorySize())->format(); } /** - * Get Installed packages & their Dependencies. - * - * @param string $requireType - * - * @throws FileNotFoundException - * @throws JsonException - * - * @return array + * @return int */ - private function collectPackages(string $requireType): array + private function directorySize(): int { - $responsePackages = []; - foreach ($this->composer[$requireType] as $packageName => $version) { - if (!in_array($packageName, $this->excludeBlacklistPackages(), true)) { - $packageComposerJson = base_path( - "/vendor/{$packageName}/composer.json" - ); - - $packageComposerJson = File::get($packageComposerJson); - $responseDependencies = \json_decode( - $packageComposerJson, - true, - 512, - JSON_THROW_ON_ERROR - ); - - $responsePackages[] = [ - 'name' => $packageName, - 'version' => $version, - 'dependencies' => $this->dependencies( - 'require', - $responseDependencies - ), - 'dev-dependencies' => $this->dependencies( - 'require-dev', - $responseDependencies - ), - ]; - } - } + $basePath = config('recomposer.basePath'); + $excludeDirectories = implode( + ' ', + config('recomposer.exclude.folder.blacklist') + ); + $execResponse = exec("du $basePath" . ' ' . $excludeDirectories); + $directorySize = explode("\t", $execResponse); - return $responsePackages; + /** @scrutinizer ignore-call */ + return (int)Arr::first($directorySize); } /** - * @throws FileNotFoundException - * @throws JsonException + * Get additional laravel info added by the app or any other package dev. * * @return array */ - private function packagesWithDependencies(): array + final public function laravelExtras(): array { - $responseRequirePackages = $this->collectPackages('require'); - $responseRequireDevPackages = $this->collectPackages('require-dev'); - - return array_merge($responseRequirePackages, $responseRequireDevPackages); + return $this->laravelExtras; } /** * Get Installed packages & their version numbers as an associative array. * - * @throws JsonException + * @return array * @throws FileNotFoundException * - * @return array + * @throws JsonException */ private function installedPackages(): array { @@ -349,53 +368,42 @@ private function installedPackages(): array } /** - * Get current installed ReComposer version. + * Get the extra stats added by the app or any other package dev. * - * @return string + * @return array */ - private function packageVersion(): string + final public function extraStats(): array { - $version = $this->composer['require-dev'][$this->packageName] ?? - $this->composer['require'][$this->packageName] ?? - 'unknown'; - - foreach ($this->packages as $package) { - if (isset($package['dependencies'][$this->packageName])) { - $version = $package['dependencies'][$this->packageName]; - } - - if (isset($package['dev-dependencies'][$this->packageName])) { - $version = $package['dev-dependencies'][$this->packageName]; - } - } - - return $version; + return $this->extraStats; } /** - * Check if SSL is installed or not. + * Add Extra stats by app or any other package dev. * - * @return bool + * @param array $extraStats */ - private function isSecure(): bool + final public function addExtraStats(array $extraStats): void { - return Request::isSecure(); + $this->extraStats = array_merge($this->extraStats, $extraStats); } /** - * @return int + * Add Laravel specific stats by app or any other package dev. + * + * @param array $laravelStats */ - private function directorySize(): int + final public function addLaravelStats(array $laravelStats): void { - $basePath = config('recomposer.basePath'); - $excludeDirectories = implode( - ' ', - config('recomposer.exclude.folder.blacklist') - ); - $execResponse = exec("du $basePath".' '.$excludeDirectories); - $directorySize = explode("\t", $execResponse); + $this->laravelExtras = array_merge($this->laravelExtras, $laravelStats); + } - /** @scrutinizer ignore-call */ - return (int) array_first($directorySize); + /** + * Add Server specific stats by app or any other package dev. + * + * @param array $serverStats + */ + final public function addServerStats(array $serverStats): void + { + $this->serverExtras = array_merge($this->serverExtras, $serverStats); } } diff --git a/src/ReComposerServiceProvider.php b/src/ReComposerServiceProvider.php index dc93a4b..5b8e4c8 100755 --- a/src/ReComposerServiceProvider.php +++ b/src/ReComposerServiceProvider.php @@ -24,14 +24,14 @@ class ReComposerServiceProvider extends ServiceProvider public function boot(): void { $this->loadViewsFrom( - __DIR__.'/../resources/views', - self::$namespaceSuffix.'/'.self::$alias + __DIR__ . '/../resources/views', + self::$namespaceSuffix . '/' . self::$alias ); if ($this->app->runningInConsole()) { $this->publishes( [ - __DIR__.'/../config/recomposer.php' => config_path( + __DIR__ . '/../config/recomposer.php' => config_path( 'recomposer.php' ), ], @@ -43,7 +43,7 @@ public function boot(): void public function register(): void { $this->mergeConfigFrom( - __DIR__.'/../config/recomposer.php', + __DIR__ . '/../config/recomposer.php', 'recomposer' ); } diff --git a/tests/ReComposerTest.php b/tests/ReComposerTest.php index 8c301c6..0c6e7b1 100755 --- a/tests/ReComposerTest.php +++ b/tests/ReComposerTest.php @@ -15,12 +15,6 @@ class ReComposerTest extends BaseTestCase { private ReComposer $recomposer; - protected function setUp(): void - { - parent::setUp(); - $this->recomposer = new ReComposer(); - } - /** * Filter out laravel package * Verify is laravel installed @@ -51,9 +45,15 @@ final public function laravel(): void */ public function createApplication(): Application { - $app = include __DIR__.'/../../../../bootstrap/app.php'; + $app = include __DIR__ . '/../../../../bootstrap/app.php'; $app->make(Kernel::class)->bootstrap(); return $app; } + + protected function setUp(): void + { + parent::setUp(); + $this->recomposer = new ReComposer(); + } }