Skip to content

Commit

Permalink
chore: enable phpstan, fix: php 7.x compatibility (#65)
Browse files Browse the repository at this point in the history
* chore: enable phpstan

* fix: phpstan errors

* Apply fixes from StyleCI

* fix: php 7.3 compat

* fix: php 7.x

* chore: bump js deps

---------

Co-authored-by: StyleCI Bot <[email protected]>
  • Loading branch information
imorland and StyleCIBot authored Nov 12, 2023
1 parent e01cd55 commit fe962ff
Show file tree
Hide file tree
Showing 14 changed files with 223 additions and 179 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 OAuth 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 OAuth 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 }}
17 changes: 16 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"league/oauth2-facebook": "^2.2.0",
"league/oauth2-github": "^3.1.0",
"league/oauth2-google": "^4.0.1",
"omines/oauth2-gitlab": "^3.5.0",
"omines/oauth2-gitlab": "^3.3.0",
"wohali/oauth2-discord-new": "^1.2.1",
"league/oauth2-linkedin": "^5.1.2",
"fof/extend": "^1.2.1"
Expand Down Expand Up @@ -76,6 +76,21 @@
},
"flagrow": {
"discuss": "https://discuss.flarum.org/d/25182"
},
"flarum-cli": {
"modules": {
"githubActions": true
}
}
},
"require-dev": {
"flarum/phpstan": "*"
},
"scripts": {
"analyse:phpstan": "phpstan analyse",
"clear-cache:phpstan": "phpstan clear-result-cache"
},
"scripts-descriptions": {
"analyse:phpstan": "Run static analysis"
}
}
5 changes: 4 additions & 1 deletion extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@
(new Extend\ApiSerializer(CurrentUserSerializer::class))
->attributes(function (CurrentUserSerializer $serializer, User $user, array $attributes) {
$session = $serializer->getRequest()->getAttribute('session');
$attributes['loginProvider'] = $session?->get(AbstractOAuthController::SESSION_OAUTH2PROVIDER);

if ($session) {
$attributes['loginProvider'] = $session->get(AbstractOAuthController::SESSION_OAUTH2PROVIDER);
}

return $attributes;
}),
Expand Down
Loading

0 comments on commit fe962ff

Please sign in to comment.