Skip to content

Commit 211adea

Browse files
authored
Merge pull request #1255 from ulue/dev2
Fix code style
2 parents b9a34a0 + b8f1e7a commit 211adea

31 files changed

+120
-93
lines changed

.php_cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,20 @@ return PhpCsFixer\Config::create()
1414
->setRules([
1515
'@PSR2' => true,
1616
'header_comment' => [
17-
'commentType' => 'PHPDoc',
18-
'header' => $header,
19-
'separate' => 'none'
17+
'comment_type' => 'PHPDoc',
18+
'header' => $header,
19+
'separate' => 'bottom'
2020
],
2121
'array_syntax' => [
2222
'syntax' => 'short'
2323
],
24+
'encoding' => true, // MUST use only UTF-8 without BOM
2425
'single_quote' => true,
2526
'class_attributes_separation' => true,
2627
'no_unused_imports' => true,
28+
'global_namespace_import' => true,
2729
'standardize_not_equals' => true,
30+
'declare_strict_types' => true,
2831
])
2932
->setFinder(
3033
PhpCsFixer\Finder::create()

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,19 @@ install:
1313
- |
1414
echo "no" | pecl install -f redis
1515
- |
16-
wget https://github.com/swoole/swoole-src/archive/v4.4.15.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - && rm -rf swoole
16+
wget https://github.com/swoole/swoole-src/archive/v4.4.17.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - && rm -rf swoole
1717
echo "extension = swoole.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
1818
- |
1919
wget -O bin/php-cs-fixer "https://cs.symfony.com/download/php-cs-fixer-v2.phar"
2020
chmod +x bin/php-cs-fixer
2121
2222
before_script:
2323
- phpenv config-rm xdebug.ini
24+
- bin/php-cs-fixer -V
2425
- composer config -g process-timeout 900 && composer update
2526
- composer require --dev phpstan/phpstan
2627

2728
script:
28-
- composer cs-fix
29+
- composer check-cs
2930
- composer test
3031
# - php bin/swoft dinfo:env

app/Annotation/Parser/AlphaDashParser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
namespace App\Annotation\Parser;
1212

13+
use App\Annotation\Mapping\AlphaDash;
1314
use ReflectionException;
1415
use Swoft\Annotation\Annotation\Mapping\AnnotationParser;
1516
use Swoft\Annotation\Annotation\Parser\Parser;
16-
use App\Annotation\Mapping\AlphaDash;
1717
use Swoft\Validator\Exception\ValidatorException;
1818
use Swoft\Validator\ValidatorRegister;
1919

@@ -25,7 +25,7 @@
2525
class AlphaDashParser extends Parser
2626
{
2727
/**
28-
* @param int $type
28+
* @param int $type
2929
* @param object $annotationObject
3030
*
3131
* @return array

app/Aspect/BeanAspect.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
namespace App\Aspect;
1212

13+
use App\Common\MyBean;
1314
use Swoft\Aop\Annotation\Mapping\Aspect;
1415
use Swoft\Aop\Annotation\Mapping\Before;
1516
use Swoft\Aop\Annotation\Mapping\PointBean;
16-
use App\Common\MyBean;
1717
use function vdump;
1818

1919
/**

app/Common/MyBean.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
<?php declare(strict_types=1);
2+
/**
3+
* This file is part of Swoft.
4+
*
5+
* @link https://swoft.org
6+
* @document https://swoft.org/docs
7+
* @contact group@swoft.org
8+
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
9+
*/
210

311
namespace App\Common;
412

app/Exception/ApiException.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/**
33
* This file is part of Swoft.
44
*
@@ -7,13 +7,16 @@
77
* @contact group@swoft.org
88
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
99
*/
10+
1011
namespace App\Exception;
1112

13+
use Exception;
14+
1215
/**
1316
* Class ApiException
1417
*
1518
* @since 2.0
1619
*/
17-
class ApiException extends \Exception
20+
class ApiException extends Exception
1821
{
1922
}

app/Helper/Functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/**
33
* This file is part of Swoft.
44
*

app/Http/Controller/HomeController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Swoft\Http\Server\Annotation\Mapping\RequestMapping;
1919
use Swoft\View\Renderer;
2020
use Throwable;
21+
use function bean;
2122
use function context;
2223

2324
/**
@@ -79,6 +80,6 @@ public function wsTest(): Response
7980
*/
8081
public function dataConfig(): array
8182
{
82-
return \bean(GoodsData::class)->getConfig();
83+
return bean(GoodsData::class)->getConfig();
8384
}
8485
}

app/Http/Controller/SessionController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function get(): array
8989
public function del(): array
9090
{
9191
$sess = HttpSession::current();
92-
$ok = $sess->delete('testKey');
92+
$ok = $sess->delete('testKey');
9393

9494
return ['delete' => $ok];
9595
}

app/Http/Controller/TimerController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212

1313
use App\Model\Entity\User;
1414
use Exception;
15-
use function random_int;
1615
use Swoft\Http\Server\Annotation\Mapping\Controller;
1716
use Swoft\Http\Server\Annotation\Mapping\RequestMapping;
1817
use Swoft\Log\Helper\Log;
1918
use Swoft\Redis\Redis;
2019
use Swoft\Stdlib\Helper\JsonHelper;
2120
use Swoft\Timer;
21+
use function random_int;
2222

2323
/**
2424
* Class TimerController

0 commit comments

Comments
 (0)