Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enable phpstan, fix: php 7.x compatibility #65

Merged
merged 6 commits into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading