Skip to content

Commit

Permalink
Merge pull request #96 from LaravelRUS/feature/psalm
Browse files Browse the repository at this point in the history
Add psalm support
  • Loading branch information
tabuna authored Mar 17, 2024
2 parents ba29924 + 8cabd7b commit 34b215d
Show file tree
Hide file tree
Showing 8 changed files with 1,387 additions and 254 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Check for Type Errors

on:
push: # (or pull requests)
paths:
- '.github/workflows/**'
- '**.php'
- 'app/**'
- 'psalm.xml'
- 'composer.json'
- 'composer.lock'

jobs:
static-analysis:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Setup PHP 🔧
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
coverage: none
tools: composer:v2
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install Dependencies 🔧
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Static Analysis
run: vendor/bin/psalm --no-cache
4 changes: 2 additions & 2 deletions app/Docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,9 @@ public function update()
/**
* Разбивает markdown файл на разделы по заголовкам.
*
* @return Массив разделов с заголовками и содержимым
* @return Collection<array-key, array> Массив разделов с заголовками и содержимым
*/
public function getSections()
public function getSections(): Collection
{
// Разбиваем HTML содержимое на разделы по заголовкам
preg_match_all('/<h(\d)>(.+)<\/h\d>(.*)/sU', $this->content(), $matches, PREG_SET_ORDER);
Expand Down
3 changes: 1 addition & 2 deletions app/Models/IdeaKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Orchid\Metrics\Chartable;

class IdeaKey extends Model
Expand All @@ -14,8 +15,6 @@ class IdeaKey extends Model

/**
* Get the idea request associated with the idea key.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function request(): BelongsTo
{
Expand Down
3 changes: 2 additions & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use App\View\Components\Posts\Youtube;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
Expand All @@ -18,7 +19,7 @@ class AppServiceProvider extends ServiceProvider
public function register(): void
{
if ($this->app->environment('production')) {
\URL::forceScheme('https');
URL::forceScheme('https');
}
}

Expand Down
8 changes: 1 addition & 7 deletions app/View/Components/Docs/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ class Content extends Component implements Htmlable

/**
* Create a new component instance.
*
* @return void
*/
public function __construct(string $content)
{
Expand All @@ -34,12 +32,8 @@ public function __construct(string $content)

/**
* Get the view / contents that represent the component.
*
* @throws \DOMException
*
* @return \App\View\Components\DocsContent
*/
public function render()
public function render(): self
{
return $this;
}
Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
],
"license": "CC BY-NC-SA 4.0",
"require": {
"php": ">=8.1",
"php": "^8.3",
"ext-dom": "*",
"cagilo/cagilo": "^3.2",
"doctrine/dbal": "^3.7",
"esplora/spire": "0.0.1",
Expand Down Expand Up @@ -52,7 +53,8 @@
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.1",
"spatie/laravel-ignition": "^2.0"
"spatie/laravel-ignition": "^2.0",
"vimeo/psalm": "^5.23"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit 34b215d

Please sign in to comment.