Skip to content

Commit

Permalink
Migrate to Console AsCommand attribute (#215)
Browse files Browse the repository at this point in the history
* Migrate to Console AsCommand attribute

* Anonymous migration classes

* Fix tests run
  • Loading branch information
antonkomarev authored Jan 4, 2023
1 parent 80c7ad2 commit bb19dbd
Show file tree
Hide file tree
Showing 30 changed files with 63 additions and 155 deletions.
32 changes: 2 additions & 30 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,10 @@ jobs:
fail-fast: true
matrix:
os: [ ubuntu-latest ]
php: [ 7.2, 7.3, 7.4, 8.0, 8.1 ]
laravel: [ 6.*, 7.*, 8.*, 9.* ]
php: [ 8.0, 8.1 ]
laravel: [ 9.* ]
dependency-version: [ prefer-lowest, prefer-stable ]
exclude:
- laravel: 6.*
dependency-version: prefer-lowest
- laravel: 7.*
dependency-version: prefer-lowest
- laravel: 8.*
dependency-version: prefer-lowest
- laravel: 9.*
dependency-version: prefer-lowest
- laravel: 6.*
php: 8.1
- laravel: 7.*
php: 8.1
- laravel: 8.*
php: 7.2
- laravel: 9.*
php: 7.2
- laravel: 9.*
php: 7.3
- laravel: 9.*
php: 7.4
include:
- laravel: 6.*
testbench: 4.*
- laravel: 7.*
testbench: 5.*
- laravel: 8.*
testbench: 6.*
legacy-factories: 1.*
- laravel: 9.*
testbench: 7.*
legacy-factories: 1.*
Expand Down
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<p align="center">
<a href="https://discord.gg/dSyyNrg"><img src="https://img.shields.io/static/v1?logo=discord&label=&message=Discord&color=36393f&style=flat-square" alt="Discord"></a>
<a href="https://github.com/cybercog/laravel-love/releases"><img src="https://img.shields.io/github/release/cybercog/laravel-love.svg?style=flat-square" alt="Releases"></a>
<a href="https://travis-ci.org/cybercog/laravel-love"><img src="https://img.shields.io/travis/cybercog/laravel-love/master.svg?style=flat-square" alt="Build Status"></a>
<a href="https://github.com/cybercog/laravel-love/actions/workflows/tests.yml"><img src="https://img.shields.io/github/actions/workflow/status/cybercog/laravel-love/tests.yml?style=flat-square" alt="Build"></a>
<a href="https://styleci.io/repos/116058336"><img src="https://styleci.io/repos/116058336/shield" alt="StyleCI"></a>
<a href="https://scrutinizer-ci.com/g/cybercog/laravel-love/?branch=master"><img src="https://img.shields.io/scrutinizer/g/cybercog/laravel-love.svg?style=flat-square" alt="Code Quality"></a>
<a href="https://github.com/cybercog/laravel-love/blob/master/LICENSE"><img src="https://img.shields.io/github/license/cybercog/laravel-love.svg?style=flat-square" alt="License"></a>
Expand All @@ -18,7 +18,7 @@ Make any model reactable in a minutes!

There are many implementations in modern applications:

- Github Reactions
- GitHub Reactions
- Facebook Reactions
- YouTube Likes
- Slack Reactions
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@
"docs": "https://laravel-love.readme.io"
},
"require": {
"php": "^7.2.5|^8.0",
"illuminate/database": "^6.20.14|^7.30.4|^8.24|^9.0",
"illuminate/support": "^6.0|^7.0|^8.0|^9.0"
"php": "^8.0",
"illuminate/database": "^9.0",
"illuminate/support": "^9.0"
},
"require-dev": {
"mockery/mockery": "^1.0",
"orchestra/database": "~3.7.0|~3.8.0|^4.0|^5.0|^6.0|^7.0",
"orchestra/testbench": "~3.7.0|~3.8.0|^4.0|^5.0|^6.0|^7.0",
"orchestra/database": "^7.0",
"orchestra/testbench": "^7.0",
"phpstan/phpstan": "^0.12.29",
"phpunit/phpunit": "^7.5|^8.0|^9.0"
"phpunit/phpunit": "^9.0"
},
"autoload": {
"psr-4": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Cog\Laravel\Love\Support\Database\Migration;
use Illuminate\Database\Schema\Blueprint;

final class CreateLoveReactersTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -42,4 +42,4 @@ public function down(): void
{
$this->schema->dropIfExists((new Reacter())->getTable());
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Cog\Laravel\Love\Support\Database\Migration;
use Illuminate\Database\Schema\Blueprint;

final class CreateLoveReactantsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -24,7 +24,7 @@ final class CreateLoveReactantsTable extends Migration
*/
public function up(): void
{
$this->schema->create((new Reactant)->getTable(), function (Blueprint $table) {
$this->schema->create((new Reactant())->getTable(), function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('type');
$table->timestamps();
Expand All @@ -40,6 +40,6 @@ public function up(): void
*/
public function down(): void
{
$this->schema->dropIfExists((new Reactant)->getTable());
$this->schema->dropIfExists((new Reactant())->getTable());
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Cog\Laravel\Love\Support\Database\Migration;
use Illuminate\Database\Schema\Blueprint;

final class CreateLoveReactionTypesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -43,4 +43,4 @@ public function down(): void
{
$this->schema->dropIfExists((new ReactionType())->getTable());
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use Cog\Laravel\Love\Support\Database\Migration;
use Illuminate\Database\Schema\Blueprint;

final class CreateLoveReactionsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -80,4 +80,4 @@ public function down(): void
{
$this->schema->dropIfExists((new Reaction())->getTable());
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Cog\Laravel\Love\Support\Database\Migration;
use Illuminate\Database\Schema\Blueprint;

final class CreateLoveReactantReactionCountersTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -59,4 +59,4 @@ public function down(): void
{
$this->schema->dropIfExists((new ReactionCounter())->getTable());
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Cog\Laravel\Love\Support\Database\Migration;
use Illuminate\Database\Schema\Blueprint;

final class CreateLoveReactantReactionTotalsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -48,4 +48,4 @@ public function down(): void
{
$this->schema->dropIfExists((new ReactionTotal())->getTable());
}
}
};
4 changes: 2 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_CONNECTION" value="testing"/>
<env name="DB_DATABASE" value=":memory:"/>
<server name="APP_ENV" value="testing"/>
<server name="CACHE_DRIVER" value="array"/>
<server name="SESSION_DRIVER" value="array"/>
<server name="QUEUE_DRIVER" value="sync"/>
<server name="DB_CONNECTION" value="sqlite"/>
<server name="DB_CONNECTION" value="testing"/>
<server name="DB_DATABASE" value=":memory:"/>
</php>
</phpunit>
9 changes: 2 additions & 7 deletions src/Console/Commands/ReactionTypeAdd.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,12 @@
use Cog\Laravel\Love\ReactionType\Models\ReactionType;
use Illuminate\Console\Command;
use Illuminate\Support\Str;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputOption;

#[AsCommand(name: 'love:reaction-type-add')]
final class ReactionTypeAdd extends Command
{
/**
* The console command name.
*
* @var string
*/
protected static $defaultName = 'love:reaction-type-add';

/**
* The console command description.
*
Expand Down
9 changes: 2 additions & 7 deletions src/Console/Commands/Recount.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,12 @@
use Illuminate\Console\Command;
use Illuminate\Contracts\Bus\Dispatcher as DispatcherInterface;
use Illuminate\Database\Eloquent\Relations\Relation;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputOption;

#[AsCommand(name: 'love:recount')]
final class Recount extends Command
{
/**
* The console command name.
*
* @var string
*/
protected static $defaultName = 'love:recount';

/**
* The console command description.
*
Expand Down
9 changes: 2 additions & 7 deletions src/Console/Commands/RegisterReactants.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,12 @@
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Relations\Relation;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputOption;

#[AsCommand(name: 'love:register-reactants')]
final class RegisterReactants extends Command
{
/**
* The console command name.
*
* @var string
*/
protected static $defaultName = 'love:register-reactants';

/**
* The console command description.
*
Expand Down
9 changes: 2 additions & 7 deletions src/Console/Commands/RegisterReacters.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,12 @@
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Relations\Relation;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputOption;

#[AsCommand(name: 'love:register-reacters')]
final class RegisterReacters extends Command
{
/**
* The console command name.
*
* @var string
*/
protected static $defaultName = 'love:register-reacters';

/**
* The console command description.
*
Expand Down
9 changes: 2 additions & 7 deletions src/Console/Commands/SetupReactable.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,12 @@
use Illuminate\Support\Composer;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputOption;

#[AsCommand(name: 'love:setup-reactable')]
final class SetupReactable extends Command
{
/**
* The console command name.
*
* @var string
*/
protected static $defaultName = 'love:setup-reactable';

/**
* The console command description.
*
Expand Down
9 changes: 2 additions & 7 deletions src/Console/Commands/SetupReacterable.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,12 @@
use Illuminate\Support\Composer;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputOption;

#[AsCommand(name: 'love:setup-reacterable')]
final class SetupReacterable extends Command
{
/**
* The console command name.
*
* @var string
*/
protected static $defaultName = 'love:setup-reacterable';

/**
* The console command description.
*
Expand Down
9 changes: 2 additions & 7 deletions src/Console/Commands/UpgradeV5ToV6.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,11 @@
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'love:upgrade-v5-to-v6')]
final class UpgradeV5ToV6 extends Command
{
/**
* The console command name.
*
* @var string
*/
protected static $defaultName = 'love:upgrade-v5-to-v6';

/**
* The console command description.
*
Expand Down
9 changes: 2 additions & 7 deletions src/Console/Commands/UpgradeV7ToV8.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,11 @@
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'love:upgrade-v7-to-v8')]
final class UpgradeV7ToV8 extends Command
{
/**
* The console command name.
*
* @var string
*/
protected static $defaultName = 'love:upgrade-v7-to-v8';

/**
* The console command description.
*
Expand Down
4 changes: 2 additions & 2 deletions src/Support/Database/Stubs/AddForeignColumn.stub
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

final class DummyClass extends Migration
return new class extends Migration
{
public function up(): void
{
Expand All @@ -36,4 +36,4 @@ final class DummyClass extends Migration
$table->dropColumn('DummyForeignColumn');
});
}
}
};
Loading

0 comments on commit bb19dbd

Please sign in to comment.