Skip to content

Commit

Permalink
[1.x] Adds type checking (#649)
Browse files Browse the repository at this point in the history
* Adds type checking

* Fixes tests

* Update .gitattributes

* Update static-analysis.yml
  • Loading branch information
nunomaduro authored Feb 23, 2023
1 parent 9236600 commit 2a4bf1d
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
.gitignore export-ignore
.styleci.yml export-ignore
CHANGELOG.md export-ignore
phpstan.neon.dist export-ignore
phpunit.xml.dist export-ignore
UPGRADE.md export-ignore
42 changes: 42 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: static analysis

on:
push:
branches:
- master
- '*.x'
pull_request:

permissions:
contents: read

jobs:
tests:
runs-on: ubuntu-22.04

strategy:
fail-fast: true

name: Static Analysis

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: composer:v2
coverage: none
extensions: swoole

- name: Install dependencies
uses: nick-fields/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress

- name: Execute type checking
run: vendor/bin/phpstan
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@
},
"require-dev": {
"guzzlehttp/guzzle": "^7.2",
"inertiajs/inertia-laravel": "^0.6.9",
"laravel/scout": "^9.8",
"laravel/socialite": "^5.6",
"livewire/livewire": "^2.12",
"mockery/mockery": "^1.4",
"nunomaduro/collision": "^5.10|^6.0|^7.0",
"orchestra/testbench": "^6.16|^7.0|^8.0",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.3",
"spiral/roadrunner": "^2.8.2"
},
Expand Down
12 changes: 12 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
parameters:
paths:
- bin
- config
- src

level: 0

ignoreErrors:
- "#Unsafe usage of new static\\(\\)#"
- "#\\(void\\) is used.#"
- "#Function Swoole\\\\Coroutine\\\\run not found.#"
2 changes: 1 addition & 1 deletion src/Swoole/Handlers/OnWorkerStart.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function __invoke($server, int $workerId)
* Boot the Octane worker and application.
*
* @param \Swoole\Http\Server $server
* @return \Laravel\Octane\Worker
* @return \Laravel\Octane\Worker|null
*/
protected function bootWorker($server)
{
Expand Down

0 comments on commit 2a4bf1d

Please sign in to comment.