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 #72

Merged
merged 2 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
49 changes: 0 additions & 49 deletions .github/issue_template.md

This file was deleted.

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 Night Mode 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 Night Mode 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: yarn
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 @@ -57,7 +57,12 @@
},
"optional-dependencies": [
"fof/default-user-preferences"
]
],
"flarum-cli": {
"modules": {
"githubActions": true
}
}
},
"autoload": {
"psr-4": {
Expand All @@ -68,5 +73,15 @@
"src/Overrides/Frontend/Assets.php",
"src/Overrides/Frontend/RecompileFrontendAssets.php"
]
},
"scripts": {
"analyse:phpstan": "phpstan analyse",
"clear-cache:phpstan": "phpstan clear-result-cache"
},
"scripts-descriptions": {
"analyse:phpstan": "Run static analysis"
},
"require-dev": {
"flarum/phpstan": "*"
}
}
2 changes: 1 addition & 1 deletion js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"format-check": "prettier --check src"
},
"devDependencies": {
"prettier": "^2.6.2"
"prettier": "^3.0.3"
},
"packageManager": "[email protected]"
}
12 changes: 6 additions & 6 deletions js/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1702,7 +1702,7 @@ __metadata:
es-cookie: ^1.4.0
flarum-tsconfig: ^1.0.2
flarum-webpack-config: ^2.0.2
prettier: ^2.6.2
prettier: ^3.0.3
webpack: ^5.88.2
webpack-cli: ^5.1.4
languageName: unknown
Expand Down Expand Up @@ -2991,12 +2991,12 @@ __metadata:
languageName: node
linkType: hard

"prettier@npm:^2.6.2":
version: 2.7.1
resolution: "prettier@npm:2.7.1"
"prettier@npm:^3.0.3":
version: 3.0.3
resolution: "prettier@npm:3.0.3"
bin:
prettier: bin-prettier.js
checksum: 55a4409182260866ab31284d929b3cb961e5fdb91fe0d2e099dac92eaecec890f36e524b4c19e6ceae839c99c6d7195817579cdffc8e2c80da0cb794463a748b
prettier: bin/prettier.cjs
checksum: e10b9af02b281f6c617362ebd2571b1d7fc9fb8a3bd17e371754428cda992e5e8d8b7a046e8f7d3e2da1dcd21aa001e2e3c797402ebb6111b5cd19609dd228e0
languageName: node
linkType: hard

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']
4 changes: 2 additions & 2 deletions src/Content/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ protected function assembleCompilers(?string $locale): array
/**
* @param string|null $url
* @param string $type
* @param string $auto
* @param bool $auto
*
* @return string
*/
protected function generateTag(?string $url, string $type, string $auto): string
protected function generateTag(?string $url, string $type, bool $auto): string
{
return sprintf(
'<link rel="stylesheet" media="%s" class="nightmode-%s" href="%s" />',
Expand Down
Loading