Skip to content

Commit f03dfba

Browse files
committed
Applied new CS rules
1 parent b29d677 commit f03dfba

File tree

4 files changed

+59
-45
lines changed

4 files changed

+59
-45
lines changed

.travis.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,20 @@ matrix:
1212
env:
1313
- qaExtended=true
1414
- dropPlatform=false
15+
- php: 7.3
16+
env:
17+
- dropPlatform=false
1518
- php: nightly
1619
env:
1720
- dropPlatform=false
1821
- php: 7.2
1922
env:
2023
- dependencies=lowest
2124
- dropPlatform=false
25+
- php: 7.3
26+
env:
27+
- dependencies=lowest
28+
- dropPlatform=false
2229
- php: nightly
2330
env:
2431
- dependencies=lowest
@@ -27,6 +34,10 @@ matrix:
2734
env:
2835
- dependencies=highest
2936
- dropPlatform=false
37+
- php: 7.3
38+
env:
39+
- dependencies=highest
40+
- dropPlatform=false
3041
- php: nightly
3142
env:
3243
- dependencies=highest
@@ -48,4 +59,4 @@ script:
4859
- if [ "$qaExtended" = "true" ]; then make ci-extended; fi;
4960

5061
## Gather coverage and set it to coverage servers
51-
after_script: if [ "$qaExtended" = "true" ]; then make ci-coverage; fi;
62+
after_script: if [ "$qaExtended" = "true" ]; then make ci-coverage; fi;

appveyor.yml

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,45 @@ clone_folder: c:\projects\php-project-workspace
66
## Build matrix for lowest and highest possible targets
77
environment:
88
matrix:
9-
- dependencies: lowest
10-
php_ver_target: 7.2
11-
- dependencies: current
12-
php_ver_target: 7.2
13-
- dependencies: highest
14-
php_ver_target: 7.2
9+
- dependencies: lowest
10+
php_ver_target: 7.2
11+
- dependencies: current
12+
php_ver_target: 7.2
13+
- dependencies: highest
14+
php_ver_target: 7.2
1515

1616
## Cache composer file
1717
cache:
18-
- '%LOCALAPPDATA%\Composer\files -> composer.lock'
18+
- '%LOCALAPPDATA%\Composer\files -> composer.lock'
1919

2020
## Set up environment varriables
2121
init:
22-
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;%PATH%
23-
- SET COMPOSER_NO_INTERACTION=1
24-
- SET PHP=1
25-
- SET ANSICON=121x90 (121x90)
22+
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;%PATH%
23+
- SET COMPOSER_NO_INTERACTION=1
24+
- SET PHP=1
25+
- SET ANSICON=121x90 (121x90)
2626

2727
## Install PHP and composer, and run the appropriate composer command
2828
install:
29-
- IF EXIST c:\tools\php (SET PHP=0)
30-
- ps: appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php_ver_target | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
31-
- cd c:\tools\php
32-
- IF %PHP%==1 copy php.ini-production php.ini /Y
33-
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini
34-
- IF %PHP%==1 echo extension_dir=ext >> php.ini
35-
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini
36-
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini
37-
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini
38-
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
39-
- appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar
40-
- cd c:\projects\php-project-workspace
41-
- composer config --unset platform.php
42-
- IF %dependencies%==lowest appveyor-retry composer update --prefer-lowest --no-progress --profile -n
43-
- IF %dependencies%==current appveyor-retry composer install --no-progress --profile
44-
- IF %dependencies%==highest appveyor-retry composer update --no-progress --profile -n
45-
#- composer show
29+
- IF EXIST c:\tools\php (SET PHP=0)
30+
- ps: appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php_ver_target | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
31+
- cd c:\tools\php
32+
- IF %PHP%==1 copy php.ini-production php.ini /Y
33+
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini
34+
- IF %PHP%==1 echo extension_dir=ext >> php.ini
35+
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini
36+
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini
37+
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini
38+
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
39+
- appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar
40+
- cd c:\projects\php-project-workspace
41+
- composer config --unset platform.php
42+
- IF %dependencies%==lowest appveyor-retry composer update --prefer-lowest --no-progress --profile -n
43+
- IF %dependencies%==current appveyor-retry composer install --no-progress --profile
44+
- IF %dependencies%==highest appveyor-retry composer update --no-progress --profile -n
45+
#- composer show
4646

4747
## Run the actual test
4848
test_script:
49-
- cd c:\projects\php-project-workspace
50-
- vendor/bin/phpunit -c phpunit.xml.dist
49+
- cd c:\projects\php-project-workspace
50+
- vendor/bin/phpunit -c phpunit.xml.dist

src/LoggerMiddleware.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function error(
130130
}
131131

132132
$response = null;
133-
if (method_exists($throwable, 'getResponse')) {
133+
if (\method_exists($throwable, 'getResponse')) {
134134
$response = $throwable->getResponse();
135135
}
136136
if ($response instanceof ResponseInterface) {
@@ -143,7 +143,7 @@ public function error(
143143
$context[self::ERROR]['line'] = $throwable->getLine();
144144
$context[self::ERROR]['trace'] = $throwable->getTraceAsString();
145145

146-
if (method_exists($throwable, 'getContext')) {
146+
if (\method_exists($throwable, 'getContext')) {
147147
$context[self::ERROR]['context'] = $throwable->getContext();
148148
}
149149

@@ -163,7 +163,7 @@ protected function iterateHeaders(
163163
array $ignoreHeaders
164164
): array {
165165
foreach ($headers as $header => $value) {
166-
if (in_array($header, $ignoreHeaders, true)) {
166+
if (\in_array($header, $ignoreHeaders, true)) {
167167
continue;
168168
}
169169

@@ -194,22 +194,22 @@ private function addResponseToContext(
194194

195195
private function stripQueryItems(UriInterface $uri, array $options): UriInterface
196196
{
197-
parse_str($uri->getQuery(), $query);
197+
\parse_str($uri->getQuery(), $query);
198198
foreach ($options[self::class][Options::IGNORE_URI_QUERY_ITEMS] ?? [] as $item) {
199199
unset($query[$item], $query[$item . '[]']);
200200
}
201201

202-
return $uri->withQuery(http_build_query($query));
202+
return $uri->withQuery(\http_build_query($query));
203203
}
204204

205205
private function renderTemplate(string $template, array $context): string
206206
{
207207
$keyValues = [];
208-
preg_match_all("|\{\{(.*)\}\}|U", $template, $out, PREG_PATTERN_ORDER);
209-
foreach (array_unique(array_values($out[1])) as $placeHolder) {
208+
\preg_match_all("|\{\{(.*)\}\}|U", $template, $out, PREG_PATTERN_ORDER);
209+
foreach (\array_unique(\array_values($out[1])) as $placeHolder) {
210210
$keyValues['{{' . $placeHolder . '}}'] = getIn($context, $placeHolder, '');
211211
}
212-
$template = str_replace(array_keys($keyValues), array_values($keyValues), $template);
212+
$template = \str_replace(\array_keys($keyValues), \array_values($keyValues), $template);
213213

214214
return $template;
215215
}

tests/LoggerMiddlewareTest.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@
1212
use Psr\Log\LoggerInterface;
1313
use Psr\Log\LogLevel;
1414

15+
/**
16+
* @internal
17+
*/
1518
class LoggerMiddlewareTest extends TestCase
1619
{
17-
public function testNoConfig()
20+
public function testNoConfig(): void
1821
{
1922
$options = [];
2023
$request = new Request(
@@ -44,7 +47,7 @@ public function testNoConfig()
4447
$middleware->error($exception, 'abc', $options);
4548
}
4649

47-
public function testLog()
50+
public function testLog(): void
4851
{
4952
$options = [
5053
LoggerMiddleware::class => [
@@ -123,7 +126,7 @@ public function testLog()
123126
$middleware->post($response, 'abc', $options);
124127
}
125128

126-
public function testLogWithCustomMessage()
129+
public function testLogWithCustomMessage(): void
127130
{
128131
$options = [
129132
LoggerMiddleware::class => [
@@ -204,7 +207,7 @@ public function testLogWithCustomMessage()
204207
$middleware->post($response, 'abc', $options);
205208
}
206209

207-
public function testLogError()
210+
public function testLogError(): void
208211
{
209212
$options = [
210213
LoggerMiddleware::class => [
@@ -275,7 +278,7 @@ public function getResponse()
275278
$middleware->error($exception, 'abc', $options);
276279
}
277280

278-
public function testLogErrorNoResponse()
281+
public function testLogErrorNoResponse(): void
279282
{
280283
$options = [
281284
LoggerMiddleware::class => [
@@ -327,7 +330,7 @@ public function testLogErrorNoResponse()
327330
$middleware->error($exception, 'abc', $options);
328331
}
329332

330-
public function testLogErrorNoResponseCustomMessagee()
333+
public function testLogErrorNoResponseCustomMessagee(): void
331334
{
332335
$options = [
333336
LoggerMiddleware::class => [

0 commit comments

Comments
 (0)