Skip to content

Commit

Permalink
Merge pull request #160 from ciungulete/master
Browse files Browse the repository at this point in the history
Add PHP CS Fixer
  • Loading branch information
sandervanhooft authored Dec 9, 2020
2 parents 2387a0e + a1a8769 commit 165d8e0
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 5 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check & fix styling

on: [push]

jobs:
style:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Fix style
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php_cs --allow-risky=yes

- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v2.3.0
with:
commit_message: Fix styling
branch: ${{ steps.extract_branch.outputs.branch }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ composer.lock
phpunit.xml
.phpunit.result.cache
.DS_Store
.php_cs.cache
43 changes: 43 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

$finder = Symfony\Component\Finder\Finder::create()
->notPath('bootstrap/*')
->notPath('storage/*')
->notPath('vendor')
->in([
__DIR__ . '/src',
__DIR__ . '/config',
__DIR__ . '/tests',
])
->name('*.php')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true);

return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'trailing_comma_in_multiline_array' => true,
'phpdoc_scalar' => true,
'unary_operator_spaces' => true,
'binary_operator_spaces' => true,
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
],
'phpdoc_single_line_var_spacing' => true,
'phpdoc_var_without_name' => true,
'class_attributes_separation' => [
'elements' => [
'method', 'property',
],
],
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => true,
]
])
->setFinder($finder);
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"graham-campbell/testbench": "^5.5",
"mockery/mockery": "^1.0",
"phpunit/phpunit": "^7.5|^8.0",
"laravel/socialite": "^4.0|^5.0"
"laravel/socialite": "^4.0|^5.0",
"friendsofphp/php-cs-fixer": "^v2.17"
},
"suggest": {
"laravel/socialite": "Use Mollie Connect (OAuth) to authenticate via Laravel Socialite with the Mollie API. This is needed for some endpoints."
Expand All @@ -77,5 +78,9 @@
"Mollie": "Mollie\\Laravel\\Facades\\Mollie"
}
}
},
"scripts": {
"test": "./vendor/bin/phpunit tests",
"format": "./vendor/bin/php-cs-fixer fix --allow-risky=yes"
}
}
2 changes: 2 additions & 0 deletions src/MollieConnectProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ public function getRefreshTokenResponse($refresh_token)
'headers' => ['Accept' => 'application/json'],
'form_params' => $this->getRefreshTokenFields($refresh_token),
]);

return json_decode($response->getBody(), true);
}

/**
* Get the refresh tokenfields with a refresh token.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Wrappers/MollieApiWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
namespace Mollie\Laravel\Wrappers;

use Illuminate\Contracts\Config\Repository;
use Mollie\Api\MollieApiClient;
use Mollie\Api\Exceptions\ApiException;
use Mollie\Api\MollieApiClient;

/**
* Class MollieApiWrapper.
Expand Down
4 changes: 2 additions & 2 deletions src/helpers.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

if (!function_exists('mollie')) {
if (! function_exists('mollie')) {
function mollie()
{
return app('mollie.api');
}
}
}
2 changes: 1 addition & 1 deletion tests/Facades/MollieTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ protected function getFacadeRoot()
{
return MollieManager::class;
}
}
}

0 comments on commit 165d8e0

Please sign in to comment.