Skip to content

Commit

Permalink
Merge pull request #709 from tighten/fix-format-action
Browse files Browse the repository at this point in the history
Fix format action
  • Loading branch information
damiani authored Jun 27, 2024
2 parents f47335a + ef26741 commit a338f76
Show file tree
Hide file tree
Showing 53 changed files with 169 additions and 149 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,32 @@ on:
pull_request:
paths: ['**.php']
jobs:
php-cs-fixer:
pint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.3
- uses: ramsey/composer-install@v2
- name: Run PHP-CS-Fixer
- name: Run Pint
id: format
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
run: |
delimiter=$RANDOM
echo "summary<<${delimiter}" >> $GITHUB_OUTPUT
composer format >> $GITHUB_OUTPUT
vendor/bin/pint >> $GITHUB_OUTPUT
echo $delimiter >> $GITHUB_OUTPUT
- name: Check for fixed files
- name: Check for changed files
run: echo "changed=$(git diff --quiet && echo false || echo true)" >> $GITHUB_ENV
- name: Commit changes
if: ${{ env.changed == 'true' }}
if: env.changed == 'true'
run: |
git config --global user.name github-actions
git config --global user.email github-actions[bot]@users.noreply.github.com
# awk trims leading and trailing whitespace from each line, sed removes the last two lines
git commit -a -m "Format" -m "$(echo '${{ steps.format.outputs.summary }})' | awk '{$1=$1};1' | sed '$d' | sed '$d')"
# Trim leading and trailing whitespace from each line
git commit -a -m "Format" -m "$(echo '${{ steps.format.outputs.summary }})' | awk '{$1=$1};1')"
git push
50 changes: 0 additions & 50 deletions .php-cs-fixer.php

This file was deleted.

