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

[ci] php-cs-fixer it up #62

Merged
merged 1 commit into from
Jul 31, 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
6 changes: 3 additions & 3 deletions src/Command/TailwindInitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private function createTailwindConfig(SymfonyStyle $io): bool
{
$configFile = $this->tailwindBuilder->getConfigFilePath();
if (file_exists($configFile)) {
$io->note(sprintf('Tailwind config file already exists in "%s"', $configFile));
$io->note(\sprintf('Tailwind config file already exists in "%s"', $configFile));

return true;
}
Expand Down Expand Up @@ -95,12 +95,12 @@ private function addTailwindDirectives(SymfonyStyle $io): void
$inputFile = $this->tailwindBuilder->getInputCssPaths()[0];
$contents = is_file($inputFile) ? file_get_contents($inputFile) : '';
if (str_contains($contents, '@tailwind base')) {
$io->note(sprintf('Tailwind directives already exist in "%s"', $inputFile));
$io->note(\sprintf('Tailwind directives already exist in "%s"', $inputFile));

return;
}

$io->note(sprintf('Adding Tailwind directives to "%s"', $inputFile));
$io->note(\sprintf('Adding Tailwind directives to "%s"', $inputFile));
$tailwindDirectives = <<<EOF
@tailwind base;
@tailwind components;
Expand Down
12 changes: 6 additions & 6 deletions src/TailwindBinary.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public function createProcess(array $arguments = []): Process

private function downloadExecutable(): void
{
$url = sprintf('https://github.com/tailwindlabs/tailwindcss/releases/download/%s/%s', $this->getVersion(), self::getBinaryName());
$url = \sprintf('https://github.com/tailwindlabs/tailwindcss/releases/download/%s/%s', $this->getVersion(), self::getBinaryName());

$this->output?->note(sprintf('Downloading TailwindCSS binary from %s', $url));
$this->output?->note(\sprintf('Downloading TailwindCSS binary from %s', $url));

if (!is_dir($this->binaryDownloadDir.'/'.$this->getVersion())) {
mkdir($this->binaryDownloadDir.'/'.$this->getVersion(), 0777, true);
Expand Down Expand Up @@ -128,7 +128,7 @@ public static function getBinaryName(): string
return 'tailwindcss-macos-x64';
}

throw new \Exception(sprintf('No matching machine found for Darwin platform (Machine: %s).', $machine));
throw new \Exception(\sprintf('No matching machine found for Darwin platform (Machine: %s).', $machine));
}

if (str_contains($os, 'linux')) {
Expand All @@ -142,7 +142,7 @@ public static function getBinaryName(): string
return 'tailwindcss-linux-x64';
}

throw new \Exception(sprintf('No matching machine found for Linux platform (Machine: %s).', $machine));
throw new \Exception(\sprintf('No matching machine found for Linux platform (Machine: %s).', $machine));
}

if (str_contains($os, 'win')) {
Expand All @@ -153,9 +153,9 @@ public static function getBinaryName(): string
return 'tailwindcss-windows-x64.exe';
}

throw new \Exception(sprintf('No matching machine found for Windows platform (Machine: %s).', $machine));
throw new \Exception(\sprintf('No matching machine found for Windows platform (Machine: %s).', $machine));
}

throw new \Exception(sprintf('Unknown platform or architecture (OS: %s, Machine: %s).', $os, $machine));
throw new \Exception(\sprintf('Unknown platform or architecture (OS: %s, Machine: %s).', $os, $machine));
}
}
4 changes: 2 additions & 2 deletions src/TailwindBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function runBuild(

$inputPath = $this->validateInputFile($inputFile ?? $this->inputPaths[0]);
if (!\in_array($inputPath, $this->inputPaths)) {
throw new \InvalidArgumentException(sprintf('The input CSS file "%s" is not one of the configured input files.', $inputPath));
throw new \InvalidArgumentException(\sprintf('The input CSS file "%s" is not one of the configured input files.', $inputPath));
}

$arguments = ['-c', $this->configPath, '-i', $inputPath, '-o', $this->getInternalOutputCssPath($inputPath)];
Expand Down Expand Up @@ -142,7 +142,7 @@ private function validateInputFile(string $inputPath): string
return realpath($this->projectRootDir.'/'.$inputPath);
}

throw new \InvalidArgumentException(sprintf('The input CSS file "%s" does not exist.', $inputPath));
throw new \InvalidArgumentException(\sprintf('The input CSS file "%s" does not exist.', $inputPath));
}

private function createBinary(): TailwindBinary
Expand Down
2 changes: 1 addition & 1 deletion tests/TailwindBinaryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testBinaryIsDownloadedAndProcessCreated()
$expectedTemplate = '\\' === \DIRECTORY_SEPARATOR ? '"%s" -i fake.css' : "'%s' '-i' 'fake.css'";

$this->assertSame(
sprintf($expectedTemplate, $binaryDownloadDir.'/fake-version/'.TailwindBinary::getBinaryName()),
\sprintf($expectedTemplate, $binaryDownloadDir.'/fake-version/'.TailwindBinary::getBinaryName()),
$process->getCommandLine()
);
}
Expand Down
Loading