Skip to content

Commit

Permalink
php-cs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
kassner committed Jun 13, 2021
1 parent 07fe51d commit 51da12b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
22 changes: 22 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

if (!file_exists(__DIR__.'/src')) {
exit(0);
}

return (new PhpCsFixer\Config())
->setRules([
'@PHP71Migration' => true,
'@PHPUnit75Migration:risky' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'protected_to_private' => false,
])
->setRiskyAllowed(true)
->setFinder(
(new PhpCsFixer\Finder())
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
->append([__FILE__])
)
;
11 changes: 6 additions & 5 deletions tests/Format/PortNumbersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public function testRemotePortInvalid($line)
$this->expectException(\Kassner\LogParser\FormatException::class);
$this->parser->parse($line);
}

/**
* @dataProvider successProvider
*/
Expand Down Expand Up @@ -118,9 +119,9 @@ public function testCanonicalPortInvalid($line)
*/
public function testPortFormatSuccess($portType)
{
$format = '%t "%r" %{' . $portType . '}p';
$format = '%t "%r" %{'.$portType.'}p';
$this->parser->setFormat($format);
$entry= $this->parser->parse('[10/Sep/2013:15:50:06 +0000] "GET /electronics/cameras/accessories/universal-camera-charger HTTP/1.1" 8080');
$entry = $this->parser->parse('[10/Sep/2013:15:50:06 +0000] "GET /electronics/cameras/accessories/universal-camera-charger HTTP/1.1" 8080');

$propertyName = sprintf('%sPort', $portType);
$this->assertObjectHasAttribute($propertyName, $entry);
Expand All @@ -132,7 +133,7 @@ public function testPortFormatSuccess($portType)
*/
public function testPortFormatInvalid($portType)
{
$format = '%t "%r" %{' . $portType . '}p';
$format = '%t "%r" %{'.$portType.'}p';
$this->parser->setFormat($format);
$this->expectException(\Kassner\LogParser\FormatException::class);
$this->parser->parse('[10/Sep/2013:15:50:06 +0000] "GET /electronics/cameras/accessories/universal-camera-charger HTTP/1.1" 8080');
Expand All @@ -143,7 +144,7 @@ public function successProvider()
return [
['443'],
['80'],
['123423']
['123423'],
];
}

Expand All @@ -153,7 +154,7 @@ public function invalidProvider()
[''],
['Nan'],
['+Inf'],
['1.6e-19']
['1.6e-19'],
];
}

Expand Down

0 comments on commit 51da12b

Please sign in to comment.