diff --git a/.github/workflows/be_base.yml b/.github/workflows/be_base.yml
index 5994460e..f57457ba 100644
--- a/.github/workflows/be_base.yml
+++ b/.github/workflows/be_base.yml
@@ -14,10 +14,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/be
- # https://github.com/staabm/annotate-pull-request-from-checkstyle
- run: >
./vendor/bin/phpstan analyse --error-format=checkstyle
| tee >(cs2pr --notices-as-warnings --graceful-warnings --prepend-filename --prepend-source)
+ # https://github.com/staabm/annotate-pull-request-from-checkstyle
shell: bash
psalm:
@@ -65,4 +65,5 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/be
- - run: ./vendor/bin/phpmd . github cleancode,codesize,controversial,design,naming,unusedcode --exclude vendor # https://github.com/phpmd/phpmd/issues/506
+ # https://github.com/phpmd/phpmd/issues/506
+ - run: ./vendor/bin/phpmd . github cleancode,codesize,controversial,design,naming,unusedcode --exclude vendor
diff --git a/be/.phpcs.xml b/be/.phpcs.xml
new file mode 100644
index 00000000..13aca90b
--- /dev/null
+++ b/be/.phpcs.xml
@@ -0,0 +1,10 @@
+
+
+
+
+ *.blade.php
+ _ide_helper*.php
+
+ vendor/*
+ bootstrap/cache/*
+
diff --git a/be/app/Helper.php b/be/app/Helper.php
index d1590752..5244853e 100644
--- a/be/app/Helper.php
+++ b/be/app/Helper.php
@@ -149,7 +149,8 @@ public static function jsonDecode(string $json, bool $assoc = true)
}
public static function xmlResponse(string|\Stringable $xml): \Illuminate\Http\Response
- { // https://laracasts.com/discuss/channels/laravel/syntax-error-unexpected-identifier-version-1
+ {
+ // https://laracasts.com/discuss/channels/laravel/syntax-error-unexpected-identifier-version-1
return response('' . "\n$xml")
->withHeaders(['Content-Type' => 'text/xml']);
}
diff --git a/be/app/Http/Controllers/ThreadsSitemap.php b/be/app/Http/Controllers/ThreadsSitemap.php
index 74e4a7d8..3a5bcc4c 100644
--- a/be/app/Http/Controllers/ThreadsSitemap.php
+++ b/be/app/Http/Controllers/ThreadsSitemap.php
@@ -13,7 +13,8 @@ class ThreadsSitemap extends Controller
public static int $maxUrls = 50000;
public function query(Http\Request $request, int $fid): Http\Response
- { // https://stackoverflow.com/questions/59554777/laravel-how-to-set-default-value-in-validator-at-post-registeration/78707950#78707950
+ {
+ // https://stackoverflow.com/questions/59554777/laravel-how-to-set-default-value-in-validator-at-post-registeration/78707950#78707950
['cursor' => $cursor] = $request->validate([
'cursor' => 'integer',
]) + ['cursor' => 0];
diff --git a/be/app/Http/PostsQuery/BaseQuery.php b/be/app/Http/PostsQuery/BaseQuery.php
index 40685a70..0592cb5f 100644
--- a/be/app/Http/PostsQuery/BaseQuery.php
+++ b/be/app/Http/PostsQuery/BaseQuery.php
@@ -362,7 +362,7 @@ public function reOrderNestedPosts(Collection $nestedPosts): array
* @param string $childPostTypePluralName
* @return Collection>>>
*/
- $setSortingKeyFromCurrentAndChildPosts = function (Collection $curPost, string $childPostTypePluralName): \Illuminate\Support\Collection {
+ $setSortingKeyFromCurrentAndChildPosts = function (Collection $curPost, string $childPostTypePluralName): Collection {
/** @var Collection> $childPosts sorted child posts */
$childPosts = $curPost[$childPostTypePluralName];
$curPost[$childPostTypePluralName] = $childPosts->values(); // reset keys
@@ -394,12 +394,12 @@ public function reOrderNestedPosts(Collection $nestedPosts): array
return $curPost;
};
- $sortBySortingKey = fn(Collection $posts): \Illuminate\Support\Collection => $posts
+ $sortBySortingKey = fn(Collection $posts): Collection => $posts
->sortBy(fn(Collection $i) => $i['sortingKey'], descending: $this->orderByDesc);
$removeSortingKey = /**
- * @psalm-return \Illuminate\Support\Collection
+ * @psalm-return Collection
*/
- static fn(Collection $posts): \Illuminate\Support\Collection => $posts
+ static fn(Collection $posts): Collection => $posts
->map(fn(Collection $i) => $i->except('sortingKey'));
$ret = $removeSortingKey($sortBySortingKey(
$nestedPosts->map(
diff --git a/be/app/Http/PostsQuery/IndexQuery.php b/be/app/Http/PostsQuery/IndexQuery.php
index 3e314886..95846782 100644
--- a/be/app/Http/PostsQuery/IndexQuery.php
+++ b/be/app/Http/PostsQuery/IndexQuery.php
@@ -46,12 +46,10 @@ public function query(QueryParams $params, ?string $cursor): self
->selectRaw("{$fid} AS fid, COUNT(*) AS count")
->where($postIDName, $postID))
->reduce(/**
- * @return \Illuminate\Contracts\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder
- *
- * @psalm-return \Illuminate\Contracts\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder<\Illuminate\Database\Eloquent\Model>|\Illuminate\Database\Query\Builder
+ * @return BuilderContract|EloquentBuilder|QueryBuilder
+ * @psalm-return BuilderContract|EloquentBuilder<\Illuminate\Database\Eloquent\Model>|QueryBuilder
*/
- static fn(?BuilderContract $acc, EloquentBuilder|QueryBuilder $cur): \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder|\Illuminate\Contracts\Database\Query\Builder =>
- $acc === null ? $cur : $acc->union($cur),
+ static fn(?BuilderContract $acc, EloquentBuilder|QueryBuilder $cur): EloquentBuilder|QueryBuilder|BuilderContract => $acc === null ? $cur : $acc->union($cur),
)
->get()
->where('count', '!=', 0);
diff --git a/be/phpunit.xml b/be/phpunit.xml
index 506b9a38..67252ebb 100644
--- a/be/phpunit.xml
+++ b/be/phpunit.xml
@@ -1,4 +1,4 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/be/psalm.xml b/be/psalm.xml
index 6b0ff74a..afd79183 100644
--- a/be/psalm.xml
+++ b/be/psalm.xml
@@ -9,12 +9,12 @@
findUnusedCode="true"
>
-
+
-
+
-
+