Skip to content

Commit cb46859

Browse files
committed
Fix PHP 8.5 SplObjectStorage::attach use SplObjectStorage::offsetSet instead
1 parent 0c44538 commit cb46859

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/Parser/Parser.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Doctum\Reflection\LazyClassReflection;
2121
use Doctum\Store\StoreInterface;
2222
use Symfony\Component\Finder\Finder;
23+
use SplObjectStorage;
2324

2425
class Parser
2526
{
@@ -46,7 +47,7 @@ public function parse(Project $project, $callback = null)
4647
$steps = iterator_count($this->iterator);
4748
$context = $this->parser->getContext();
4849
$transaction = new Transaction($project);
49-
$toStore = new \SplObjectStorage();
50+
$toStore = new SplObjectStorage();
5051
foreach ($this->iterator as $file) {
5152
$file = $file->getPathname();
5253
++$step;
@@ -71,7 +72,7 @@ public function parse(Project $project, $callback = null)
7172

7273
foreach ($context->getFunctions() as $addr => $fun) {
7374
$project->addFunction($fun);
74-
$toStore->attach($fun);
75+
$toStore->offsetSet($fun);
7576
}
7677

7778
foreach ($context->leaveFile() as $class) {
@@ -81,7 +82,7 @@ public function parse(Project $project, $callback = null)
8182

8283
$project->addClass($class);
8384
$transaction->addClass($class);
84-
$toStore->attach($class);
85+
$toStore->offsetSet($class);
8586
$class->notFromCache();
8687
}
8788
}

src/Parser/ProjectTraverser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function traverse(Project $project): SplObjectStorage
100100
}
101101

102102
if ($isModified) {
103-
$modified->attach($class);
103+
$modified->offsetSet($class);
104104
}
105105
}
106106

@@ -116,7 +116,7 @@ public function traverse(Project $project): SplObjectStorage
116116
}
117117

118118
if ($isModifiedFunction) {
119-
$modified->attach($function);
119+
$modified->offsetSet($function);
120120
}
121121
}
122122

0 commit comments

Comments
 (0)