Skip to content

Commit 2a4bf1d

Browse files
authored
[1.x] Adds type checking (#649)
* Adds type checking * Fixes tests * Update .gitattributes * Update static-analysis.yml
1 parent 9236600 commit 2a4bf1d

File tree

5 files changed

+61
-1
lines changed

5 files changed

+61
-1
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
.gitignore export-ignore
1414
.styleci.yml export-ignore
1515
CHANGELOG.md export-ignore
16+
phpstan.neon.dist export-ignore
1617
phpunit.xml.dist export-ignore
1718
UPGRADE.md export-ignore
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: static analysis
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- '*.x'
8+
pull_request:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
tests:
15+
runs-on: ubuntu-22.04
16+
17+
strategy:
18+
fail-fast: true
19+
20+
name: Static Analysis
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v3
25+
26+
- name: Setup PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: 8.2
30+
tools: composer:v2
31+
coverage: none
32+
extensions: swoole
33+
34+
- name: Install dependencies
35+
uses: nick-fields/retry@v2
36+
with:
37+
timeout_minutes: 5
38+
max_attempts: 5
39+
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress
40+
41+
- name: Execute type checking
42+
run: vendor/bin/phpstan

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@
2323
},
2424
"require-dev": {
2525
"guzzlehttp/guzzle": "^7.2",
26+
"inertiajs/inertia-laravel": "^0.6.9",
27+
"laravel/scout": "^9.8",
28+
"laravel/socialite": "^5.6",
29+
"livewire/livewire": "^2.12",
2630
"mockery/mockery": "^1.4",
2731
"nunomaduro/collision": "^5.10|^6.0|^7.0",
2832
"orchestra/testbench": "^6.16|^7.0|^8.0",
33+
"phpstan/phpstan": "^1.10",
2934
"phpunit/phpunit": "^9.3",
3035
"spiral/roadrunner": "^2.8.2"
3136
},

phpstan.neon.dist

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
parameters:
2+
paths:
3+
- bin
4+
- config
5+
- src
6+
7+
level: 0
8+
9+
ignoreErrors:
10+
- "#Unsafe usage of new static\\(\\)#"
11+
- "#\\(void\\) is used.#"
12+
- "#Function Swoole\\\\Coroutine\\\\run not found.#"

src/Swoole/Handlers/OnWorkerStart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function __invoke($server, int $workerId)
5555
* Boot the Octane worker and application.
5656
*
5757
* @param \Swoole\Http\Server $server
58-
* @return \Laravel\Octane\Worker
58+
* @return \Laravel\Octane\Worker|null
5959
*/
6060
protected function bootWorker($server)
6161
{

0 commit comments

Comments
 (0)