Skip to content

Commit

Permalink
chore: enable phpstan, apply fixes (#110)
Browse files Browse the repository at this point in the history
* chore: enable phpstan

* fix: phpstan errors

* Apply fixes from StyleCI

* chore: bump js deps, audit fix

---------

Co-authored-by: StyleCI Bot <[email protected]>
  • Loading branch information
imorland and StyleCIBot authored Nov 13, 2023
1 parent 80e7499 commit 9424f5d
Show file tree
Hide file tree
Showing 25 changed files with 672 additions and 668 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: FoF Gamification PHP

on: [workflow_dispatch, push, pull_request]

jobs:
run:
uses: flarum/framework/.github/workflows/REUSABLE_backend.yml@main
with:
enable_backend_testing: false
enable_phpstan: true

backend_directory: .
32 changes: 0 additions & 32 deletions .github/workflows/build.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: FoF Gamification JS

on: [workflow_dispatch, push, pull_request]

jobs:
run:
uses: flarum/framework/.github/workflows/REUSABLE_frontend.yml@main
with:
enable_bundlewatch: false
enable_prettier: true
enable_typescript: true

frontend_directory: ./js
backend_directory: .
js_package_manager: npm
main_git_branch: master

secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
18 changes: 17 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fof/gamification",
"description": "Upvotes and downvotes for your Flarum community",
"description": "Upvotes and downvotes for your Flarum community",
"keywords": [
"flarum",
"friendsofflarum",
Expand Down Expand Up @@ -55,6 +55,22 @@
},
"flagrow": {
"discuss": "https://discuss.flarum.org/d/20671"
},
"flarum-cli": {
"modules": {
"githubActions": true
}
}
},
"scripts": {
"analyse:phpstan": "phpstan analyse",
"clear-cache:phpstan": "phpstan clear-result-cache"
},
"scripts-descriptions": {
"analyse:phpstan": "Run static analysis"
},
"require-dev": {
"flarum/phpstan": "*",
"flarum/pusher": "*"
}
}
8 changes: 8 additions & 0 deletions extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Flarum\Api\Controller;
use Flarum\Api\Serializer;
use Flarum\Discussion\Discussion;
use Flarum\Discussion\Event\Started;
use Flarum\Discussion\Filter\DiscussionFilterer;
use Flarum\Discussion\Search\DiscussionSearcher;
Expand Down Expand Up @@ -41,6 +42,9 @@
new Extend\Locales(__DIR__.'/resources/locale'),

(new Extend\Model(User::class))
->cast('votes', 'int')
->cast('rank', 'string')
->cast('last_vote_time', 'datetime')
->belongsToMany('ranks', Rank::class, 'rank_users'),

(new Extend\Model(Post::class))
Expand All @@ -55,6 +59,10 @@
return $post->hasMany(Vote::class, 'post_id');
}),

(new Extend\Model(Discussion::class))
->cast('votes', 'int')
->cast('hotness', 'float'),

(new ExtensionSettings())
->setPrefix('fof-gamification.')
->addKeys([
Expand Down
Loading

0 comments on commit 9424f5d

Please sign in to comment.