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

feat: Add php-cs-fixer #273

Open
wants to merge 1 commit into
base: v3_develop
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
;

return (new PhpCsFixer\Config())
->setRules([
'@PSR2' => true,
])
->setFinder($finder)
;
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Before submitting a pull request:

If the project maintainer has any additional requirements, you will find them listed here.

- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The project includes [PHP CS Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer), you can run `composer fix` to fix the coding style.

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"nesbot/carbon": "^2.72|^3.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.66",
"guzzlehttp/guzzle": "^7.0",
"mockery/mockery": "^1.4",
"orchestra/testbench": "^8.0|^9.0",
Expand Down Expand Up @@ -73,6 +74,7 @@
"minimum-stability": "stable",
"prefer-stable": true,
"scripts": {
"test": "./vendor/bin/phpunit tests"
"test": "./vendor/bin/phpunit tests",
"fix": "./vendor/bin/php-cs-fixer fix"
}
}
3 changes: 1 addition & 2 deletions src/EventServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Laravel\Cashier;


use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Support\ServiceProvider;
use Laravel\Cashier\Order\OrderInvoiceSubscriber;
Expand All @@ -27,6 +26,6 @@ class EventServiceProvider extends ServiceProvider
public function boot(Dispatcher $events)
{
collect($this->subscribe)
->each(fn(string $subscriber) => $events->subscribe($subscriber));
->each(fn (string $subscriber) => $events->subscribe($subscriber));
}
}
3 changes: 2 additions & 1 deletion src/Plan/DefaultIntervalGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public function getEndOfNextSubscriptionCycle(Subscription $subscription = null)
/**
* @return string
*/
public function interval() {
public function interval()
{
return $this->interval;
}

Expand Down
3 changes: 1 addition & 2 deletions src/Refunds/Refund.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ public function handleProcessed(): self
$refundItems->each(function (RefundItem $refundItem) {
$originalOrderItem = $refundItem->originalOrderItem;

if( $originalOrderItem && method_exists($originalOrderItem, 'handlePaymentRefunded') )
{
if ($originalOrderItem && method_exists($originalOrderItem, 'handlePaymentRefunded')) {
$originalOrderItem->handlePaymentRefunded($refundItem);
}
});
Expand Down