Skip to content

Commit

Permalink
Merge pull request #16 from FrittenKeeZ/laravel-pint
Browse files Browse the repository at this point in the history
Replaced PHP CS Fixer with Laravel Pint
  • Loading branch information
FrittenKeeZ authored Jun 13, 2024
2 parents 4c4d796 + 90c985c commit 9928353
Show file tree
Hide file tree
Showing 33 changed files with 90 additions and 551 deletions.
30 changes: 28 additions & 2 deletions .github/workflows/tests.yml → .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Linting & Testing

on:
workflow_dispatch:
Expand All @@ -18,7 +18,33 @@ on:
- "**.yml"

jobs:
tests:
laravel-pint:
name: PHP Linting (Pint)

if: github.event.pull_request.draft == false

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Make sure the actual branch is checked out when running on pull requests.
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Laravel Pint
uses: aglipanci/[email protected]

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: PHP Linting (Pint)
skip_fetch: true

testing:
needs: laravel-pint

strategy:
fail-fast: true
matrix:
Expand Down
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/vendor
/.idea
/composer.lock
/.php-cs-fixer.cache
/.phpunit.cache
/.phpunit.result.cache
/.php-cs-fixer.cache
/.pint.json
/composer.lock
/vendor
74 changes: 0 additions & 74 deletions .php-cs-fixer.php

This file was deleted.

14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Release Notes

## [v0.4.0 (2024-06-24)](https://github.com/FrittenKeeZ/laravel-vouchers/compare/0.3.2...0.4.0)

### Added
- Added support for Laravel 11

### Deprecated
- Dropped support for Laravel 5.x - 8
- Dropped support for PHP 7.4 - 8.0

## [v0.3.2 (2023-10-03)](https://github.com/FrittenKeeZ/laravel-vouchers/compare/0.3.1...0.3.2)

### Added
- Added support for Laravel 10

## [v0.3.1 (2022-02-09)](https://github.com/FrittenKeeZ/laravel-vouchers/compare/0.3.0...0.3.1)

### Added
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.4",
"illuminate/support": "^9.45|^10.0|^11.0",
"laravel/pint": "^1.16",
"nesbot/carbon": "^2.63",
"orchestra/testbench": "^7.0|^8.0|^9.0",
"phpunit/phpunit": "^9.6|^10.5"
Expand All @@ -49,9 +50,8 @@
}
},
"scripts": {
"test": "phpunit",
"fixer-check": "php-cs-fixer fix --verbose --dry-run",
"fixer-fix": "php-cs-fixer fix"
"pint": "pint",
"test": "phpunit"
},
"extra": {
"laravel": {
Expand Down
4 changes: 0 additions & 4 deletions migrations/2018_06_12_000000_create_voucher_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ class CreateVoucherTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
Expand Down Expand Up @@ -63,8 +61,6 @@ public function up(): void

/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Expand Down
31 changes: 31 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"preset": "laravel",
"cache-file": ".pint.json",
"rules": {
"binary_operator_spaces": {
"operators": {
"=>": "align_single_space_minimal"
}
},
"concat_space": {
"spacing": "one"
},
"multiline_whitespace_before_semicolons": {
"strategy": "new_line_for_chained_calls"
},
"not_operator_with_successor_space": false,
"ordered_types": {
"null_adjustment": "always_last",
"sort_algorithm": "alpha"
},
"phpdoc_align": true,
"phpdoc_annotation_without_dot": false,
"phpdoc_order": true,
"phpdoc_separation": true,
"phpdoc_types_order": {
"null_adjustment": "always_last"
},
"simplified_null_return": true,
"single_trait_insert_per_statement": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ class AddOwnerToVouchersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
Expand All @@ -25,8 +23,6 @@ public function up(): void

/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ class AddPrimaryKeyToEntitiesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
Expand All @@ -25,8 +23,6 @@ public function up(): void

/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Expand Down
2 changes: 0 additions & 2 deletions src/Concerns/HasRedeemers.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ trait HasRedeemers
{
/**
* Associated redeemers.
*
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
*/
public function redeemers(): MorphMany
{
Expand Down
17 changes: 1 addition & 16 deletions src/Concerns/HasVouchers.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ trait HasVouchers
{
/**
* Owned vouchers.
*
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
*/
public function vouchers(): MorphMany
{
Expand All @@ -24,8 +22,6 @@ public function vouchers(): MorphMany

/**
* Associated vouchers.
*
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany
*/
public function associatedVouchers(): MorphToMany
{
Expand All @@ -34,8 +30,6 @@ public function associatedVouchers(): MorphToMany

/**
* Associated voucher entities.
*
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
*/
public function voucherEntities(): MorphMany
{
Expand All @@ -44,10 +38,6 @@ public function voucherEntities(): MorphMany

/**
* Create a single voucher with this entity related.
*
* @param \Closure|null $callback
*
* @return object
*/
public function createVoucher(?Closure $callback = null): object
{
Expand All @@ -56,13 +46,8 @@ public function createVoucher(?Closure $callback = null): object

/**
* Create an amount of vouchers with this entity related.
*
* @param int $amount
* @param \Closure|null $callback
*
* @return object|array
*/
public function createVouchers(int $amount, ?Closure $callback = null)
public function createVouchers(int $amount, ?Closure $callback = null): array|object
{
$vouchers = new Vouchers();

Expand Down
Loading

0 comments on commit 9928353

Please sign in to comment.