Skip to content

Commit 6599a11

Browse files
authored
Merge pull request #64 from GravityPDF/php-8.5
PHP 8.5 support
2 parents 32b08b5 + e36b7b7 commit 6599a11

15 files changed

Lines changed: 152 additions & 152 deletions

‎.github/workflows/coding-standard.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout repository
11-
uses: actions/checkout@v4
11+
uses: actions/checkout@v6
1212

1313
- name: Setup PHP
1414
uses: shivammathur/setup-php@v2

‎.github/workflows/lock.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
name: 🔒 Lock closed issues and PRs
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: dessant/lock-threads@v5
14+
- uses: dessant/lock-threads@v6
1515
with:
1616
github-token: ${{ github.token }}
1717
issue-inactive-days: "30"
1818
issue-lock-reason: ""
1919
pr-inactive-days: "1"
20-
pr-lock-reason: ""
20+
pr-lock-reason: ""

‎.github/workflows/unit-testing.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
php-versions: [ '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
10+
php-versions: [ '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
1111
include:
1212
- php: '8.3'
1313
report: true
1414

1515
name: PHP ${{ matrix.php-versions }} PHPUnit Test
1616
steps:
1717
- name: Checkout repository
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v6
1919

2020
- name: Setup PHP
2121
uses: shivammathur/setup-php@v2
@@ -24,7 +24,7 @@ jobs:
2424
ini-values: error_reporting=E_ALL
2525

2626
- name: Install Composer Dependencies
27-
uses: ramsey/composer-install@v3
27+
uses: ramsey/composer-install@v4
2828

2929
- name: Log debug information
3030
run: |
@@ -41,7 +41,7 @@ jobs:
4141

4242
- name: Check Code Coverage
4343
if: ${{ matrix.report }}
44-
uses: codecov/codecov-action@v4
44+
uses: codecov/codecov-action@v5
4545
with:
4646
directory: ./coverage/
47-
token: ${{ secrets.CODECOV_TOKEN }}
47+
token: ${{ secrets.CODECOV_TOKEN }}

‎composer.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "gravitypdf/querypath",
33
"type": "library",
4-
"description": "PHP library for HTML(5)/XML querying (CSS 4 or XPath) and processing (like jQuery) with PHP8.3 support",
4+
"description": "PHP library for HTML(5)/XML querying (CSS 4 or XPath) and processing (like jQuery) with PHP 7.0 to 8.5 support",
55
"homepage": "https://github.com/gravitypdf/querypath",
66
"license": "MIT",
77
"keywords": [
@@ -23,7 +23,7 @@
2323
}
2424
],
2525
"require": {
26-
"php": "^7.1 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
26+
"php": "^7.1 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
2727
"masterminds/html5": "^2.0"
2828
},
2929
"autoload": {
@@ -55,4 +55,4 @@
5555
"arthurkushman/query-path": "3.1.4",
5656
"querypath/querypath": "3.0.5"
5757
}
58-
}
58+
}

‎src/CSS/DOMTraverser.php‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function __construct(SplObjectStorage $splos, bool $initialized = false,
104104
/*
105105
$this->dom = $dom;
106106
$this->matches = new \SplObjectStorage();
107-
$this->matches->attach($this->dom);
107+
$this->matches->offsetSet($this->dom);
108108
*/
109109
}
110110

@@ -149,7 +149,7 @@ public function find($selector): DOMTraverser
149149
// fprintf(STDOUT, "Testing %s against %s.\n", $candidate->tagName, $selectorGroup[0]);
150150
if ($this->matchesSelector($candidate, $selectorGroup)) {
151151
// $this->debug('Attaching ' . $candidate->nodeName);
152-
$found->attach($candidate);
152+
$found->offsetSet($candidate);
153153
}
154154
}
155155
}
@@ -477,7 +477,7 @@ protected function initialMatchOnID(SimpleSelector $selector, SplObjectStorage $
477477
/** @var DOMElement $node */
478478
foreach ($matches as $node) {
479479
if ($node->getAttribute('id') === $id) {
480-
$found->attach($node);
480+
$found->offsetSet($node);
481481
}
482482

483483
$nl = $this->initialXpathQuery($xpath, $node, $baseQuery);
@@ -524,7 +524,7 @@ protected function initialMatchOnClasses(SimpleSelector $selector, SplObjectStor
524524
if ($node->hasAttribute('class')) {
525525
$intersect = array_intersect($selector->classes, explode(' ', $node->getAttribute('class')));
526526
if (count($intersect) === count($selector->classes)) {
527-
$found->attach($node);
527+
$found->offsetSet($node);
528528
}
529529
}
530530

@@ -536,7 +536,7 @@ protected function initialMatchOnClasses(SimpleSelector $selector, SplObjectStor
536536

537537
$intersect = array_intersect($selector->classes, $classArray);
538538
if (count($intersect) === count($selector->classes)) {
539-
$found->attach($subNode);
539+
$found->offsetSet($subNode);
540540
}
541541
}
542542
}
@@ -590,7 +590,7 @@ protected function initialMatchOnElement(SimpleSelector $selector, SplObjectStor
590590
// Capture the case where the initial element is the root element.
591591
if ($node->tagName === $element
592592
|| ($element === '*' && $node->parentNode instanceof DOMDocument)) {
593-
$found->attach($node);
593+
$found->offsetSet($node);
594594
}
595595
$nl = $node->getElementsByTagName($element);
596596
if (! empty($nl) && $nl instanceof DOMNodeList) {
@@ -634,7 +634,7 @@ protected function initialMatchOnElementNS(SimpleSelector $selector, SplObjectSt
634634
}
635635
}
636636
foreach ($detach as $rem) {
637-
$elements->detach($rem);
637+
$elements->offsetUnset($rem);
638638
}
639639
$selector->ns = null;
640640

@@ -888,7 +888,7 @@ protected function setMatches($matches)
888888
public function attachNodeList(DOMNodeList $nodeList, SplObjectStorage $splos)
889889
{
890890
foreach ($nodeList as $item) {
891-
$splos->attach($item);
891+
$splos->offsetSet($item);
892892
}
893893
}
894894

‎src/CSS/DOMTraverser/PseudoClass.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function elementMatches($pseudoclass, $node, $scope, $value = null)
7979
return false;
8080
case 'indeterminate':
8181
// Because sometimes screwing with people is fun.
82-
return (boolean) mt_rand(0, 1);
82+
return (bool) mt_rand(0, 1);
8383
case 'lang':
8484
// No value = exception.
8585
if (! isset($value)) {
@@ -354,7 +354,7 @@ protected function containsExactly($node, $value): bool
354354
protected function has($node, $selector): bool
355355
{
356356
$splos = new SPLObjectStorage();
357-
$splos->attach($node);
357+
$splos->offsetSet($node);
358358
$traverser = new DOMTraverser($splos, true);
359359
$results = $traverser->find($selector)->matches();
360360

0 commit comments

Comments
 (0)