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
6 changes: 5 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
5 changes: 4 additions & 1 deletion src/Parser/HTMLParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@ public function grabAttributeFrom(string $xpath, string|array $attributes)
return $this->getArgumentsFromNode($nodes->getNode(0), $attributes);
}

/**
* @param string|array<string>|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;
Expand Down
4 changes: 2 additions & 2 deletions src/Tags/Robots.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ class Robots implements JsonSerializable, Stringable

public const NO_SNIPPET = 'nosnippet';

/** @var array<Robots::*> */
/** @var array<int, string> */
private array $parameters;

public function __construct(
string $content
) {
/** @var array<Robots::*> */
/** @var list<string> $parameters */
$parameters = array_map(
'trim',
explode(',', $content)
Expand Down
Loading