Skip to content

Commit f1fbfd4

Browse files
Fix compatible Laravel 7.x
1 parent 27ccbdc commit f1fbfd4

3 files changed

Lines changed: 14 additions & 21 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Add to section `providers` of `config/app.php`:
2626
];
2727
```
2828

29-
Publish configuration:
29+
Publish the configuration:
3030

3131
```bash
3232
php artisan vendor:publish --provider="Botble\GitCommitChecker\Providers\GitCommitCheckerServiceProvider" --tag=config
@@ -37,13 +37,13 @@ php artisan vendor:publish --provider="Botble\GitCommitChecker\Providers\GitComm
3737
php artisan git:install-hooks
3838
```
3939

40-
- Create default PSR config (It will be create phpcs.xml in your root project.).
40+
- Create default PSR config (It will create phpcs.xml in your root project).
4141

4242
```bash
4343
php artisan git:create-phpcs
4444
```
4545

46-
- Run test manually (made sure that you've added all changed files to git stage)
46+
- Run test manually (made sure you've added all changed files to git stage)
4747

4848
```bash
4949
php artisan git:pre-commit

src/Commands/InstallHooks.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class InstallHooks extends Command
3434
public function handle()
3535
{
3636
if (!app()->isLocal()) {
37-
return false;
37+
return 1;
3838
}
3939

4040
foreach (config('git-commit-checker.hooks') as $hook => $command) {
@@ -43,7 +43,7 @@ public function handle()
4343
: $this->error('Unable to install ' . $hook . ' hook');
4444
}
4545

46-
return true;
46+
return 0;
4747
}
4848

4949
/**
Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
class InstallPhpcs extends Command
99
{
1010
use ConfirmableTrait;
11+
1112
/**
1213
* The name and signature of the console command.
1314
*
@@ -22,46 +23,38 @@ class InstallPhpcs extends Command
2223
*/
2324
protected $description = 'Create default phpcs.xml';
2425

25-
/**
26-
* Create a new command instance.
27-
*
28-
* @return void
29-
*/
30-
public function __construct()
31-
{
32-
parent::__construct();
33-
}
34-
3526
/**
3627
* Execute the console command.
3728
*
3829
* @return mixed
3930
*/
4031
public function handle()
4132
{
42-
$phpcs = base_path('vendor/botble/git-commit-checker/phpcs.xml');
33+
$phpcs = __DIR__ . '/../../phpcs.xml';
4334
$rootphpcs = base_path('phpcs.xml');
4435

4536
// Checkout existence of sample phpcs.xml.
4637
if (!file_exists($phpcs)) {
4738
$this->error('The sample phpcs.xml does not exist! Try to reinstall botble/git-commit-checker package!');
4839

49-
return false;
40+
return 1;
5041
}
5142

5243
// Checkout existence phpcs.xml in root path of project.
5344
if (file_exists($rootphpcs)) {
5445
if (!$this->confirmToProceed('phpcs.xml already exists, do you want to overwrite it?', true)) {
55-
return false;
46+
return 1;
5647
}
5748

58-
//remove old phpcs.xml file form root
49+
// Remove old phpcs.xml file form root
5950
unlink($rootphpcs);
6051
}
6152

6253
$this->writePHPCS($phpcs, $rootphpcs)
6354
? $this->info('Phpcs.xml successfully created!')
6455
: $this->error('Unable to create phpcs.xml');
56+
57+
return 0;
6558
}
6659

6760
/**
@@ -76,8 +69,8 @@ protected function writePHPCS(string $phpcs, string $rootphpcs): bool
7669
// phpcs.xml file to root
7770
if (!copy($phpcs, $rootphpcs)) {
7871
return false;
79-
} else {
80-
return true;
8172
}
73+
74+
return true;
8275
}
8376
}

0 commit comments

Comments
 (0)