Skip to content

Commit

Permalink
chore: enable phpstan, apply fixes (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland authored Nov 14, 2023
1 parent 2991d95 commit c359fd0
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ jobs:
uses: flarum/framework/.github/workflows/REUSABLE_backend.yml@main
with:
enable_backend_testing: true
enable_phpstan: true

backend_directory: .
16 changes: 10 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"forum": "https://discuss.flarum.org/d/25772"
},
"require": {
"flarum/core": "^1.2.0",
"flarum/core": "^1.8.0",
"flarum/tags": "*"
},
"autoload": {
Expand Down Expand Up @@ -56,18 +56,22 @@
],
"test:unit": "phpunit -c tests/phpunit.unit.xml",
"test:integration": "phpunit -c tests/phpunit.integration.xml",
"test:setup": "@php tests/integration/setup.php"
"test:setup": "@php tests/integration/setup.php",
"analyse:phpstan": "phpstan analyse",
"clear-cache:phpstan": "phpstan clear-result-cache"
},
"scripts-descriptions": {
"test": "Runs all tests.",
"test:unit": "Runs all unit tests.",
"test:integration": "Runs all integration tests.",
"test:setup": "Sets up a database for use with integration tests. Execute this only once."
"test:setup": "Sets up a database for use with integration tests. Execute this only once.",
"analyse:phpstan": "Run static analysis"
},
"require-dev": {
"flarum/core": "*",
"flarum/testing": "^1.0.0",
"symfony/var-dumper": "*"
"flarum/core": "*",
"flarum/phpstan": "*",
"flarum/testing": "^1.0.0",
"symfony/var-dumper": "*"
},
"config": {
"sort-packages": true
Expand Down
5 changes: 5 additions & 0 deletions extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Flarum\Extend;
use Flarum\Tags\Api\Serializer\TagSerializer;
use Flarum\Tags\Event\Saving as TagSaving;
use Flarum\Tags\Tag;

return [
(new Extend\Frontend('forum'))
Expand All @@ -27,6 +28,10 @@

new Extend\Locales(__DIR__.'/resources/locale'),

(new Extend\Model(Tag::class))
->cast('excerpt_length', 'int')
->cast('rich_excerpts', 'bool'),

(new Extend\Settings())
->default('ianm-synopsis.excerpt_length', 200)
->default('ianm-synopsis.rich-excerpts', false)
Expand Down
13 changes: 13 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
includes:
- vendor/flarum/phpstan/extension.neon

parameters:
# The level will be increased in Flarum 2.0
level: 5
paths:
- extend.php
- src
excludePaths:
- *.blade.php
checkMissingIterableValueType: false
databaseMigrationsPath: ['migrations']

0 comments on commit c359fd0

Please sign in to comment.