5 changes: 1 addition & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"vlucas/phpdotenv": "^5.6"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.51",
"laravel/pint": "^1.16",
"mockery/mockery": "^1.6",
"phpunit/phpunit": "^11.0.6"
},
Expand All @@ -59,9 +59,6 @@
"bin": [
"jigsaw"
],
"scripts": {
"format": "php-cs-fixer fix --verbose"
},
"config": {
"sort-packages": true,
"optimize-autoloader": true
Expand Down
9 changes: 9 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"preset": "laravel",
"rules": {
"concat_space": {
"spacing": "one"
},
"single_line_empty_body": true
}
}
10 changes: 5 additions & 5 deletions src/Bootstrap/HandleExceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ public function bootstrap(Container $app): void
/**
* Report PHP deprecations, or convert PHP errors to ErrorException instances.
*
* @param int $level
* @param string $message
* @param string $file
* @param int $line
* @param array $context
* @param int $level
* @param string $message
* @param string $file
* @param int $line
* @param array $context
*
* @throws ErrorException
*/
Expand Down
1 change: 1 addition & 0 deletions src/Collection/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
class Collection extends BaseCollection
{
public $settings;

public $name;

public static function withSettings(IterableObject $settings, $name)
Expand Down
1 change: 1 addition & 0 deletions src/Collection/CollectionPaginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class CollectionPaginator
{
private $outputPathResolver;

private $prefix;

public function __construct($outputPathResolver)
Expand Down
2 changes: 2 additions & 0 deletions src/Collection/CollectionRemoteItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
class CollectionRemoteItem
{
private $item;

private $index;

private $collectionName;

public function __construct($item, $index = 0, $collectionName = null)
Expand Down
5 changes: 1 addition & 4 deletions src/CollectionItemHandlers/BladeCollectionItemHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,5 @@ public function getItemVariables($file)
);
}

public function getItemContent($file)
{
return;
}
public function getItemContent($file) {}
}
1 change: 1 addition & 0 deletions src/Console/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
class BuildCommand extends Command
{
private $app;

private $consoleOutput;

public function __construct(Container $app)
Expand Down
4 changes: 3 additions & 1 deletion src/Console/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

abstract class Command extends SymfonyCommand
{
protected InputInterface $input;
protected InputInterface $input;

protected OutputInterface $output;

protected $console;

public function execute(InputInterface $input, OutputInterface $output): int
Expand Down
1 change: 1 addition & 0 deletions src/Console/ConsoleOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class ConsoleOutput extends SymfonyConsoleOutput
{
protected $progressBars;

protected $sections;

public function setup($verbosity)
Expand Down
2 changes: 2 additions & 0 deletions src/Console/ConsoleSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
class ConsoleSession
{
protected $input;

protected $output;

protected $question;

public function __construct(InputInterface $input, OutputInterface $output, QuestionHelper $question)
Expand Down
3 changes: 3 additions & 0 deletions src/Console/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
class InitCommand extends Command
{
private $base;

private $basicScaffold;

private $files;

private $presetScaffold;

public function __construct(Filesystem $files, BasicScaffoldBuilder $basicScaffold, PresetScaffoldBuilder $presetScaffold)
Expand Down
1 change: 1 addition & 0 deletions src/Console/NullProgressBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
class NullProgressBar
{
protected $consoleOutput;

protected $message;

public function __construct(ConsoleOutput $consoleOutput, $message = null, $section = null)
Expand Down
2 changes: 2 additions & 0 deletions src/Console/ProgressBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
class ProgressBar
{
protected $consoleOutput;

protected $progressBar;

protected $message;

public function __construct(ConsoleOutput $consoleOutput, $message = null, $section = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private function fireAppCallbacks(array &$callbacks): void
while ($index < count($callbacks)) {
$callbacks[$index]($this);

++$index;
$index++;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function render($request, Throwable $e): void
}

/**
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param \Symfony\Component\Console\Output\OutputInterface $output
*/
public function renderForConsole($output, Throwable $e): void
{
Expand Down
1 change: 1 addition & 0 deletions src/File/BladeDirectivesFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class BladeDirectivesFile
{
protected $bladeCompiler;

protected $directives;

public function __construct($file_path, BladeCompiler $bladeCompiler)
Expand Down
2 changes: 2 additions & 0 deletions src/File/InputFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
class InputFile
{
protected $file;

protected $extraBladeExtensions = [
'js', 'json', 'xml', 'yaml', 'yml', 'rss', 'atom', 'txt', 'text', 'html',
];

protected $pageData;

public function __construct($file)
Expand Down
7 changes: 7 additions & 0 deletions src/File/OutputFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@
class OutputFile
{
private $inputFile;

private $path;

private $name;

private $extension;

private $contents;

private $data;

private $page;

private $prefix;

public function __construct(InputFile $inputFile, $path, $name, $extension, $contents, $data, $page = 1, $prefix = '')
Expand Down
1 change: 1 addition & 0 deletions src/File/TemporaryFilesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
class TemporaryFilesystem
{
private $tempPath;

private $filesystem;

public function __construct($tempPath, $filesystem = null)
Expand Down
3 changes: 3 additions & 0 deletions src/Handlers/BladeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
class BladeHandler
{
private $temporaryFilesystem;

private $parser;

private $view;

private $hasFrontMatter;

public function __construct(TemporaryFilesystem $temporaryFilesystem, FrontMatterParser $parser, ViewRenderer $viewRenderer)
Expand Down
1 change: 1 addition & 0 deletions src/Handlers/CollectionItemHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
class CollectionItemHandler
{
private $config;

private $handlers;

public function __construct(Collection $config, $handlers)
Expand Down
2 changes: 2 additions & 0 deletions src/Handlers/MarkdownHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
class MarkdownHandler
{
private $temporaryFilesystem;

private $parser;

private $view;

public function __construct(TemporaryFilesystem $temporaryFilesystem, FrontMatterParser $parser, ViewRenderer $viewRenderer)
Expand Down
3 changes: 3 additions & 0 deletions src/Handlers/PaginatedPageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@
class PaginatedPageHandler
{
private $paginator;

private $parser;

private $temporaryFilesystem;

private $view;

public function __construct(
Expand Down
9 changes: 9 additions & 0 deletions src/Jigsaw.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,23 @@ class Jigsaw
use Macroable;

public $app;

protected $env;

protected $pageInfo;

protected $outputPaths;

protected $siteData;

protected $dataLoader;

protected $remoteItemLoader;

protected $siteBuilder;

protected $verbose;

protected static $commands = [];

public function __construct(
Expand Down
6 changes: 6 additions & 0 deletions src/Loaders/CollectionDataLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@
class CollectionDataLoader
{
private $filesystem;

private $consoleOutput;

private $pathResolver;

private $handlers;

private $source;

private $pageSettings;

private $collectionSettings;

public function __construct(Filesystem $filesystem, ConsoleOutput $consoleOutput, $pathResolver, $handlers = [])
Expand Down
Loading

0 comments on commit a338f76

Please sign in to comment.