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
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,11 @@ private function processTryCatch(TryCatch $tryCatch, string $filePath, MutatingS
);

$catchMutatingScope = $mutatingScope->enterCatchType($type, $varName);

foreach ($catch->types as $type) {
$type->setAttribute(AttributeKey::SCOPE, $mutatingScope);
}

$this->processNodes($catch->stmts, $filePath, $catchMutatingScope);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Rector\Tests\Renaming\Rector\Name\RenameClassRector\Fixture;

class CatchException
{
public function run()
{
try {

} catch (\Exception $e) {}
}
}

?>
-----
<?php

namespace Rector\Tests\Renaming\Rector\Name\RenameClassRector\Fixture;

class CatchException
{
public function run()
{
try {

} catch (\RuntimeException $e) {}
}
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@
'Bar' => 'BarInterface',
'App' => 'Illuminate\Support\Facades\App',
'NotExistsClass' => 'NewClass',
'Exception' => 'RuntimeException',
]);
};
1 change: 0 additions & 1 deletion src/NodeAnalyzer/ScopeAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public function resolveScope(
return $this->scopeFactory->createFromFile($filePath);
}


/**
* Node and parent Node doesn't has Scope, and Node Start token pos is < 0,
* it means the node and parent node just re-printed, the Scope need to be resolved from file
Expand Down