mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
[PHP8] Add initial compatibility (#1106)
* gha: run on PHP8 too The composer.json constraint is unbound, so it's already "allowed" at least. * gha: remove php-cs-fixer when running unit tests - not necessary anyway - not compatible with PHP8 currently * gha: lumen 6 and 7 don't support PHP8 * composer.json: allow spatie/phpunit-snapshot-assertions 4.* for PHP8 compatibility * php8-compat: Method ReflectionParameter::getClass() is deprecated * php8-compat: adapt expected error message depending on PHP version * composer.json: bump mockery to 1.3.3 minimum This is the minimum version also supporting PHP8 * gha: disable prefer-lowest for PHP8 Some lower version requirements like doctrone/dbal won't work and would require at least dbal 2.12.0, which in turn doesn't support PHP 7.2 anymore. So instead of bumping dbal and excluding PHP 7.2 users, we ignore the lowest version for PHP 8 for the time being. * Update CHANGELOG.md
This commit is contained in:
@@ -18,9 +18,13 @@ jobs:
|
|||||||
COMPOSER_NO_INTERACTION: 1
|
COMPOSER_NO_INTERACTION: 1
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php: [7.4, 7.3, 7.2]
|
php: [8.0, 7.4, 7.3, 7.2]
|
||||||
lumen: [8.*, 7.*, 6.*]
|
lumen: [8.*, 7.*, 6.*]
|
||||||
exclude:
|
exclude:
|
||||||
|
- lumen: 6.*
|
||||||
|
php: 8.0
|
||||||
|
- lumen: 7.*
|
||||||
|
php: 8.0
|
||||||
- lumen: 8.*
|
- lumen: 8.*
|
||||||
php: 7.2
|
php: 7.2
|
||||||
name: P${{ matrix.php }} - Lumen${{ matrix.lumen }}
|
name: P${{ matrix.php }} - Lumen${{ matrix.lumen }}
|
||||||
|
|||||||
@@ -19,12 +19,14 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php: [7.4, 7.3, 7.2]
|
php: [8.0, 7.4, 7.3, 7.2]
|
||||||
laravel: [8.*, 7.*, 6.*]
|
laravel: [8.*, 7.*, 6.*]
|
||||||
dependency-version: [prefer-lowest, prefer-stable]
|
dependency-version: [prefer-lowest, prefer-stable]
|
||||||
exclude:
|
exclude:
|
||||||
- laravel: 8.*
|
- laravel: 8.*
|
||||||
php: 7.2
|
php: 7.2
|
||||||
|
- php: 8.0
|
||||||
|
dependency-version: prefer-lowest
|
||||||
|
|
||||||
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
|
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
|
||||||
|
|
||||||
@@ -42,6 +44,7 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
composer remove vimeo/psalm --no-update --dev
|
composer remove vimeo/psalm --no-update --dev
|
||||||
|
composer remove friendsofphp/php-cs-fixer --no-update --dev
|
||||||
composer require "laravel/framework:${{ matrix.laravel }}" --no-update --no-progress
|
composer require "laravel/framework:${{ matrix.laravel }}" --no-update --no-progress
|
||||||
composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress
|
composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Fix phpdoc generate for custom cast with parameter [\#986 / artelkr](https://github.com/barryvdh/laravel-ide-helper/pull/986)
|
- Fix phpdoc generate for custom cast with parameter [\#986 / artelkr](https://github.com/barryvdh/laravel-ide-helper/pull/986)
|
||||||
- Created a possibility to add custom relation type [\#987 / efinder2](https://github.com/barryvdh/laravel-ide-helper/pull/987)
|
- Created a possibility to add custom relation type [\#987 / efinder2](https://github.com/barryvdh/laravel-ide-helper/pull/987)
|
||||||
- Added `@see` with macro/mixin definition location to PhpDoc [\#1054 / riesjart](https://github.com/barryvdh/laravel-ide-helper/pull/1054)
|
- Added `@see` with macro/mixin definition location to PhpDoc [\#1054 / riesjart](https://github.com/barryvdh/laravel-ide-helper/pull/1054)
|
||||||
|
- Initial compatibility for PHP8 [\#1106 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1106)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Implement DeferrableProvider [\#914 / kon-shou](https://github.com/barryvdh/laravel-ide-helper/pull/914)
|
- Implement DeferrableProvider [\#914 / kon-shou](https://github.com/barryvdh/laravel-ide-helper/pull/914)
|
||||||
|
|||||||
+2
-2
@@ -35,10 +35,10 @@
|
|||||||
"friendsofphp/php-cs-fixer": "^2",
|
"friendsofphp/php-cs-fixer": "^2",
|
||||||
"illuminate/config": "^6 || ^7 || ^8",
|
"illuminate/config": "^6 || ^7 || ^8",
|
||||||
"illuminate/view": "^6 || ^7 || ^8",
|
"illuminate/view": "^6 || ^7 || ^8",
|
||||||
"mockery/mockery": "^1.3",
|
"mockery/mockery": "^1.3.3",
|
||||||
"orchestra/testbench": "^4 || ^5 || ^6",
|
"orchestra/testbench": "^4 || ^5 || ^6",
|
||||||
"phpunit/phpunit": "^8.5 || ^9",
|
"phpunit/phpunit": "^8.5 || ^9",
|
||||||
"spatie/phpunit-snapshot-assertions": "^1.4 || ^2.2 || ^3",
|
"spatie/phpunit-snapshot-assertions": "^1.4 || ^2.2 || ^3 || ^4",
|
||||||
"vimeo/psalm": "^3.12"
|
"vimeo/psalm": "^3.12"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ class ModelsCommand extends Command
|
|||||||
|
|
||||||
$database = null;
|
$database = null;
|
||||||
if (strpos($table, '.')) {
|
if (strpos($table, '.')) {
|
||||||
list($database, $table) = explode('.', $table);
|
[$database, $table] = explode('.', $table);
|
||||||
}
|
}
|
||||||
|
|
||||||
$columns = $schema->listTableColumns($table, $database);
|
$columns = $schema->listTableColumns($table, $database);
|
||||||
@@ -895,8 +895,18 @@ class ModelsCommand extends Command
|
|||||||
$paramsWithDefault = [];
|
$paramsWithDefault = [];
|
||||||
/** @var \ReflectionParameter $param */
|
/** @var \ReflectionParameter $param */
|
||||||
foreach ($method->getParameters() as $param) {
|
foreach ($method->getParameters() as $param) {
|
||||||
$paramClass = $param->getClass();
|
$paramType = $param->getType();
|
||||||
$paramStr = (!is_null($paramClass) ? '\\' . $paramClass->getName() . ' ' : '') . '$' . $param->getName();
|
|
||||||
|
$paramStr = '$' . $param->getName();
|
||||||
|
if ($paramType) {
|
||||||
|
$paramTypeStr = $paramType->getName();
|
||||||
|
if (!$paramType->isBuiltin()) {
|
||||||
|
$paramTypeStr = '\\' . $paramTypeStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
$paramStr = $paramTypeStr . ' ' . $paramStr;
|
||||||
|
}
|
||||||
|
|
||||||
if ($param->isOptional() && $param->isDefaultValueAvailable()) {
|
if ($param->isOptional() && $param->isDefaultValueAvailable()) {
|
||||||
$default = $param->getDefaultValue();
|
$default = $param->getDefaultValue();
|
||||||
if (is_bool($default)) {
|
if (is_bool($default)) {
|
||||||
|
|||||||
@@ -17,11 +17,19 @@ class Test extends AbstractModelsCommand
|
|||||||
'--write' => true,
|
'--write' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if (PHP_VERSION_ID >= 80000) {
|
||||||
|
$errors = <<<TXT
|
||||||
|
Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicBelongsTo() : Attempt to read property "created_at" on null
|
||||||
|
Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicHasMany() : Attempt to read property "created_at" on null
|
||||||
|
Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicHasOne() : Attempt to read property "created_at" on null
|
||||||
|
TXT;
|
||||||
|
} else {
|
||||||
$errors = <<<TXT
|
$errors = <<<TXT
|
||||||
Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicBelongsTo() : Trying to get property 'created_at' of non-object
|
Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicBelongsTo() : Trying to get property 'created_at' of non-object
|
||||||
Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicHasMany() : Trying to get property 'created_at' of non-object
|
Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicHasMany() : Trying to get property 'created_at' of non-object
|
||||||
Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicHasOne() : Trying to get property 'created_at' of non-object
|
Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicHasOne() : Trying to get property 'created_at' of non-object
|
||||||
TXT;
|
TXT;
|
||||||
|
}
|
||||||
|
|
||||||
$this->assertSame(0, $tester->getStatusCode());
|
$this->assertSame(0, $tester->getStatusCode());
|
||||||
$this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay());
|
$this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay());
|
||||||
|
|||||||
+1
-1
@@ -88,7 +88,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
* @property-read int|null $posts_count
|
* @property-read int|null $posts_count
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post newModelQuery()
|
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post newModelQuery()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post newQuery()
|
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post newQuery()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post null($unusedParam)
|
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post null(string $unusedParam)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post onlyTrashed()
|
* @method static \Illuminate\Database\Query\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post onlyTrashed()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post query()
|
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post query()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereBigIntegerNotNullable($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereBigIntegerNotNullable($value)
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ use Illuminate\Support\Carbon;
|
|||||||
* @property-read int|null $posts_count
|
* @property-read int|null $posts_count
|
||||||
* @method static EloquentBuilder|Post newModelQuery()
|
* @method static EloquentBuilder|Post newModelQuery()
|
||||||
* @method static EloquentBuilder|Post newQuery()
|
* @method static EloquentBuilder|Post newQuery()
|
||||||
* @method static EloquentBuilder|Post null($unusedParam)
|
* @method static EloquentBuilder|Post null(string $unusedParam)
|
||||||
* @method static QueryBuilder|Post onlyTrashed()
|
* @method static QueryBuilder|Post onlyTrashed()
|
||||||
* @method static EloquentBuilder|Post query()
|
* @method static EloquentBuilder|Post query()
|
||||||
* @method static EloquentBuilder|Post whereBigIntegerNotNullable($value)
|
* @method static EloquentBuilder|Post whereBigIntegerNotNullable($value)
|
||||||
|
|||||||
Reference in New Issue
Block a user