Skip to content

Commit

Permalink
[feature/psalm] Add basic psalm support
Browse files Browse the repository at this point in the history
  • Loading branch information
SerafimArts committed Mar 16, 2024
1 parent f4413d4 commit 148544d
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 13 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Check & fix styling

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

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
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"license": "CC BY-NC-SA 4.0",
"require": {
"php": "^8.3",
"ext-dom": "*",
"cagilo/cagilo": "^3.2",
"doctrine/dbal": "^3.7",
"esplora/spire": "0.0.1",
Expand Down
2 changes: 1 addition & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
errorLevel="7"
resolveFromConfigFile="true"
findUnusedBaselineEntry="false"
findUnusedCode="false"
Expand Down

0 comments on commit 148544d

Please sign in to comment.