Skip to content

Commit 34b215d

Browse files
authored
Merge pull request #96 from LaravelRUS/feature/psalm
Add psalm support
2 parents ba29924 + 8cabd7b commit 34b215d

File tree

8 files changed

+1387
-254
lines changed

8 files changed

+1387
-254
lines changed

.github/workflows/linter.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Check for Type Errors
2+
3+
on:
4+
push: # (or pull requests)
5+
paths:
6+
- '.github/workflows/**'
7+
- '**.php'
8+
- 'app/**'
9+
- 'psalm.xml'
10+
- 'composer.json'
11+
- 'composer.lock'
12+
13+
jobs:
14+
static-analysis:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
with:
21+
ref: ${{ github.head_ref }}
22+
23+
- name: Setup PHP 🔧
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: 8.3
27+
coverage: none
28+
tools: composer:v2
29+
env:
30+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Install Dependencies 🔧
33+
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
34+
35+
- name: Static Analysis
36+
run: vendor/bin/psalm --no-cache

app/Docs.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,9 @@ public function update()
361361
/**
362362
* Разбивает markdown файл на разделы по заголовкам.
363363
*
364-
* @return Массив разделов с заголовками и содержимым
364+
* @return Collection<array-key, array> Массив разделов с заголовками и содержимым
365365
*/
366-
public function getSections()
366+
public function getSections(): Collection
367367
{
368368
// Разбиваем HTML содержимое на разделы по заголовкам
369369
preg_match_all('/<h(\d)>(.+)<\/h\d>(.*)/sU', $this->content(), $matches, PREG_SET_ORDER);

app/Models/IdeaKey.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Database\Eloquent\Concerns\HasUuids;
77
use Illuminate\Database\Eloquent\Factories\HasFactory;
88
use Illuminate\Database\Eloquent\Model;
9+
use Illuminate\Database\Eloquent\Relations\BelongsTo;
910
use Orchid\Metrics\Chartable;
1011

1112
class IdeaKey extends Model
@@ -14,8 +15,6 @@ class IdeaKey extends Model
1415

1516
/**
1617
* Get the idea request associated with the idea key.
17-
*
18-
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
1918
*/
2019
public function request(): BelongsTo
2120
{

app/Providers/AppServiceProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use App\View\Components\Posts\Youtube;
99
use Illuminate\Pagination\Paginator;
1010
use Illuminate\Support\Facades\Blade;
11+
use Illuminate\Support\Facades\URL;
1112
use Illuminate\Support\ServiceProvider;
1213

1314
class AppServiceProvider extends ServiceProvider
@@ -18,7 +19,7 @@ class AppServiceProvider extends ServiceProvider
1819
public function register(): void
1920
{
2021
if ($this->app->environment('production')) {
21-
\URL::forceScheme('https');
22+
URL::forceScheme('https');
2223
}
2324
}
2425

app/View/Components/Docs/Content.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ class Content extends Component implements Htmlable
2424

2525
/**
2626
* Create a new component instance.
27-
*
28-
* @return void
2927
*/
3028
public function __construct(string $content)
3129
{
@@ -34,12 +32,8 @@ public function __construct(string $content)
3432

3533
/**
3634
* Get the view / contents that represent the component.
37-
*
38-
* @throws \DOMException
39-
*
40-
* @return \App\View\Components\DocsContent
4135
*/
42-
public function render()
36+
public function render(): self
4337
{
4438
return $this;
4539
}

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
],
1818
"license": "CC BY-NC-SA 4.0",
1919
"require": {
20-
"php": ">=8.1",
20+
"php": "^8.3",
21+
"ext-dom": "*",
2122
"cagilo/cagilo": "^3.2",
2223
"doctrine/dbal": "^3.7",
2324
"esplora/spire": "0.0.1",
@@ -52,7 +53,8 @@
5253
"mockery/mockery": "^1.4.4",
5354
"nunomaduro/collision": "^7.0",
5455
"phpunit/phpunit": "^10.1",
55-
"spatie/laravel-ignition": "^2.0"
56+
"spatie/laravel-ignition": "^2.0",
57+
"vimeo/psalm": "^5.23"
5658
},
5759
"autoload": {
5860
"psr-4": {

0 commit comments

Comments
 (0)