Skip to content
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
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ parameters:
- src/
ignoreErrors:
- '#^PHPDoc tag @throws with type AmpProject\\Exception\\FailedRemoteRequest is not subtype of Throwable$#'
- '#^Parameter \#1 (\$exception_handler|\$callback) of function set_exception_handler expects#'
excludePaths:
Comment on lines 11 to 13
analyse:
- src/FakeEnum.php
Expand Down
1 change: 1 addition & 0 deletions src/Cli/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ public function help()
*/
private function readPHPArgv()
{
/** @var list<string>|null $argv */
global $argv;

if (is_array($argv)) {
Expand Down
4 changes: 1 addition & 3 deletions src/Dom/Document/Filter/DeduplicateTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ public function afterLoad(Document $document)
}

// Avoid doing the above query again if possible.
if (in_array($tagName, [Tag::HEAD, Tag::BODY], true)) {
$document->$tagName = $mainTag;
}
$document->$tagName = $mainTag;
}
}
}
6 changes: 4 additions & 2 deletions src/Dom/Document/Filter/MustacheScriptTemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use AmpProject\Dom\Document\BeforeLoadFilter;
use AmpProject\Dom\Document\BeforeSaveFilter;
use AmpProject\Html\Tag;
use DOMElement;

/**
* Filter to handle the script[template="amp-mustache"].
Expand Down Expand Up @@ -128,8 +129,9 @@ static function ($matches) use ($mustacheTagPlaceholders) {
// unterminated entity reference "baz". When the attribute value is updated via setAttribute() this
// same problem does not occur, so that is why the following is used.

// @phpstan-ignore method.notFound
$attribute->parentNode->setAttribute($attribute->nodeName, $value);
if ($attribute->parentNode instanceof DOMElement) {
$attribute->parentNode->setAttribute($attribute->nodeName, $value);
}

$this->mustacheTagsReplaced = true;
Comment on lines +132 to 136
}
Expand Down
2 changes: 1 addition & 1 deletion src/RemoteRequest/TemporaryFileCachedRemoteGetRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function get($url, $headers = [])

// phpcs:disable PHPCompatibility.FunctionUse.NewFunctionParameters.unserialize_optionsFound
if ($cachedResponse !== false) {
$cachedResponse = unserialize($cachedResponse, [RemoteGetRequestResponse::class]);
$cachedResponse = unserialize($cachedResponse, ['allowed_classes' => [RemoteGetRequestResponse::class]]);
}
// phpcs:enable PHPCompatibility.FunctionUse.NewFunctionParameters.unserialize_optionsFound

Expand Down
Loading