Skip to content

Commit 7247230

Browse files
authored
Merge pull request #210 from marcovtwout/php8-compatibility
PHP 8.2 compatibility
2 parents bec82f5 + 37a8f26 commit 7247230

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

composer.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
}
1515
},
1616
"require": {
17-
"php": "^7.4",
18-
"goaop/framework": "^3.0",
17+
"php": "^8.2",
18+
"goaop/framework": "^4.0@dev",
19+
"goaop/parser-reflection": "^4.0@dev",
1920
"phpunit/phpunit": "^9.5",
2021
"symfony/finder": "^4.4 | ^5.4 | ^6.0"
2122
},
@@ -24,5 +25,10 @@
2425
"codeception/verify": "^2.2",
2526
"codeception/specify": "^2.0",
2627
"consolidation/robo": "^3.0"
28+
},
29+
"extra": {
30+
"branch-alias": {
31+
"dev-master": "5.0-dev"
32+
}
2733
}
2834
}

src/AspectMock/Intercept/BeforeMockTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public function transform(StreamMetaData $metadata): string
7373
$beforeDefinition = sprintf($beforeDefinition, $params);
7474
$tokenPosition = $method->getNode()->getAttribute('startTokenPos');
7575
do {
76-
if (($metadata->tokenStream[$tokenPosition][1] ?? '') === '{') {
77-
$metadata->tokenStream[$tokenPosition][1] .= $beforeDefinition;
76+
if (($metadata->tokenStream[$tokenPosition]->text ?? '') === '{') {
77+
$metadata->tokenStream[$tokenPosition]->text .= $beforeDefinition;
7878
$result = self::RESULT_TRANSFORMED;
7979
break;
8080
}

src/AspectMock/Kernel.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use AspectMock\Intercept\BeforeMockTransformer;
99
use Go\Core\AspectContainer;
1010
use Go\Core\AspectKernel;
11+
use Go\Core\AdviceMatcher;
12+
use Go\Core\CachedAspectLoader;
13+
use Go\Instrument\ClassLoading\CachePathManager;
1114
use Go\Instrument\ClassLoading\SourceTransformingLoader;
1215
use Go\Instrument\Transformer\CachingTransformer;
1316
use Go\Instrument\Transformer\FilterInjectorTransformer;
@@ -61,16 +64,16 @@ public function loadFile(string $file)
6164

6265
protected function registerTransformers(): array
6366
{
64-
$cachePathManager = $this->getContainer()->get('aspect.cache.path.manager');
67+
$cachePathManager = $this->getContainer()->getService(CachePathManager::class);
6568

6669
$sourceTransformers = [
6770
new FilterInjectorTransformer($this, SourceTransformingLoader::getId(), $cachePathManager),
6871
new MagicConstantTransformer($this),
6972
new BeforeMockTransformer(
7073
$this,
71-
$this->getContainer()->get('aspect.advice_matcher'),
74+
$this->getContainer()->getService(AdviceMatcher::class),
7275
$cachePathManager,
73-
$this->getContainer()->get('aspect.cached.loader')
76+
$this->getContainer()->getService(CachedAspectLoader::class)
7477
)
7578
];
7679

0 commit comments

Comments
 (0)