Skip to content

Commit 4f37334

Browse files
Merge pull request #51 from riccardodallavia/main
UPDATE switch to laravel pint
2 parents 705faa8 + f7d42aa commit 4f37334

7 files changed

+18
-52
lines changed

.github/workflows/php-cs-fixer.yml .github/workflows/fix-php-code-style-issues.yml

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
name: Check & fix styling
1+
name: Fix PHP code style issues
22

3-
on: [push]
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
47

58
jobs:
6-
php-cs-fixer:
9+
php-code-styling:
710
runs-on: ubuntu-latest
811

912
steps:
@@ -12,10 +15,8 @@ jobs:
1215
with:
1316
ref: ${{ github.head_ref }}
1417

15-
- name: Run PHP CS Fixer
16-
uses: docker://oskarstark/php-cs-fixer-ga
17-
with:
18-
args: --config=.php-cs-fixer.dist.php --allow-risky=yes
18+
- name: Fix PHP code style issues
19+
uses: aglipanci/[email protected]
1920

2021
- name: Commit changes
2122
uses: stefanzweifel/git-auto-commit-action@v4

.php-cs-fixer.dist.php

-35
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
[![Latest Version on Packagist](https://img.shields.io/packagist/v/maize-tech/laravel-markable.svg?style=flat-square)](https://packagist.org/packages/maize-tech/laravel-markable)
1212
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/maize-tech/laravel-markable/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/maize-tech/laravel-markable/actions?query=workflow%3Arun-tests+branch%3Amain)
13-
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/maize-tech/laravel-markable/php-cs-fixer.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/maize-tech/laravel-markable/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
13+
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/maize-tech/laravel-markable/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/maize-tech/laravel-markable/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
1414
[![Total Downloads](https://img.shields.io/packagist/dt/maize-tech/laravel-markable.svg?style=flat-square)](https://packagist.org/packages/maize-tech/laravel-markable)
1515

1616
This package allows you to easily add the markable feature to your application, as for example likes, bookmarks, favorites and so on.

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"spatie/laravel-package-tools": "^1.14.1"
3131
},
3232
"require-dev": {
33-
"friendsofphp/php-cs-fixer": "^3.7",
33+
"laravel/pint": "^1.0",
3434
"orchestra/testbench": "^7.0|^8.0",
3535
"phpunit/phpunit": "^9.5",
3636
"spatie/laravel-ray": "^1.29",
@@ -48,7 +48,7 @@
4848
}
4949
},
5050
"scripts": {
51-
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes",
51+
"format": "vendor/bin/pint",
5252
"psalm": "vendor/bin/psalm",
5353
"test": "vendor/bin/phpunit --colors=always",
5454
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"

src/Mark.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static function getMarkClassName(): string
3737
->__toString();
3838
}
3939

40-
public static function add(Model $markable, Model $user, ?string $value = null): self
40+
public static function add(Model $markable, Model $user, string $value = null): self
4141
{
4242
static::validMarkable($markable);
4343

@@ -58,7 +58,7 @@ public static function add(Model $markable, Model $user, ?string $value = null):
5858
return static::firstOrCreate($attributes, $values);
5959
}
6060

61-
public static function remove(Model $markable, Model $user, ?string $value = null)
61+
public static function remove(Model $markable, Model $user, string $value = null)
6262
{
6363
static::validMarkable($markable);
6464

@@ -70,7 +70,7 @@ public static function remove(Model $markable, Model $user, ?string $value = nul
7070
])->get()->each->delete();
7171
}
7272

73-
public static function count(Model $markable, ?string $value = null): int
73+
public static function count(Model $markable, string $value = null): int
7474
{
7575
static::validMarkable($markable);
7676

@@ -81,7 +81,7 @@ public static function count(Model $markable, ?string $value = null): int
8181
])->count();
8282
}
8383

84-
public static function has(Model $markable, Model $user, ?string $value = null): bool
84+
public static function has(Model $markable, Model $user, string $value = null): bool
8585
{
8686
return static::where([
8787
app(static::class)->getUserIdColumn() => $user->getKey(),
@@ -91,7 +91,7 @@ public static function has(Model $markable, Model $user, ?string $value = null):
9191
])->exists();
9292
}
9393

94-
public static function toggle(Model $markable, Model $user, ?string $value = null)
94+
public static function toggle(Model $markable, Model $user, string $value = null)
9595
{
9696
return static::has($markable, $user, $value)
9797
? static::remove($markable, $user, $value)

src/Markable.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static function marks(): array
2525
return static::$marks ?? [];
2626
}
2727

28-
public function scopeWhereHasMark(Builder $builder, Mark $mark, Model $user, ?string $value = null): Builder
28+
public function scopeWhereHasMark(Builder $builder, Mark $mark, Model $user, string $value = null): Builder
2929
{
3030
return $builder->whereHas(
3131
$mark->markableRelationName(),

src/Scopes/MarkableScope.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ protected function addWhereHasMark(Builder $builder, Mark $mark): void
2727
{
2828
$builder->macro(
2929
"whereHas{$mark::getMarkClassName()}",
30-
fn (Builder $b, $user, ?string $value = null) => $b->whereHasMark($mark, $user, $value)
30+
fn (Builder $b, $user, string $value = null) => $b->whereHasMark($mark, $user, $value)
3131
);
3232
}
3333
}

0 commit comments

Comments
 (0)