Skip to content

Commit 2d7ad12

Browse files
committed
Apply fixes from StyleCI
1 parent f95081c commit 2d7ad12

19 files changed

+146
-21
lines changed

src/Exceptions/InvalidEnumValueException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class InvalidEnumValueException extends Exception
1919
/**
2020
* Create an InvalidEnumValueException.
2121
*
22-
* @param $invalidValue
22+
* @param $invalidValue
2323
* @param Enum|string $enumClass
2424
*/
2525
public function __construct($invalidValue, $enumClass)

src/Exceptions/InvalidMethodException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class InvalidMethodException extends Exception
1919
/**
2020
* Create an InvalidMethodException.
2121
*
22-
* @param $invalidMethod
22+
* @param $invalidMethod
2323
* @param Enum|string $enumClass
2424
*/
2525
public function __construct($invalidMethod, $enumClass)

src/Repositories/Enums/CacheEnum.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static function parseEnumKey(string $cacheKey): string
4444
/**
4545
* Get cache key.
4646
*
47-
* @param $value
47+
* @param $value
4848
* @param string|int|null $identifier
4949
* @return string
5050
*/
@@ -58,7 +58,7 @@ public static function getCacheKey($value, $identifier = null): string
5858
/**
5959
* Get cache expire time.
6060
*
61-
* @param $value
61+
* @param $value
6262
* @param null $options
6363
* @return mixed
6464
*

tests/EnumComparisonTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
<?php
22

3+
/*
4+
* This file is part of the Jiannei/laravel-enum.
5+
*
6+
* (c) Jiannei <[email protected]>
7+
*
8+
* This source file is subject to the MIT license that is bundled
9+
* with this source code in the file LICENSE.
10+
*/
11+
312
uses(\Jiannei\Enum\Laravel\Tests\TestCase::class);
413
use Jiannei\Enum\Laravel\Tests\Enums\StringValuesEnum;
514
use Jiannei\Enum\Laravel\Tests\Enums\UserTypeEnum;
615

7-
816
test('comparison against plain value matching', function () {
917
// 使用常量实例的 is 方法,比较某个值与当前常量实例的值是否相同
1018
$admin = UserTypeEnum::fromValue(UserTypeEnum::ADMINISTRATOR);

tests/EnumInstanceTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
<?php
22

3+
/*
4+
* This file is part of the Jiannei/laravel-enum.
5+
*
6+
* (c) Jiannei <[email protected]>
7+
*
8+
* This source file is subject to the MIT license that is bundled
9+
* with this source code in the file LICENSE.
10+
*/
11+
312
uses(\Jiannei\Enum\Laravel\Tests\TestCase::class);
413
use Jiannei\Enum\Laravel\Exceptions\InvalidEnumKeyException;
514
use Jiannei\Enum\Laravel\Exceptions\InvalidEnumValueException;
615
use Jiannei\Enum\Laravel\Tests\Enums\UserTypeEnum;
716

8-
917
test('can instantiate enum class with new', function () {
1018
// 使用 new 方式实例化常量
1119
$userType = new UserTypeEnum(UserTypeEnum::ADMINISTRATOR);

tests/EnumLocalizationTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
<?php
22

3+
/*
4+
* This file is part of the Jiannei/laravel-enum.
5+
*
6+
* (c) Jiannei <[email protected]>
7+
*
8+
* This source file is subject to the MIT license that is bundled
9+
* with this source code in the file LICENSE.
10+
*/
11+
312
uses(\Jiannei\Enum\Laravel\Tests\TestCase::class);
413
use Jiannei\Enum\Laravel\Tests\Enums\ExampleEnum;
514

6-
715
test('enum get description with localization', function () {
816
// 常量描述本地化:存在相应语言包的时候取语言包中对应的描述
917
$this->app->setLocale('en');

tests/EnumMiddlewareTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
<?php
22

3+
/*
4+
* This file is part of the Jiannei/laravel-enum.
5+
*
6+
* (c) Jiannei <[email protected]>
7+
*
8+
* This source file is subject to the MIT license that is bundled
9+
* with this source code in the file LICENSE.
10+
*/
11+
312
uses(\Jiannei\Enum\Laravel\Tests\TestCase::class);
413
use Illuminate\Http\Request;
514
use Illuminate\Support\Facades\Config;
615
use Jiannei\Enum\Laravel\Http\Middleware\TransformEnums;
716
use Jiannei\Enum\Laravel\Tests\Enums\UserTypeEnum;
817

9-
1018
beforeEach(function () {
1119
Config::set('enum', [
1220
'localization' => ['key' => 'enums'], 'transformations' => ['user_type' => UserTypeEnum::class],

tests/EnumNativeCastTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Jiannei/laravel-enum.
5+
*
6+
* (c) Jiannei <[email protected]>
7+
*
8+
* This source file is subject to the MIT license that is bundled
9+
* with this source code in the file LICENSE.
10+
*/
11+
312
uses(\Jiannei\Enum\Laravel\Tests\TestCase::class);
413
use Jiannei\Enum\Laravel\Exceptions\InvalidEnumValueException;
514
use Jiannei\Enum\Laravel\Tests\Enums\UserTypeCustomCastEnum;

tests/EnumRandomTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
<?php
22

3+
/*
4+
* This file is part of the Jiannei/laravel-enum.
5+
*
6+
* (c) Jiannei <[email protected]>
7+
*
8+
* This source file is subject to the MIT license that is bundled
9+
* with this source code in the file LICENSE.
10+
*/
11+
312
uses(\Jiannei\Enum\Laravel\Tests\TestCase::class);
413
use Jiannei\Enum\Laravel\Tests\Enums\SingleValueEnum;
514

6-
715
test('get random instance', function () {
816
// 获取随机的实例
917
$instance = SingleValueEnum::getRandomInstance();

tests/EnumRequestTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
<?php
22

3+
/*
4+
* This file is part of the Jiannei/laravel-enum.
5+
*
6+
* (c) Jiannei <[email protected]>
7+
*
8+
* This source file is subject to the MIT license that is bundled
9+
* with this source code in the file LICENSE.
10+
*/
11+
312
uses(\Jiannei\Enum\Laravel\Tests\TestCase::class);
413
use Illuminate\Http\Request;
514
use Illuminate\Support\Facades\Config;
615
use Jiannei\Enum\Laravel\Tests\Enums\UserTypeEnum;
716

8-
917
beforeEach(function () {
1018
Config::set('enum', [
1119
'localization' => ['key' => 'enums1'], 'transformations' => ['user_type' => UserTypeEnum::class],

0 commit comments

Comments
 (0)