diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 9f9f3a4..806fba1 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -14,8 +14,12 @@ jobs: matrix: os: [ubuntu-latest] php: [8.2, 8.3, 8.4] - phpunit: [10.*, 11.*] + phpunit: [10.*, 11.*, 12.*] stability: [prefer-lowest, prefer-stable] + exclude: + # PHPUnit 12 requires PHP 8.3+ + - php: 8.2 + phpunit: 12.* name: P${{ matrix.php }} - PHPUnit ${{ matrix.phpunit }} - ${{ matrix.stability }} - ${{ matrix.os }} diff --git a/README.md b/README.md index 69a6bc4..421055f 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,9 @@ Test meta tags, titles, canonical URLs, Open Graph, Twitter Cards, robots direct ## Requirements -- PHP 8.2+ -- Laravel 11 or 12 -- PHPUnit 10 or 11 +- PHP 8.2+ (8.3+ required when used with Laravel 13) +- Laravel 11, 12, or 13 +- PHPUnit 10, 11, or 12 ## Table of Contents diff --git a/composer.json b/composer.json index f61d5a5..a296dce 100644 --- a/composer.json +++ b/composer.json @@ -26,14 +26,14 @@ ], "require": { "php": "^8.2", - "illuminate/macroable": "^11.0|^12.0", - "phpunit/phpunit": "^10.0|^11.0", + "illuminate/macroable": "^11.0|^12.0|^13.0", + "phpunit/phpunit": "^10.0|^11.0|^12.0", "spatie/url": "^2.0", "symfony/dom-crawler": "^6.1|^7.0" }, "require-dev": { "laravel/pint": "^1.18", - "phpstan/phpstan": "^1.8" + "phpstan/phpstan": "^2.0" }, "autoload": { "psr-4": { diff --git a/src/Parser/HTMLParser.php b/src/Parser/HTMLParser.php index 3ce9e82..73ec026 100644 --- a/src/Parser/HTMLParser.php +++ b/src/Parser/HTMLParser.php @@ -39,13 +39,16 @@ public function grabAttributeFrom(string $xpath, string|array $attributes) return $this->getArgumentsFromNode($nodes->getNode(0), $attributes); } + /** + * @param string|array|null $attribute + */ public function grabMultiple(string $xpath, string|array|null $attribute = null): array { $result = []; $nodes = $this->crawler->filterXPath($xpath); foreach ($nodes as $node) { - $result[] = $attribute !== null ? $this->getArgumentsFromNode($node, $attribute) : $node->textContent; // @phpstan-ignore argument.templateType + $result[] = $attribute !== null ? $this->getArgumentsFromNode($node, $attribute) : $node->textContent; } return $result; diff --git a/src/Tags/Robots.php b/src/Tags/Robots.php index 5d031bf..90c3b48 100644 --- a/src/Tags/Robots.php +++ b/src/Tags/Robots.php @@ -27,13 +27,13 @@ class Robots implements JsonSerializable, Stringable public const NO_SNIPPET = 'nosnippet'; - /** @var array */ + /** @var array */ private array $parameters; public function __construct( string $content ) { - /** @var array */ + /** @var list $parameters */ $parameters = array_map( 'trim', explode(',', $content)