Skip to content

Replace deprecated string interpolation usage #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/voku/helper/SimpleHtmlDom.php
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ public function firstChild()
*/
public function getElementByClass(string $class): SimpleHtmlDomNodeInterface
{
return $this->findMulti(".${class}");
return $this->findMulti(".{$class}");
}

/**
Expand All @@ -517,7 +517,7 @@ public function getElementByClass(string $class): SimpleHtmlDomNodeInterface
*/
public function getElementById(string $id): SimpleHtmlDomInterface
{
return $this->findOne("#${id}");
return $this->findOne("#{$id}");
}

/**
Expand Down Expand Up @@ -552,7 +552,7 @@ public function getElementByTagName(string $name): SimpleHtmlDomInterface
*/
public function getElementsById(string $id, $idx = null)
{
return $this->find("#${id}", $idx);
return $this->find("#{$id}", $idx);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/voku/helper/SimpleXmlDom.php
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ public function firstChild()
*/
public function getElementByClass(string $class): SimpleXmlDomNodeInterface
{
return $this->findMulti(".${class}");
return $this->findMulti(".{$class}");
}

/**
Expand All @@ -467,7 +467,7 @@ public function getElementByClass(string $class): SimpleXmlDomNodeInterface
*/
public function getElementById(string $id): SimpleXmlDomInterface
{
return $this->findOne("#${id}");
return $this->findOne("#{$id}");
}

/**
Expand Down Expand Up @@ -502,7 +502,7 @@ public function getElementByTagName(string $name): SimpleXmlDomInterface
*/
public function getElementsById(string $id, $idx = null)
{
return $this->find("#${id}", $idx);
return $this->find("#{$id}", $idx);
}

/**
Expand Down
18 changes: 9 additions & 9 deletions src/voku/helper/XmlDomParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ public function fixHtmlOutput(
*/
public function getElementByClass(string $class): SimpleXmlDomNodeInterface
{
return $this->findMulti(".${class}");
return $this->findMulti(".{$class}");
}

/**
Expand All @@ -401,7 +401,7 @@ public function getElementByClass(string $class): SimpleXmlDomNodeInterface
*/
public function getElementById(string $id): SimpleXmlDomInterface
{
return $this->findOne("#${id}");
return $this->findOne("#{$id}");
}

/**
Expand Down Expand Up @@ -432,7 +432,7 @@ public function getElementByTagName(string $name): SimpleXmlDomInterface
*/
public function getElementsById(string $id, $idx = null)
{
return $this->find("#${id}", $idx);
return $this->find("#{$id}", $idx);
}

/**
Expand Down Expand Up @@ -526,7 +526,7 @@ public function loadHtmlFile(string $filePath, $libXMLExtraOptions = null): DomP
&&
!\file_exists($filePath)
) {
throw new \RuntimeException("File ${filePath} not found");
throw new \RuntimeException("File {$filePath} not found");
}

try {
Expand All @@ -536,11 +536,11 @@ public function loadHtmlFile(string $filePath, $libXMLExtraOptions = null): DomP
$html = \file_get_contents($filePath);
}
} catch (\Exception $e) {
throw new \RuntimeException("Could not load file ${filePath}");
throw new \RuntimeException("Could not load file {$filePath}");
}

if ($html === false) {
throw new \RuntimeException("Could not load file ${filePath}");
throw new \RuntimeException("Could not load file {$filePath}");
}

return $this->loadHtml($html, $libXMLExtraOptions);
Expand Down Expand Up @@ -603,7 +603,7 @@ public function loadXmlFile(string $filePath, $libXMLExtraOptions = null): self
&&
!\file_exists($filePath)
) {
throw new \RuntimeException("File ${filePath} not found");
throw new \RuntimeException("File {$filePath} not found");
}

try {
Expand All @@ -613,11 +613,11 @@ public function loadXmlFile(string $filePath, $libXMLExtraOptions = null): self
$xml = \file_get_contents($filePath);
}
} catch (\Exception $e) {
throw new \RuntimeException("Could not load file ${filePath}");
throw new \RuntimeException("Could not load file {$filePath}");
}

if ($xml === false) {
throw new \RuntimeException("Could not load file ${filePath}");
throw new \RuntimeException("Could not load file {$filePath}");
}

return $this->loadXml($xml, $libXMLExtraOptions);
Expand Down
4 changes: 2 additions & 2 deletions tests/HTML5DOMDocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ public function testClassListEntries()
$text = '';
$html = $dom->findOne('html');
foreach ($html->classList->entries() as $class) {
$text .= "[${class}]";
$text .= "[{$class}]";
}
static::assertSame('', $text);

$text = '';
$body = $dom->findOne('body');
foreach ($body->classList->entries() as $class) {
$text .= "[${class}]";
$text .= "[{$class}]";
}
static::assertSame('[a][b][c]', $text);
}
Expand Down