From d06923a3888ec80c6ab2cb17d15fcc9585a7683e Mon Sep 17 00:00:00 2001 From: Mikael Jorhult Date: Fri, 10 Mar 2023 20:26:10 +0100 Subject: [PATCH] Update code style action. (#28) --- .github/workflows/run-php-cs-fixer.yml | 6 ++++-- .gitignore | 3 ++- .php-cs-fixer.dist.php | 12 ++++++++++++ src/FlashMessage/FlashMessage.php | 3 ++- 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 .php-cs-fixer.dist.php diff --git a/.github/workflows/run-php-cs-fixer.yml b/.github/workflows/run-php-cs-fixer.yml index e565e0c..7e7f537 100644 --- a/.github/workflows/run-php-cs-fixer.yml +++ b/.github/workflows/run-php-cs-fixer.yml @@ -10,14 +10,16 @@ jobs: fix-php-code-style: name: Fix PHP Code Style runs-on: ubuntu-latest + permissions: + contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 2 token: ${{ secrets.GITHUB_TOKEN }} - name: Run PHP CS Fixer - uses: docker://oskarstark/php-cs-fixer-ga:2.18.6 + uses: docker://oskarstark/php-cs-fixer-ga - name: Commit changes uses: stefanzweifel/git-auto-commit-action@v4 diff --git a/.gitignore b/.gitignore index 5baea3c..0630dfb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /vendor composer.lock -/.idea \ No newline at end of file +/.idea +.php-cs-fixer.cache \ No newline at end of file diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..0bdab8e --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,12 @@ +exclude('node_modules') + ->exclude('vendor') + ->in(__DIR__); + +$config = new PhpCsFixer\Config(); +return $config->setRules([ + '@PSR2' => true, + ]) + ->setFinder($finder); \ No newline at end of file diff --git a/src/FlashMessage/FlashMessage.php b/src/FlashMessage/FlashMessage.php index 9a32b1c..f4a864e 100644 --- a/src/FlashMessage/FlashMessage.php +++ b/src/FlashMessage/FlashMessage.php @@ -149,7 +149,8 @@ public function get(string $key) public function toArray() { return array_merge( - $this->attributes, [ + $this->attributes, + [ 'content' => $this->content, 'title' => $this->title, 'type' => $this->type,