-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Until the before, using String as a Symbol; but replace to a Symbol i…
…s a Symbol
- Loading branch information
Showing
11 changed files
with
93 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RubyVM\VM\Core\Runtime\Entity; | ||
|
||
use RubyVM\VM\Core\YARV\Essential\Symbol\SymbolSymbol; | ||
|
||
class Symbol extends Entity implements EntityInterface | ||
{ | ||
public function __construct(SymbolSymbol $symbol) | ||
{ | ||
$this->symbol = $symbol; | ||
} | ||
|
||
public function testValue(): bool | ||
{ | ||
return (bool) $this->symbol->valueOf(); | ||
} | ||
|
||
public static function createBy(mixed $value = ''): self | ||
{ | ||
return new self(new SymbolSymbol($value)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RubyVM\VM\Core\YARV\Essential\Symbol; | ||
|
||
use RubyVM\VM\Core\YARV\Essential\Encoding; | ||
|
||
class SymbolSymbol implements SymbolInterface, \Stringable | ||
{ | ||
public function __construct( | ||
private readonly string $string, | ||
private readonly Encoding $encoding = Encoding::RUBY_ENCINDEX_UTF_8, | ||
) {} | ||
|
||
public function valueOf(): string | ||
{ | ||
return $this->string; | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return $this->string; | ||
} | ||
|
||
public function encoding(): Encoding | ||
{ | ||
return $this->encoding; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters