Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

Add Laravel 9 support #2

Merged
merged 6 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.0]
php: [8.1]
dependency-version: [prefer-stable]

name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run-fix-code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest ]
php: [ 8.0 ]
dependency-version: [ prefer-stable ]
os: [ubuntu-latest]
php: [8.1]
dependency-version: [prefer-stable]
env:
COMPOSER_NO_INTERACTION: 1

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.0]
php: [8.1]
dependency-version: [prefer-stable]

name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [7.4, 8.0]
php: [7.4, 8.0, 8.1]
dependency-version: [prefer-lowest, prefer-stable]

name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ build
.phpunit.cache
.php_cs.cache
.php_cs.tests.cache
.phpunit.result.cache
phpstan.neon
phpunit.xml
43 changes: 20 additions & 23 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,47 +1,34 @@
{
"name": "wimski/laravel-ide-helper-hook-eloquent-has-by-non-dependent-subquery",
"type": "library",
"description": "Add Eloquent Has By Non-dependent Subquery support to Laravel IDE Helper",
"license": "MIT",
"type": "library",
"keywords": [
"laravel-ide-helper",
"eloquent-has-by-non-dependent-subquery"
],
"homepage": "https://github.com/wimski/laravel-ide-helper-hook-eloquent-has-by-non-dependent-subquery",
"license": "MIT",
"authors": [
{
"name": "Wimski",
"email": "thatonedudewimski@gmail.com",
"role": "Developer"
}
],
"homepage": "https://github.com/wimski/laravel-ide-helper-hook-eloquent-has-by-non-dependent-subquery",
"require": {
"php": "^7.4 || ^8.0",
"barryvdh/laravel-ide-helper": "^2.10",
"illuminate/contracts": "^7.0 || ^8.0",
"illuminate/database": "^7.0 || ^8.0",
"illuminate/support": "^7.0 || ^8.0",
"barryvdh/laravel-ide-helper": "^2.12.2",
"laravel/framework": "^8.74 || ^9.0",
"mpyw/eloquent-has-by-non-dependent-subquery": "^1.0 || ^2.0",
"phpdocumentor/type-resolver": "^1.4"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.18",
"nunomaduro/larastan": "^0.7.3",
"orchestra/testbench": "^6.7",
"phpstan/phpstan-mockery": "^0.12.13",
"phpstan/phpstan-phpunit": "^0.12.18",
"phpunit/phpunit": "^9.5",
"thecodingmachine/phpstan-safe-rule": "^1.0"
},
"config": {
"sort-packages": true
},
"extra": {
"laravel": {
"providers": [
"Wimski\\LaravelIdeHelperHookEloquentHasByNonDependentSubquery\\Providers\\LaravelIdeHelperHookEloquentHasByNonDependentSubqueryServiceProvider"
]
}
"nunomaduro/larastan": "^1.0 || ^2.0",
"orchestra/testbench": "^6.7 || ^7.0",
"phpstan/phpstan-mockery": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5"
},
"autoload": {
"psr-4": {
Expand All @@ -53,6 +40,16 @@
"Wimski\\LaravelIdeHelperHookEloquentHasByNonDependentSubquery\\Tests\\": "tests"
}
},
"config": {
"sort-packages": true
},
"extra": {
"laravel": {
"providers": [
"Wimski\\LaravelIdeHelperHookEloquentHasByNonDependentSubquery\\Providers\\LaravelIdeHelperHookEloquentHasByNonDependentSubqueryServiceProvider"
]
}
},
"scripts": {
"analyze": "@php vendor/phpstan/phpstan/phpstan analyse --memory-limit 1G",
"check-style": [
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ includes:
- vendor/phpstan/phpstan-mockery/extension.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
- vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon

parameters:
level: max
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="./vendor/autoload.php"
colors="true"
convertDeprecationsToExceptions="false"
>
<testsuites>
<testsuite name="Integration">
Expand Down
1 change: 0 additions & 1 deletion src/Hooks/EloquentHasByNonDependentSubqueryHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use phpDocumentor\Reflection\Types\ContextFactory;
use ReflectionClass;
use ReflectionObject;
use function Safe\array_flip;

class EloquentHasByNonDependentSubqueryHook implements ModelHookInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ public function register(): void
/** @var Config $config */
$config = $this->app->get('config');

/** @var string[] $modelHooks */
$modelHooks = $config->get('ide-helper.model_hooks', []);

$config->set('ide-helper.model_hooks', array_merge([
EloquentHasByNonDependentSubqueryHook::class,
], $config->get('ide-helper.model_hooks', [])));
], $modelHooks));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Wimski\LaravelIdeHelperHookEloquentHasByNonDependentSubquery\Tests\Integration\AbstractIntegrationTest;
use Wimski\LaravelIdeHelperHookEloquentHasByNonDependentSubquery\Tests\stubs\Models\TestModel;
use Wimski\LaravelIdeHelperHookEloquentHasByNonDependentSubquery\Tests\stubs\Models\TestModelWithBuilder;
use function Safe\file_get_contents;

class EloquentHasByNonDependentSubqueryHookTest extends AbstractIntegrationTest
{
Expand Down Expand Up @@ -48,6 +47,7 @@ public function it_writes_methods_to_the_model(): void

$this->mockFilesystem($this->getStubsPath('Models' . DIRECTORY_SEPARATOR . 'TestModel.php'), $actualContent);

/** @var ModelsCommand $command */
$command = $this->app->make(ModelsCommand::class);

$tester = $this->runCommand($command, [
Expand Down Expand Up @@ -99,6 +99,7 @@ public function it_writes_methods_to_the_model_with_builder_already_imported():

$this->mockFilesystem($this->getStubsPath('Models' . DIRECTORY_SEPARATOR . 'TestModelWithBuilder.php'), $actualContent);

/** @var ModelsCommand $command */
$command = $this->app->make(ModelsCommand::class);

$tester = $this->runCommand($command, [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class LaravelIdeHelperHookEloquentHasByNonDependentSubqueryServiceProviderTest e
*/
public function it_adds_the_hook_to_the_config(): void
{
static::assertContains(EloquentHasByNonDependentSubqueryHook::class, config('ide-helper.model_hooks'));
/** @var string[] $modelHooks */
$modelHooks = config('ide-helper.model_hooks');

static::assertContains(EloquentHasByNonDependentSubqueryHook::class, $modelHooks);
}
}