Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PHP-CS-Fixer #10

Merged
merged 4 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
1.3.2
=====

* (bug) Remove breaking rule.


1.3.1
=====

* (improvement) Bump required PHP-CS-Fixer versions.
* (improvement) Make PHP-CS-Fixer script calls clearer.


1.3.0
=====

Expand Down
2 changes: 1 addition & 1 deletion _init/library/vendor-bin/cs-fixer/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require-dev": {
"21torr/php-cs-fixer": "^1.0.2",
"21torr/php-cs-fixer": "^1.1.1",
"roave/security-advisories": "dev-latest"
}
}
2 changes: 1 addition & 1 deletion _init/symfony/vendor-bin/cs-fixer/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require-dev": {
"21torr/php-cs-fixer": "^1.0.2",
"21torr/php-cs-fixer": "^1.1.1",
"roave/security-advisories": "dev-latest"
}
}
1 change: 1 addition & 0 deletions src/Command/InitializeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ protected function execute (InputInterface $input, OutputInterface $output) : in
catch (\Throwable $exception)
{
$io->error("Running janus failed: {$exception->getMessage()}");

return 2;
}
}
Expand Down
17 changes: 7 additions & 10 deletions src/Initializer/InitializeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function __construct (
private TorrStyle $io,
)
{
$this->cwd = (string) \getcwd();
$this->cwd = (string) getcwd();
}

/**
Expand All @@ -36,7 +36,6 @@ public function copyFilesIntoProject (string $directory) : void
]);
}


/**
* Add the given config to the projects composer.json
*
Expand All @@ -60,8 +59,8 @@ public function addToProjectComposerJson (array $config) : void
* If there are multiple lines matching, all will be replaced.
* If there are no lines matching, the call will just be appended.
*
* @param string $key The scripts key to update.
* @param array<string, string> $scripts The scripts to replace.
* @param string $key the scripts key to update
* @param array<string, string> $scripts the scripts to replace
*/
public function updateProjectComposerJsonScripts (string $key, array $scripts) : void
{
Expand Down Expand Up @@ -107,7 +106,7 @@ private function writeProjectComposerJson (array $config) : void

file_put_contents(
$filePath,
\json_encode(
json_encode(
$config,
\JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_THROW_ON_ERROR,
),
Expand All @@ -121,16 +120,16 @@ private function readProjectComposerJson () : array
{
$filePath = "{$this->cwd}/composer.json";

$result = \json_decode(
(string) \file_get_contents($filePath),
$result = json_decode(
(string) file_get_contents($filePath),
true,
flags: \JSON_THROW_ON_ERROR,
);
\assert(\is_array($result));

return $result;
}


/**
* Runs a composer command in the project
*
Expand All @@ -151,7 +150,6 @@ public function runComposerInProject (array $cmd) : void
$this->runProcessInProject($cmd);
}


/**
* Runs the given command in the project directory
*
Expand Down Expand Up @@ -180,5 +178,4 @@ public function runProcessInProject (array $cmd) : void
);
}
}

}
2 changes: 1 addition & 1 deletion src/Initializer/LibraryInitializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function initialize (TorrStyle $io) : int
]);
$helper->updateProjectComposerJsonScripts("lint", [
"normalize" => "@composer bin c-norm normalize \"$(pwd)/composer.json\" --indent-style tab --indent-size 1 --dry-run --ansi",
"cs-fixer" => "vendor-bin/cs-fixer/vendor/bin/php-cs-fixer fix --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php --dry-run --no-interaction --ansi",
"cs-fixer" => "vendor-bin/cs-fixer/vendor/bin/php-cs-fixer check --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php --no-interaction --ansi",
]);
$helper->updateProjectComposerJsonScripts("test", [
"phpstan" => "vendor-bin/phpstan/vendor/bin/phpstan analyze -c phpstan.neon . --ansi",
Expand Down
2 changes: 1 addition & 1 deletion src/Initializer/SymfonyInitializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function initialize (TorrStyle $io) : int
"lint:yaml" => "bin/console lint:yaml config --parse-tags",
"lint:twig" => "bin/console lint:twig templates",
"normalize" => "@composer bin c-norm normalize \"$(pwd)/composer.json\" --indent-style tab --indent-size 1 --dry-run --ansi",
"cs-fixer" => "vendor-bin/cs-fixer/vendor/bin/php-cs-fixer fix --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php --dry-run --no-interaction --ansi",
"cs-fixer" => "vendor-bin/cs-fixer/vendor/bin/php-cs-fixer check --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php --no-interaction --ansi",
]);
$helper->updateProjectComposerJsonScripts("test", [
"phpstan" => "vendor-bin/phpstan/vendor/bin/phpstan analyze -c phpstan.neon . --ansi",
Expand Down
2 changes: 1 addition & 1 deletion vendor-bin/cs-fixer/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require-dev": {
"21torr/php-cs-fixer": "^1.0.2",
"21torr/php-cs-fixer": "^1.1.1",
"roave/security-advisories": "dev-latest"
}
}