diff --git a/configure.php b/configure.php index 992ec2c..1c09d6a 100644 --- a/configure.php +++ b/configure.php @@ -40,9 +40,9 @@ writeln("Namespace : {$vendorNamespace}\\{$className}"); writeln("Class name : {$className}"); writeln('---'); writeln('Packages & Utilities'); -writeln('Use Larastan/PhpStan : ' . ($usePhpStan ? 'yes' : 'no')); -writeln('Use Pint : ' . ($usePint ? 'yes' : 'no')); -writeln('Use Auto-Changelog : ' . ($useUpdateChangelogWorkflow ? 'yes' : 'no')); +writeln('Use Larastan/PhpStan : '.($usePhpStan ? 'yes' : 'no')); +writeln('Use Pint : '.($usePint ? 'yes' : 'no')); +writeln('Use Auto-Changelog : '.($useUpdateChangelogWorkflow ? 'yes' : 'no')); writeln('------'); writeln('This script will replace the above values in all relevant files in the project directory.'); @@ -70,20 +70,20 @@ foreach ($files as $file) { ]); match (true) { - str_contains($file, determineSeparator('src/Skeleton.php')) => rename($file, determineSeparator('./src/' . $className . '.php')), - str_contains($file, determineSeparator('src/SkeletonServiceProvider.php')) => rename($file, determineSeparator('./src/' . $className . 'ServiceProvider.php')), - str_contains($file, determineSeparator('src/Facades/Skeleton.php')) => rename($file, determineSeparator('./src/Facades/' . $className . '.php')), - str_contains($file, determineSeparator('src/Commands/SkeletonCommand.php')) => rename($file, determineSeparator('./src/Commands/' . $className . 'Command.php')), - str_contains($file, determineSeparator('database/migrations/create_skeleton_table.php.stub')) => rename($file, determineSeparator('./database/migrations/create_' . $packageSlugWithoutPrefix . '_table.php.stub')), - str_contains($file, determineSeparator('config/skeleton.php')) => rename($file, determineSeparator('./config/' . $packageSlugWithoutPrefix . '.php')), + str_contains($file, determineSeparator('src/Skeleton.php')) => rename($file, determineSeparator('./src/'.$className.'.php')), + str_contains($file, determineSeparator('src/SkeletonServiceProvider.php')) => rename($file, determineSeparator('./src/'.$className.'ServiceProvider.php')), + str_contains($file, determineSeparator('src/Facades/Skeleton.php')) => rename($file, determineSeparator('./src/Facades/'.$className.'.php')), + str_contains($file, determineSeparator('src/Commands/SkeletonCommand.php')) => rename($file, determineSeparator('./src/Commands/'.$className.'Command.php')), + str_contains($file, determineSeparator('database/migrations/create_skeleton_table.php.stub')) => rename($file, determineSeparator('./database/migrations/create_'.$packageSlugWithoutPrefix.'_table.php.stub')), + str_contains($file, determineSeparator('config/skeleton.php')) => rename($file, determineSeparator('./config/'.$packageSlugWithoutPrefix.'.php')), str_contains($file, 'README.md') => remove_readme_paragraphs($file), default => [], }; } if (! $usePint) { - safeUnlink(__DIR__ . '/pint.json'); - safeUnlink(__DIR__ . '/.github/workflows/pint.yml'); + safeUnlink(__DIR__.'/pint.json'); + safeUnlink(__DIR__.'/.github/workflows/pint.yml'); remove_composer_deps([ 'laravel/pint', @@ -93,9 +93,9 @@ if (! $usePint) { } if (! $usePhpStan) { - safeUnlink(__DIR__ . '/phpstan.neon.dist'); - safeUnlink(__DIR__ . '/phpstan-baseline.neon'); - safeUnlink(__DIR__ . '/.github/workflows/phpstan.yml'); + safeUnlink(__DIR__.'/phpstan.neon.dist'); + safeUnlink(__DIR__.'/phpstan-baseline.neon'); + safeUnlink(__DIR__.'/.github/workflows/phpstan.yml'); remove_composer_deps([ 'phpstan/extension-installer', @@ -111,7 +111,7 @@ if (! $usePhpStan) { } if (! $useUpdateChangelogWorkflow) { - safeUnlink(__DIR__ . '/.github/workflows/update-changelog.yml'); + safeUnlink(__DIR__.'/.github/workflows/update-changelog.yml'); } confirm('Execute `composer install` and run tests?') && run('composer install && composer test'); @@ -122,7 +122,7 @@ function ask(string $question, string $default = ''): string { $consoleColor = new ConsoleColor(); $def = $default ? $consoleColor->apply('yellow', " ({$default})") : null; - $answer = readline($consoleColor->apply('green', $question . $def . ': ')); + $answer = readline($consoleColor->apply('green', $question.$def.': ')); if (! $answer) { return $default; @@ -146,7 +146,7 @@ function confirm(string $question, bool $default = false): bool function writeln(string $line): void { - echo $line . PHP_EOL; + echo $line.PHP_EOL; } function run(string $command): string @@ -200,7 +200,7 @@ function remove_prefix(string $prefix, string $content): string function remove_composer_deps(array $names) { - $data = json_decode(file_get_contents(__DIR__ . '/composer.json'), true); + $data = json_decode(file_get_contents(__DIR__.'/composer.json'), true); foreach ($data['require-dev'] as $name => $version) { if (in_array($name, $names, true)) { @@ -208,12 +208,12 @@ function remove_composer_deps(array $names) } } - file_put_contents(__DIR__ . '/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); + file_put_contents(__DIR__.'/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); } function remove_composer_script(array $scriptNames) { - $data = json_decode(file_get_contents(__DIR__ . '/composer.json'), true); + $data = json_decode(file_get_contents(__DIR__.'/composer.json'), true); foreach ($data['scripts'] as $name => $script) { if (is_array($script)) { @@ -231,7 +231,7 @@ function remove_composer_script(array $scriptNames) } } - file_put_contents(__DIR__ . '/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); + file_put_contents(__DIR__.'/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); } function remove_readme_paragraphs(string $file): void @@ -258,12 +258,12 @@ function determineSeparator(string $path): string function replaceForWindows(): array { - return preg_split('/\\r\\n|\\r|\\n/', run('dir /S /B * | findstr /v /i .git\ | findstr /v /i vendor | findstr /v /i ' . basename(__FILE__) . ' | findstr /r /i /M /F:/ ":author :vendor :package VendorName skeleton vendor_name vendor_slug author@domain.com"')); + return preg_split('/\\r\\n|\\r|\\n/', run('dir /S /B * | findstr /v /i .git\ | findstr /v /i vendor | findstr /v /i '.basename(__FILE__).' | findstr /r /i /M /F:/ ":author :vendor :package VendorName skeleton vendor_name vendor_slug author@domain.com"')); } function replaceForAllOtherOSes(): array { - return explode(PHP_EOL, run('grep -E -r -l -i ":author|:vendor|:package|VendorName|skeleton|vendor_name|vendor_slug|author@domain.com" --exclude-dir=vendor ./* ./.github/* | grep -v ' . basename(__FILE__))); + return explode(PHP_EOL, run('grep -E -r -l -i ":author|:vendor|:package|VendorName|skeleton|vendor_name|vendor_slug|author@domain.com" --exclude-dir=vendor ./* ./.github/* | grep -v '.basename(__FILE__))); } class ConsoleColor @@ -381,7 +381,7 @@ class ConsoleColor return $text; } - return $this->escSequence(implode(';', $sequences)) . $text . $this->escSequence(self::RESET_STYLE); + return $this->escSequence(implode(';', $sequences)).$text.$this->escSequence(self::RESET_STYLE); } /** diff --git a/pint.json b/pint.json deleted file mode 100644 index 304d8f3..0000000 --- a/pint.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "preset": "laravel", - "rules": { - "blank_line_before_statement": true, - "concat_space": { - "spacing": "one" - }, - "method_argument_space": true, - "single_trait_insert_per_statement": true - } -} diff --git a/src/SkeletonServiceProvider.php b/src/SkeletonServiceProvider.php index c682d67..ea45283 100644 --- a/src/SkeletonServiceProvider.php +++ b/src/SkeletonServiceProvider.php @@ -22,11 +22,11 @@ class SkeletonServiceProvider extends PluginServiceProvider ]; protected array $styles = [ - 'plugin-skeleton' => __DIR__ . '/../resources/dist/skeleton.css', + 'plugin-skeleton' => __DIR__.'/../resources/dist/skeleton.css', ]; protected array $scripts = [ - 'plugin-skeleton' => __DIR__ . '/../resources/dist/skeleton.js', + 'plugin-skeleton' => __DIR__.'/../resources/dist/skeleton.js', ]; // protected array $beforeCoreScripts = [ diff --git a/tests/TestCase.php b/tests/TestCase.php index ff22f2a..d634f67 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -15,7 +15,7 @@ class TestCase extends Orchestra parent::setUp(); Factory::guessFactoryNamesUsing( - fn (string $modelName) => 'VendorName\\Skeleton\\Database\\Factories\\' . class_basename($modelName) . 'Factory' + fn (string $modelName) => 'VendorName\\Skeleton\\Database\\Factories\\'.class_basename($modelName).'Factory' ); }