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
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
],
"require": {
"php": ">=7.4.0",
"symfony/polyfill-mbstring": "^1.31.0"
"symfony/polyfill-mbstring": "^1.33.0"
},
"require-dev": {
"phpunit/phpunit": "^9.6|^11.2.2"
"phpunit/phpunit": "^9.6|^11.5",
"roave/security-advisories": "dev-latest",
"phpstan/phpstan": "^2.1",
"squizlabs/php_codesniffer": "^3.13"
},
"autoload": {
"psr-4": {
Expand Down
11 changes: 11 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
includes:
# - ../../phpstan.neon
parameters:
level: max
paths:
- .
fileExtensions:
- php
- phtml
excludePaths:
- tests/*
2 changes: 1 addition & 1 deletion src/PublicSuffixList.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function getTree(): array
private function readPSL()
{
$parts = \parse_url($this->url);
Copy link

Copilot AI Sep 10, 2025

Choose a reason for hiding this comment

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

The fix assumes parse_url() always returns an array or false, but it can also return null for severely malformed URLs. Consider using \is_array($parts) check or handle the null case explicitly to prevent potential type errors.

Suggested change
$parts = \parse_url($this->url);
$parts = \parse_url($this->url);
// parse_url() can return null or false for malformed URLs; \is_array($parts) ensures safe access

Copilot uses AI. Check for mistakes.
$remote = isset($parts['scheme']) || isset($parts['host']);
$remote = \is_array($parts) && !empty($parts) && (isset($parts['scheme']) || isset($parts['host']));
// try to read with file_get_contents
$newPSL = \file_get_contents(($remote ? '' : __DIR__) . $this->url);
if (false !== $newPSL) {
Expand Down