Skip to content

Commit

Permalink
chore: enable phpstan (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland authored Nov 12, 2023
1 parent d319a16 commit 1d1c6bd
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 51 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 Social Profile 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: .
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Javascript
name: FoF Social Profile JS

on: [workflow_dispatch, push, pull_request]

Expand All @@ -8,11 +8,12 @@ jobs:
with:
enable_bundlewatch: false
enable_prettier: true
enable_typescript: false
enable_typescript: true

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

secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
113 changes: 64 additions & 49 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,68 @@
{
"name": "fof/socialprofile",
"description": "Add custom social media pages to your user profile",
"keywords": [
"flarum"
],
"type": "flarum-extension",
"license": "MIT",
"support": {
"issues": "https://github.com/FriendsOfFlarum/socialprofile/issues",
"source": "https://github.com/FriendsOfFlarum/socialprofile",
"forum": "https://discuss.flarum.org/d/18775"
},
"homepage": "https://friendsofflarum.org",
"funding": [
{
"type": "website",
"url": "https://opencollective.com/fof/donate"
}
],
"require": {
"flarum/core": "^1.3.1"
},
"replace": {
"davis/flarum-ext-socialprofile": "*"
},
"authors": [
{
"name": "David Sevilla Martín",
"email": "[email protected]",
"role": "Developer"
}
],
"autoload": {
"psr-4": {
"FoF\\SocialProfile\\": "src/"
}
},
"extra": {
"flarum-extension": {
"title": "FoF Social Profile",
"category": "feature",
"icon": {
"name": "fas fa-globe",
"backgroundColor": "#e74c3c",
"color": "#ffff"
}
"name": "fof/socialprofile",
"description": "Add custom social media pages to your user profile",
"keywords": [
"flarum"
],
"type": "flarum-extension",
"license": "MIT",
"support": {
"issues": "https://github.com/FriendsOfFlarum/socialprofile/issues",
"source": "https://github.com/FriendsOfFlarum/socialprofile",
"forum": "https://discuss.flarum.org/d/18775"
},
"homepage": "https://friendsofflarum.org",
"funding": [
{
"type": "website",
"url": "https://opencollective.com/fof/donate"
}
],
"require": {
"flarum/core": "^1.3.1"
},
"replace": {
"davis/flarum-ext-socialprofile": "*"
},
"authors": [
{
"name": "David Sevilla Martín",
"email": "[email protected]",
"role": "Developer"
}
],
"autoload": {
"psr-4": {
"FoF\\SocialProfile\\": "src/"
}
},
"extra": {
"flarum-extension": {
"title": "FoF Social Profile",
"category": "feature",
"icon": {
"name": "fas fa-globe",
"backgroundColor": "#e74c3c",
"color": "#ffff"
}
},
"flagrow": {
"discuss": "https://discuss.flarum.org/d/18775"
},
"flarum-cli": {
"modules": {
"githubActions": true
}
}
},
"require-dev": {
"flarum/phpstan": "*"
},
"scripts": {
"analyse:phpstan": "phpstan analyse",
"clear-cache:phpstan": "phpstan clear-result-cache"
},
"flagrow": {
"discuss": "https://discuss.flarum.org/d/18775"
"scripts-descriptions": {
"analyse:phpstan": "Run static analysis"
}
}
}
3 changes: 3 additions & 0 deletions extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
(new Extend\Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js'),

(new Extend\Model(User::class))
->cast('social_buttons', 'string'),

(new Extend\Settings())
->serializeToForum('fof-socialprofile.allow_external_favicons', 'fof-socialprofile.allow_external_favicons', 'boolval', true),

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']
2 changes: 2 additions & 0 deletions src/Listeners/AddSocialButtonsToDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

namespace FoF\SocialProfile\Listeners;

use Flarum\Foundation\ValidationException;
use Flarum\User\Event\Saving;
use Flarum\User\Exception\PermissionDeniedException;
use FoF\SocialProfile\Events\UserButtonsWereChanged;
use FoF\SocialProfile\Validators\ProfileValidator;
use Illuminate\Support\Arr;
Expand Down

0 comments on commit 1d1c6bd

Please sign in to comment.