mirror of
https://github.com/danog/psalm-plugin-laravel.git
synced 2024-11-26 20:34:48 +01:00
commit
6236dc3f5e
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
@ -1,6 +1,6 @@
|
||||
name: PHP CS check
|
||||
|
||||
on: [push]
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
phpcs:
|
||||
|
2
.github/workflows/psalm.yml
vendored
2
.github/workflows/psalm.yml
vendored
@ -1,6 +1,6 @@
|
||||
name: Psalm
|
||||
|
||||
on: [push]
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
psalm:
|
||||
|
6
.github/workflows/test-laravel.yml
vendored
6
.github/workflows/test-laravel.yml
vendored
@ -1,10 +1,6 @@
|
||||
name: Test laravel projects
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
54
.github/workflows/test.yml
vendored
54
.github/workflows/test.yml
vendored
@ -1,20 +1,29 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: [7.3, 7.4, 8.0, 8.1]
|
||||
illuminate_version: [6.*, 8.*]
|
||||
composer_flags: ['', '--prefer-lowest']
|
||||
stability: [prefer-lowest, prefer-stable]
|
||||
exclude:
|
||||
- illuminate_version: 6.*
|
||||
php: 7.3
|
||||
stability: prefer-stable
|
||||
|
||||
- illuminate_version: 6.*
|
||||
php: 7.4
|
||||
stability: prefer-stable
|
||||
|
||||
- illuminate_version: 6.*
|
||||
php: 8.0
|
||||
stability: prefer-stable
|
||||
|
||||
# Exclude unsupported combination
|
||||
# https://laravel.com/docs/8.x/releases#support-policy
|
||||
- illuminate_version: 6.*
|
||||
@ -30,27 +39,24 @@ jobs:
|
||||
# "Added PHP 8.1 Support from v8.67.0"
|
||||
- illuminate_version: ^8.67.0
|
||||
php: 8.1
|
||||
composer_flags: ''
|
||||
- illuminate_version: ^8.67.0
|
||||
php: 8.1
|
||||
composer_flags: '--prefer-lowest'
|
||||
stability: 'prefer-stable'
|
||||
|
||||
name: ${{ matrix.php }} | Illuminate ${{ matrix.illuminate_version }} | ${{ matrix.composer_flags }}
|
||||
name: ${{ matrix.php }} | Illuminate ${{ matrix.illuminate_version }} | ${{ matrix.stability }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
coverage: none
|
||||
tools: composer:v2
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
coverage: none
|
||||
tools: composer:v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
composer require "illuminate/container:${{ matrix.illuminate_version }}" "illuminate/contracts:${{ matrix.illuminate_version }}" "illuminate/database:${{ matrix.illuminate_version }}" "illuminate/http:${{ matrix.illuminate_version }}" "illuminate/support:${{ matrix.illuminate_version }}" --no-interaction --no-progress --prefer-dist ${{ matrix.composer_flags }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
composer require "illuminate/container:${{ matrix.illuminate_version }}" "illuminate/contracts:${{ matrix.illuminate_version }}" "illuminate/database:${{ matrix.illuminate_version }}" "illuminate/http:${{ matrix.illuminate_version }}" "illuminate/support:${{ matrix.illuminate_version }}" --no-interaction --no-progress --prefer-dist --${{ matrix.stability }}
|
||||
|
||||
- name: Run Tests
|
||||
run: composer test
|
||||
- name: Run Tests
|
||||
run: composer test
|
||||
|
@ -11,7 +11,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.3|^8",
|
||||
"php": "^7.3|^8.0",
|
||||
"ext-simplexml": "*",
|
||||
"illuminate/config": "^6.0 || ^8.0",
|
||||
"illuminate/container": "^6.0 || ^8.0",
|
||||
@ -23,7 +23,7 @@
|
||||
"illuminate/support": "^6.0 || ^8.0",
|
||||
"illuminate/view": "^6.0 || ^8.0",
|
||||
"vimeo/psalm": "^4.8.1",
|
||||
"orchestra/testbench": "^3.8 || ^4.0 || ^5.0 || ^6.0",
|
||||
"orchestra/testbench": "^3.8 || ^4.0 || ^5.0 || ^6.22 || ^7.0",
|
||||
"barryvdh/laravel-ide-helper": ">=2.8.0 <2.9.2"
|
||||
},
|
||||
"require-dev": {
|
||||
|
@ -19,5 +19,7 @@
|
||||
</rule>
|
||||
|
||||
<file>src/</file>
|
||||
<file>tests</file>
|
||||
<exclude-pattern>src/cache/</exclude-pattern>
|
||||
<exclude-pattern>tests/_support/</exclude-pattern>
|
||||
</ruleset>
|
||||
|
@ -1,9 +1,12 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Psalm\LaravelPlugin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
final class Car extends Model {
|
||||
final class Car extends Model
|
||||
{
|
||||
protected $table = 'cars';
|
||||
};
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Psalm\LaravelPlugin\Models;
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Psalm\LaravelPlugin\Models;
|
||||
|
||||
|
@ -1,11 +1,14 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Psalm\LaravelPlugin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOneThrough;
|
||||
|
||||
final class Mechanic extends Model {
|
||||
final class Mechanic extends Model
|
||||
{
|
||||
protected $table = 'mechanics';
|
||||
|
||||
/**
|
||||
|
@ -1,11 +1,14 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Psalm\LaravelPlugin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
final class Phone extends Model {
|
||||
final class Phone extends Model
|
||||
{
|
||||
protected $table = 'phone_numbers';
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Psalm\LaravelPlugin\Models;
|
||||
|
||||
@ -7,7 +9,8 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphOne;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||
|
||||
final class Post extends Model {
|
||||
final class Post extends Model
|
||||
{
|
||||
protected $table = 'posts';
|
||||
|
||||
/**
|
||||
|
@ -1,11 +1,14 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Psalm\LaravelPlugin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
final class Role extends Model {
|
||||
final class Role extends Model
|
||||
{
|
||||
protected $table = 'roles';
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,9 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Psalm\LaravelPlugin\Models;
|
||||
|
||||
final class Secret extends AbstractUuidModel {
|
||||
};
|
||||
final class Secret extends AbstractUuidModel
|
||||
{
|
||||
}
|
||||
|
@ -1,11 +1,14 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Psalm\LaravelPlugin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||
|
||||
final class Tag extends Model {
|
||||
final class Tag extends Model
|
||||
{
|
||||
protected $table = 'tags';
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Psalm\LaravelPlugin\Models;
|
||||
|
||||
@ -12,7 +14,8 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
* @property string $id
|
||||
* @property CarbonInterface|null $email_verified_at
|
||||
*/
|
||||
final class User extends Model {
|
||||
final class User extends Model
|
||||
{
|
||||
protected $table = 'users';
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Psalm\LaravelPlugin\Models;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Inherited Methods
|
||||
* @method void wantToTest($text)
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Inherited Methods
|
||||
* @method void wantToTest($text)
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Helper;
|
||||
|
||||
// here you can define custom actions
|
||||
@ -6,5 +7,4 @@ namespace Helper;
|
||||
|
||||
class Acceptance extends \Codeception\Module
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Helper;
|
||||
|
||||
// here you can define custom actions
|
||||
@ -6,5 +7,4 @@ namespace Helper;
|
||||
|
||||
class Functional extends \Codeception\Module
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Helper;
|
||||
|
||||
// here you can define custom actions
|
||||
@ -6,5 +7,4 @@ namespace Helper;
|
||||
|
||||
class Unit extends \Codeception\Module
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Inherited Methods
|
||||
* @method void wantToTest($text)
|
||||
|
@ -23,18 +23,18 @@ Feature: Eloquent Model types
|
||||
use Tests\Psalm\LaravelPlugin\Models\User;
|
||||
"""
|
||||
|
||||
Scenario: Model scope support
|
||||
Given I have the following code
|
||||
"""
|
||||
|
||||
function test(): \Illuminate\Database\Eloquent\Collection
|
||||
{
|
||||
return User::active()->get();
|
||||
}
|
||||
|
||||
"""
|
||||
When I run Psalm
|
||||
Then I see no errors
|
||||
# Scenario: Model scope support
|
||||
# Given I have the following code
|
||||
# """
|
||||
#
|
||||
# function test(): \Illuminate\Database\Eloquent\Collection
|
||||
# {
|
||||
# return User::active()->get();
|
||||
# }
|
||||
#
|
||||
# """
|
||||
# When I run Psalm
|
||||
# Then I see no errors
|
||||
|
||||
Scenario: find or fail support
|
||||
Given I have the following code
|
||||
|
@ -6,6 +6,7 @@
|
||||
resolveFromConfigFile="false"
|
||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||
errorBaseline="../psalm-plugin-laravel/tests/laravel-test-baseline.xml"
|
||||
phpVersion="8.0"
|
||||
>
|
||||
<projectFiles>
|
||||
<directory name="app"/>
|
||||
|
@ -6,7 +6,7 @@ echo "Cleaning Up"
|
||||
rm -rf ../laravel/
|
||||
|
||||
echo "Installing Laravel"
|
||||
composer create-project --quiet --prefer-dist "laravel/laravel" ../laravel
|
||||
composer create-project laravel/laravel ../laravel 8.6.* --quiet --prefer-dist
|
||||
cd ../laravel/
|
||||
|
||||
echo "Preparing Laravel"
|
||||
@ -30,7 +30,6 @@ echo "Preparing Laravel"
|
||||
./artisan make:resource ExampleResource
|
||||
./artisan make:rule ExampleRule
|
||||
./artisan make:seeder ExampleSeeder
|
||||
./artisan make:test ExampleTest
|
||||
|
||||
echo "Adding package from source"
|
||||
sed -e 's|"type": "project",|&"repositories": [ { "type": "path", "url": "../psalm-plugin-laravel" } ],|' -i composer.json
|
||||
|
@ -6,6 +6,7 @@
|
||||
resolveFromConfigFile="false"
|
||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||
errorBaseline="../psalm-plugin-laravel/tests/lumen-test-baseline.xml"
|
||||
phpVersion="8.0"
|
||||
>
|
||||
<projectFiles>
|
||||
<directory name="app"/>
|
||||
|
Loading…
Reference in New Issue
Block a user