Skip to content

Commit a3a218f

Browse files
[4.x] Adds type checking (#1314)
* Adds type checking * Apply fixes from StyleCI --------- Co-authored-by: StyleCI Bot <[email protected]>
1 parent 31bdb3c commit a3a218f

File tree

5 files changed

+56
-7
lines changed

5 files changed

+56
-7
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public/*.js binary
1818
.styleci.yml export-ignore
1919
CHANGELOG.md export-ignore
2020
package-lock.json export-ignore
21+
phpstan.neon.dist export-ignore
2122
phpunit.xml.dist export-ignore
2223
RELEASE.md export-ignore
2324
UPGRADE.md export-ignore

.github/workflows/static-analysis.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
33+
- name: Install dependencies
34+
uses: nick-fields/retry@v2
35+
with:
36+
timeout_minutes: 5
37+
max_attempts: 5
38+
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress
39+
40+
- name: Execute type checking
41+
run: vendor/bin/phpstan

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
"require-dev": {
2323
"ext-gd": "*",
2424
"guzzlehttp/guzzle": "^6.0|^7.0",
25-
"phpunit/phpunit": "^9.0",
26-
"orchestra/testbench": "^6.0|^7.0|^8.0"
25+
"laravel/octane": "^1.4",
26+
"orchestra/testbench": "^6.0|^7.0|^8.0",
27+
"phpstan/phpstan": "^1.10",
28+
"phpunit/phpunit": "^9.0"
2729
},
2830
"autoload": {
2931
"psr-4": {

phpstan.neon.dist

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
parameters:
2+
paths:
3+
- config
4+
- database
5+
- src
6+
7+
level: 0
8+
9+
ignoreErrors:
10+
- "#Unsafe usage of new static\\(\\)#"

src/Telescope.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use Illuminate\Support\Testing\Fakes\EventFake;
1313
use Laravel\Telescope\Contracts\EntriesRepository;
1414
use Laravel\Telescope\Contracts\TerminableRepository;
15-
use Symfony\Component\Debug\Exception\FatalThrowableError;
1615
use Throwable;
1716

1817
class Telescope
@@ -573,10 +572,6 @@ public static function flushEntries()
573572
*/
574573
public static function catch($e, $tags = [])
575574
{
576-
if ($e instanceof Throwable && ! $e instanceof Exception) {
577-
$e = new FatalThrowableError($e);
578-
}
579-
580575
event(new MessageLogged('error', $e->getMessage(), [
581576
'exception' => $e,
582577
'telescope' => $tags,

0 commit comments

Comments
 (0)