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
10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
}
},
"require": {
"php": "^7.4",
"goaop/framework": "^3.0",
"php": "^8.2",
"goaop/framework": "^4.0@dev",
"goaop/parser-reflection": "^4.0@dev",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcovtwout I can merge this PR, but I think that it would be better to delay release until goaop/framework 4.0.0 is released.

I added branch alias below.

Copy link
Copy Markdown
Contributor Author

@marcovtwout marcovtwout Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Naktibalda Thanks! Perhaps you can update the README.md as well on master, there's still some references to the previous / PHP 7.4 version: https://github.com/Codeception/AspectMock/tree/master?tab=readme-ov-file#requirements

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created PR: #212

"phpunit/phpunit": "^9.5",
"symfony/finder": "^4.4 | ^5.4 | ^6.0"
},
Expand All @@ -24,5 +25,10 @@
"codeception/verify": "^2.2",
"codeception/specify": "^2.0",
"consolidation/robo": "^3.0"
},
"extra": {
"branch-alias": {
"dev-master": "5.0-dev"
}
}
}
4 changes: 2 additions & 2 deletions src/AspectMock/Intercept/BeforeMockTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public function transform(StreamMetaData $metadata): string
$beforeDefinition = sprintf($beforeDefinition, $params);
$tokenPosition = $method->getNode()->getAttribute('startTokenPos');
do {
if (($metadata->tokenStream[$tokenPosition][1] ?? '') === '{') {
$metadata->tokenStream[$tokenPosition][1] .= $beforeDefinition;
if (($metadata->tokenStream[$tokenPosition]->text ?? '') === '{') {
$metadata->tokenStream[$tokenPosition]->text .= $beforeDefinition;
$result = self::RESULT_TRANSFORMED;
break;
}
Expand Down
9 changes: 6 additions & 3 deletions src/AspectMock/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use AspectMock\Intercept\BeforeMockTransformer;
use Go\Core\AspectContainer;
use Go\Core\AspectKernel;
use Go\Core\AdviceMatcher;
use Go\Core\CachedAspectLoader;
use Go\Instrument\ClassLoading\CachePathManager;
use Go\Instrument\ClassLoading\SourceTransformingLoader;
use Go\Instrument\Transformer\CachingTransformer;
use Go\Instrument\Transformer\FilterInjectorTransformer;
Expand Down Expand Up @@ -61,16 +64,16 @@ public function loadFile(string $file)

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

$sourceTransformers = [
new FilterInjectorTransformer($this, SourceTransformingLoader::getId(), $cachePathManager),
new MagicConstantTransformer($this),
new BeforeMockTransformer(
$this,
$this->getContainer()->get('aspect.advice_matcher'),
$this->getContainer()->getService(AdviceMatcher::class),
$cachePathManager,
$this->getContainer()->get('aspect.cached.loader')
$this->getContainer()->getService(CachedAspectLoader::class)
)
];

Expand Down