diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 00000000..3147186a --- /dev/null +++ b/.github/workflows/linter.yml @@ -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 diff --git a/app/Docs.php b/app/Docs.php index e092f7aa..bfc74a7e 100644 --- a/app/Docs.php +++ b/app/Docs.php @@ -361,9 +361,9 @@ public function update() /** * Π Π°Π·Π±ΠΈΠ²Π°Π΅Ρ‚ markdown Ρ„Π°ΠΉΠ» Π½Π° Ρ€Π°Π·Π΄Π΅Π»Ρ‹ ΠΏΠΎ Π·Π°Π³ΠΎΠ»ΠΎΠ²ΠΊΠ°ΠΌ. * - * @return Массив Ρ€Π°Π·Π΄Π΅Π»ΠΎΠ² с Π·Π°Π³ΠΎΠ»ΠΎΠ²ΠΊΠ°ΠΌΠΈ ΠΈ содСрТимым + * @return Collection Массив Ρ€Π°Π·Π΄Π΅Π»ΠΎΠ² с Π·Π°Π³ΠΎΠ»ΠΎΠ²ΠΊΠ°ΠΌΠΈ ΠΈ содСрТимым */ - public function getSections() + public function getSections(): Collection { // Π Π°Π·Π±ΠΈΠ²Π°Π΅ΠΌ HTML содСрТимоС Π½Π° Ρ€Π°Π·Π΄Π΅Π»Ρ‹ ΠΏΠΎ Π·Π°Π³ΠΎΠ»ΠΎΠ²ΠΊΠ°ΠΌ preg_match_all('/(.+)<\/h\d>(.*)/sU', $this->content(), $matches, PREG_SET_ORDER); diff --git a/app/Models/IdeaKey.php b/app/Models/IdeaKey.php index 63d60bfc..7d67b77a 100644 --- a/app/Models/IdeaKey.php +++ b/app/Models/IdeaKey.php @@ -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 @@ -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 { diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 7a40b8e2..e360cf5d 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -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 @@ -18,7 +19,7 @@ class AppServiceProvider extends ServiceProvider public function register(): void { if ($this->app->environment('production')) { - \URL::forceScheme('https'); + URL::forceScheme('https'); } } diff --git a/app/View/Components/Docs/Content.php b/app/View/Components/Docs/Content.php index 4d2c63f3..c6d647ac 100644 --- a/app/View/Components/Docs/Content.php +++ b/app/View/Components/Docs/Content.php @@ -24,8 +24,6 @@ class Content extends Component implements Htmlable /** * Create a new component instance. - * - * @return void */ public function __construct(string $content) { @@ -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; } diff --git a/composer.json b/composer.json index 37d22e7e..3280724a 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/psalm.xml b/psalm.xml index 3c48b370..525b1ec7 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,6 +1,6 @@