Skip to content

Commit ba23531

Browse files
committed
cs fix
1 parent f777d06 commit ba23531

File tree

2 files changed

+58
-8
lines changed

2 files changed

+58
-8
lines changed

.php_cs

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
$header = <<<EOF
4+
This file is part of the light/package.
5+
6+
(c) lichunqiang <[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+
EOF;
11+
12+
Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader($header);
13+
14+
return Symfony\CS\Config\Config::create()
15+
// use default SYMFONY_LEVEL and extra fixers:
16+
->fixers(array(
17+
'@PSR2',
18+
'header_comment',
19+
'short_array_syntax',
20+
'ordered_use',
21+
'php_unit_construct',
22+
'php_unit_strict',
23+
'phpdoc_order',
24+
// 'strict_param',
25+
'align_double_arrow' => false,
26+
'align_equals' => false,
27+
'concat_with_spaces',
28+
// 'concat_without_spaces' => false,
29+
'phpdoc_no_package' => false,
30+
'empty_return' => false,
31+
))
32+
->finder(
33+
Symfony\CS\Finder\DefaultFinder::create()
34+
->in(__DIR__ . '/src')
35+
)
36+
;

src/XmlParser.php

+22-8
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,46 @@
1-
<?php namespace light\yii2;
1+
<?php
2+
3+
/*
4+
* This file is part of the light/package.
5+
*
6+
* (c) lichunqiang <[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+
12+
namespace light\yii2;
213

314
use yii\base\Object;
415
use yii\web\BadRequestHttpException;
516
use yii\web\RequestParserInterface;
617

718
/**
8-
* The request parser for xml
19+
* The request parser for xml.
920
*
10-
* @package light\yii2
1121
* @author lichunqiang <[email protected]>
1222
* @license MIT
23+
*
1324
* @version 0.2.11
1425
*/
1526
class XmlParser extends Object implements RequestParserInterface
1627
{
1728
/**
1829
* If parser result as array, this is default,
1930
* if you want to get object, set it to false.
20-
* @var boolean
31+
*
32+
* @var bool
2133
*/
2234
public $asArray = true;
2335
/**
2436
* Whether throw the [[BadRequestHttpException]] if the process error.
25-
* @var boolean
37+
*
38+
* @var bool
2639
*/
2740
public $throwException = true;
2841

2942
/**
30-
* @inheritdoc
43+
* {@inheritdoc}
3144
*/
3245
public function parse($rawBody, $contentType)
3346
{
@@ -38,16 +51,17 @@ public function parse($rawBody, $contentType)
3851
if ($result === false) {
3952
$errors = libxml_get_errors();
4053
$latestError = array_pop($errors);
41-
$error = array(
54+
$error = [
4255
'message' => $latestError->message,
4356
'type' => $latestError->level,
4457
'code' => $latestError->code,
4558
'file' => $latestError->file,
4659
'line' => $latestError->line,
47-
);
60+
];
4861
if ($this->throwException) {
4962
throw new BadRequestHttpException($latestError->message);
5063
}
64+
5165
return $error;
5266
}
5367

0 commit comments

Comments
 (0)