Skip to content

Commit

Permalink
chore: add default console command
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp committed Jun 7, 2024
1 parent 62d76b7 commit e00d790
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 2 deletions.
1 change: 1 addition & 0 deletions composer-require-checker.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"symbol-whitelist": [
"Illuminate\\Support\\ServiceProvider",
"Illuminate\\Console\\Command",
"config_path"
]
}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"require": {
"php": "^8.2",
"illuminate/console": "^10.48 || ^11.0",
"illuminate/contracts": "^10.48 || ^11.0",
"illuminate/support": "^10.48 || ^11.0"
},
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.24.0@462c80e31c34e58cc4f750c656be3927e80e550e">
<file src="src/Bridge/Laravel/Console/Commands/PackageCommand.php">
<PossiblyUnusedMethod>
<code><![CDATA[handle]]></code>
</PossiblyUnusedMethod>
</file>
<file src="src/Bridge/Laravel/Providers/PackageServiceProvider.php">
<PossiblyUnusedMethod>
<code><![CDATA[boot]]></code>
Expand All @@ -8,6 +13,11 @@
<code><![CDATA[configurationIsCached]]></code>
</UndefinedInterfaceMethod>
</file>
<file src="tests/src/Functional/Bridge/Laravel/Console/Commands/PackageCommandTest.php">
<PossiblyInvalidMethodCall>
<code><![CDATA[expectsOutput]]></code>
</PossiblyInvalidMethodCall>
</file>
<file src="tests/src/Functional/Bridge/Laravel/Providers/PackageServiceProviderTest.php">
<PossiblyInvalidMethodCall>
<code><![CDATA[assertExitCode]]></code>
Expand All @@ -21,4 +31,26 @@
<code><![CDATA[faker]]></code>
</PossiblyUnusedMethod>
</file>
<file src="vendor/laravel/framework/src/Illuminate/Console/Command.php">
<MixedArgument>
<code><![CDATA[$arguments]]></code>
<code><![CDATA[$options]]></code>
<code><![CDATA[$this->name = $name]]></code>
</MixedArgument>
<MixedArgumentTypeCoercion>
<code><![CDATA[(array) $this->aliases]]></code>
</MixedArgumentTypeCoercion>
<MixedAssignment>
<code><![CDATA[$this->name]]></code>
</MixedAssignment>
<RedundantCast>
<code><![CDATA[(string) $this->help]]></code>
</RedundantCast>
<RedundantCastGivenDocblockType>
<code><![CDATA[(array) $this->aliases]]></code>
</RedundantCastGivenDocblockType>
<UninitializedProperty>
<code><![CDATA[$this->name]]></code>
</UninitializedProperty>
</file>
</files>
21 changes: 21 additions & 0 deletions src/Bridge/Laravel/Console/Commands/PackageCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace WayOfDev\Package\Bridge\Laravel\Console\Commands;

use Illuminate\Console\Command;

class PackageCommand extends Command

Check failure on line 9 in src/Bridge/Laravel/Console/Commands/PackageCommand.php

View workflow job for this annotation

GitHub Actions / psalm (ubuntu-latest, 8.2, locked)

PropertyNotSetInConstructor

src/Bridge/Laravel/Console/Commands/PackageCommand.php:9:7: PropertyNotSetInConstructor: Property WayOfDev\Package\Bridge\Laravel\Console\Commands\PackageCommand::$laravel is not defined in constructor of WayOfDev\Package\Bridge\Laravel\Console\Commands\PackageCommand or in any methods called in the constructor (see https://psalm.dev/074)

Check failure on line 9 in src/Bridge/Laravel/Console/Commands/PackageCommand.php

View workflow job for this annotation

GitHub Actions / psalm (ubuntu-latest, 8.2, locked)

PropertyNotSetInConstructor

src/Bridge/Laravel/Console/Commands/PackageCommand.php:9:7: PropertyNotSetInConstructor: Property WayOfDev\Package\Bridge\Laravel\Console\Commands\PackageCommand::$name is not defined in constructor of WayOfDev\Package\Bridge\Laravel\Console\Commands\PackageCommand or in any methods called in the constructor (see https://psalm.dev/074)

Check failure on line 9 in src/Bridge/Laravel/Console/Commands/PackageCommand.php

View workflow job for this annotation

GitHub Actions / psalm (ubuntu-latest, 8.2, locked)

PropertyNotSetInConstructor

src/Bridge/Laravel/Console/Commands/PackageCommand.php:9:7: PropertyNotSetInConstructor: Property WayOfDev\Package\Bridge\Laravel\Console\Commands\PackageCommand::$components is not defined in constructor of WayOfDev\Package\Bridge\Laravel\Console\Commands\PackageCommand or in any methods called in the constructor (see https://psalm.dev/074)

Check failure on line 9 in src/Bridge/Laravel/Console/Commands/PackageCommand.php

View workflow job for this annotation

GitHub Actions / psalm (ubuntu-latest, 8.2, locked)

PropertyNotSetInConstructor

src/Bridge/Laravel/Console/Commands/PackageCommand.php:9:7: PropertyNotSetInConstructor: Property WayOfDev\Package\Bridge\Laravel\Console\Commands\PackageCommand::$input is not defined in constructor of WayOfDev\Package\Bridge\Laravel\Console\Commands\PackageCommand or in any methods called in the constructor (see https://psalm.dev/074)

Check failure on line 9 in src/Bridge/Laravel/Console/Commands/PackageCommand.php

View workflow job for this annotation

GitHub Actions / psalm (ubuntu-latest, 8.2, locked)

PropertyNotSetInConstructor

src/Bridge/Laravel/Console/Commands/PackageCommand.php:9:7: PropertyNotSetInConstructor: Property WayOfDev\Package\Bridge\Laravel\Console\Commands\PackageCommand::$output is not defined in constructor of WayOfDev\Package\Bridge\Laravel\Console\Commands\PackageCommand or in any methods called in the constructor (see https://psalm.dev/074)
{
protected $signature = 'package:command';

protected $description = 'Package command description';

public function handle(): int
{
$this->info('Package command executed');

return self::SUCCESS;
}
}
5 changes: 4 additions & 1 deletion src/Bridge/Laravel/Providers/PackageServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace WayOfDev\Package\Bridge\Laravel\Providers;

use Illuminate\Support\ServiceProvider;
use WayOfDev\Package\Bridge\Laravel\Console\Commands\PackageCommand;
use WayOfDev\Package\Config;

final class PackageServiceProvider extends ServiceProvider
Expand Down Expand Up @@ -33,6 +34,8 @@ public function register(): void

private function registerConsoleCommands(): void
{
$this->commands([]);
$this->commands([
PackageCommand::class,
]);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace WayOfDev\Tests\Functional\Bridge\Laravel\Console\Commands;

use PHPUnit\Framework\Attributes\Test;
use WayOfDev\Tests\Functional\TestCase;

class PackageCommandTest extends TestCase
{
/**
* @test
*/
#[Test]
public function it_executes_the_package_command_successfully(): void
{
$this->artisan('package:command')
->expectsOutput('Package command executed')
->assertExitCode(0);
}
}

0 comments on commit e00d790

Please sign in to comment.