Skip to content

Fix newly reported PHPStan errors#576

Merged
swissspidy merged 1 commit into
mainfrom
chore/maintenance-fixes
Jul 16, 2026
Merged

Fix newly reported PHPStan errors#576
swissspidy merged 1 commit into
mainfrom
chore/maintenance-fixes

Conversation

@swissspidy

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings July 16, 2026 11:28
@swissspidy swissspidy added the Testing Issues related with Unit, E2E, Smoke, and other testing requirements/needs label Jul 16, 2026
@swissspidy swissspidy added this to the 0.11.8 milestone Jul 16, 2026
@swissspidy
swissspidy merged commit 9c83ed0 into main Jul 16, 2026
15 checks passed
@swissspidy
swissspidy deleted the chore/maintenance-fixes branch July 16, 2026 11:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets newly reported PHPStan issues across the codebase by tightening type expectations and removing/adjusting problematic patterns to satisfy static analysis.

Changes:

  • Fix unserialize() options usage to correctly restrict allowed classes when reading cached responses.
  • Add runtime/type guards in DOM processing code to satisfy PHPStan and avoid calling element-only APIs on non-elements.
  • Clean up PHPStan configuration and add local type annotations (e.g., for $argv) to reduce analysis noise.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/RemoteRequest/TemporaryFileCachedRemoteGetRequest.php Updates unserialize() to use the correct allowed_classes option format.
src/Dom/Document/Filter/MustacheScriptTemplates.php Adds a DOMElement type guard before calling setAttribute() on an attribute’s parent node.
src/Dom/Document/Filter/DeduplicateTag.php Removes a redundant conditional around caching the main head/body tag reference.
src/Cli/Options.php Adds a PHPStan-friendly local type annotation for global $argv.
phpstan.neon.dist Removes an ignore rule related to set_exception_handler() type expectations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +132 to 136
if ($attribute->parentNode instanceof DOMElement) {
$attribute->parentNode->setAttribute($attribute->nodeName, $value);
}

$this->mustacheTagsReplaced = true;
Comment thread phpstan.neon.dist
Comment on lines 11 to 13
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:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Testing Issues related with Unit, E2E, Smoke, and other testing requirements/needs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants