Skip to content

Commit 0899433

Browse files
committed
Apply php-cs-fixer.
1 parent 97b13a4 commit 0899433

File tree

10 files changed

+32
-22
lines changed

10 files changed

+32
-22
lines changed

src/PHPHtmlParser/Content.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ public function char(?int $char = null): string
7575
/**
7676
* Gets a string from the current character position.
7777
*
78-
* @param int $length
79-
* @return string
8078
*/
8179
public function string(int $length = 1): string
8280
{
@@ -85,6 +83,7 @@ public function string(int $length = 1): string
8583
do {
8684
$string .= $this->char($position++);
8785
} while ($position < $this->pos + $length);
86+
8887
return $string;
8988
}
9089

src/PHPHtmlParser/Dom.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
namespace PHPHtmlParser;
66

7-
use GuzzleHttp\Psr7\Request;
87
use GuzzleHttp\Client;
8+
use GuzzleHttp\Psr7\Request;
99
use PHPHtmlParser\Contracts\Dom\CleanerInterface;
1010
use PHPHtmlParser\Contracts\Dom\ParserInterface;
1111
use PHPHtmlParser\Contracts\DomInterface;

src/PHPHtmlParser/Dom/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ private function parseTag(Options $options, Content $content, int $size): TagDTO
183183
->setOpening('<?')
184184
->setClosing(' ?>')
185185
->selfClosing();
186-
} elseif($content->string(3) == '!--') {
186+
} elseif ($content->string(3) == '!--') {
187187
// comment tag
188188
$tag = $content->fastForward(3)
189189
->copyByToken(StringToken::CLOSECOMMENT(), false);

src/PHPHtmlParser/Dom/Tag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public function makeOpeningTag()
330330
// attribute that was in the array not found in the array... let's continue.
331331
continue;
332332
} catch (\TypeError $e) {
333-
$val = null;
333+
$val = null;
334334
}
335335
$val = $attributeDTO->getValue();
336336
if (\is_null($val)) {

src/PHPHtmlParser/Selector/Seeker.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,15 @@ private function match(
298298
case '!=':
299299
return $value !== $pattern;
300300
case '^=':
301-
return \preg_match('/^' . \preg_quote($pattern, '/') . '/',
302-
$value) == 1;
301+
return \preg_match(
302+
'/^' . \preg_quote($pattern, '/') . '/',
303+
$value
304+
) == 1;
303305
case '$=':
304-
return \preg_match('/' . \preg_quote($pattern, '/') . '$/',
305-
$value) == 1;
306+
return \preg_match(
307+
'/' . \preg_quote($pattern, '/') . '$/',
308+
$value
309+
) == 1;
306310
case '*=':
307311
if ($pattern[0] == '/') {
308312
return \preg_match($pattern, $value) == 1;

src/PHPHtmlParser/StaticDom.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
namespace PHPHtmlParser;
66

7-
use GuzzleHttp\Psr7\Request;
87
use GuzzleHttp\Client;
8+
use GuzzleHttp\Psr7\Request;
99
use PHPHtmlParser\Exceptions\ChildNotFoundException;
1010
use PHPHtmlParser\Exceptions\CircularException;
1111
use PHPHtmlParser\Exceptions\NotLoadedException;

tests/Dom/CommentTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
class CommentTest extends TestCase
1010
{
1111
/**
12-
* Data provider for testComment
12+
* Data provider for testComment.
1313
*
14-
* @return array
1514
*/
1615
public function getTestCommentData(): array
1716
{
@@ -23,9 +22,11 @@ public function getTestCommentData(): array
2322
}
2423

2524
/**
26-
* Test comment handling
25+
* Test comment handling.
2726
*
2827
* @dataProvider getTestCommentData
28+
*
29+
* @param mixed $comment
2930
*/
3031
public function testComment($comment): void
3132
{

tests/DomTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,10 @@ public function testLoadFileBigTwice(): void
138138
public function testLoadFileBigTwicePreserveOption(): void
139139
{
140140
$dom = new Dom();
141-
$dom->loadFromFile('tests/data/files/big.html',
142-
(new Options())->setPreserveLineBreaks(true));
141+
$dom->loadFromFile(
142+
'tests/data/files/big.html',
143+
(new Options())->setPreserveLineBreaks(true)
144+
);
143145
$post = $dom->find('.post-row', 0);
144146
$this->assertEquals(
145147
"<p>Журчанье воды<br />\nЧерно-белые тени<br />\nВновь на фонтане</p>",
@@ -444,12 +446,13 @@ public function testFindAttributeInBothParentAndChild(): void
444446

445447
public function testLessThanCharacterInJavascript(): void
446448
{
447-
$results = (new Dom())->loadStr('<html><head><script type="text/javascript">
449+
$results = (new Dom())->loadStr(
450+
'<html><head><script type="text/javascript">
448451
console.log(1 < 3);
449452
</script></head><body><div id="panel"></div></body></html>',
450453
(new Options())->setCleanupInput(false)
451454
->setRemoveScripts(false)
452-
)->find('body');
455+
)->find('body');
453456
$this->assertCount(1, $results);
454457
}
455458

tests/Node/TextTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use PHPHtmlParser\Dom;
66
use PHPHtmlParser\Dom\Node\TextNode;
7-
use PHPHtmlParser\Options;
87
use PHPUnit\Framework\TestCase;
98
use stringEncode\Encode;
109

tests/Options/CleanupTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ public function testRemoveStylesFalse(): void
4040
$dom->setOptions((new Options())->setRemoveStyles(false));
4141
$dom->loadFromFile('tests/data/files/big.html');
4242
$this->assertEquals(1, \count($dom->find('style')));
43-
$this->assertEquals('text/css',
44-
$dom->find('style')->getAttribute('type'));
43+
$this->assertEquals(
44+
'text/css',
45+
$dom->find('style')->getAttribute('type')
46+
);
4547
}
4648

4749
public function testRemoveScriptsTrue(): void
@@ -58,8 +60,10 @@ public function testRemoveScriptsFalse(): void
5860
$dom->setOptions((new Options())->setRemoveScripts(false));
5961
$dom->loadFromFile('tests/data/files/big.html');
6062
$this->assertEquals(22, \count($dom->find('script')));
61-
$this->assertEquals('text/javascript',
62-
$dom->find('script')->getAttribute('type'));
63+
$this->assertEquals(
64+
'text/javascript',
65+
$dom->find('script')->getAttribute('type')
66+
);
6367
}
6468

6569
public function testSmartyScripts(): void

0 commit comments

Comments
 (0)