Skip to content

Commit

Permalink
Fix looking for a version
Browse files Browse the repository at this point in the history
  • Loading branch information
m3m0r7 committed Dec 25, 2023
1 parent 0bdd5b3 commit 11a8ef6
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/VM/Core/Runtime/RubyVM.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,7 @@ public function runtime(RubyVersion $useVersion = null): Runtime
{
$selectedVersion = null;

// @var Runtime|null $kernel
if (!$useVersion instanceof \RubyVM\VM\Core\YARV\RubyVersion) {
$runtime = $this->registeredRuntimes[$selectedVersion = array_key_first($this->registeredRuntimes)] ?? null;
} else {
$runtime = $this->registeredRuntimes[$selectedVersion = $useVersion->value] ?? null;
}
$runtime = $this->registeredRuntimes[$selectedVersion = $useVersion?->value ?? $this->specifiedDefaultVersion->value] ?? null;

if (!$runtime instanceof \RubyVM\VM\Core\Runtime\Runtime) {
throw new RubyVMException('The RubyVM is not registered a kernel - You should call RubyVM::register method before calling the disassemble method');
Expand Down

0 comments on commit 11a8ef6

Please sign in to comment.