diff options
author | Laria Carolin Chabowski <laria@laria.me> | 2020-05-01 17:33:13 +0200 |
---|---|---|
committer | Laria Carolin Chabowski <laria@laria.me> | 2020-05-01 17:33:13 +0200 |
commit | 7449faaa76a5b4008fd51a6562cca2e0a852ea6b (patch) | |
tree | 9e6bc34afe9e4e7d49b1a26f0b67485869b0a9de /src/ste/VariableNode.php | |
parent | b0c9a4aeb61aff8a8fa60746cd566e6dbe05a3b5 (diff) | |
download | ste-7449faaa76a5b4008fd51a6562cca2e0a852ea6b.tar.gz ste-7449faaa76a5b4008fd51a6562cca2e0a852ea6b.tar.bz2 ste-7449faaa76a5b4008fd51a6562cca2e0a852ea6b.zip |
Clean up code and improve documentation
This switches the code documentation genarator (we're now using phpdoc
instead of NaturalDoc).
Also various small code cleanup tasks:
- Remove unused code
- Get rid of `and` / `or`, we're using `&&` / `||` now
- Adding missing return values
- Helping PhpStorm to detect some dynamically called functions
(mark_builtin_callable in Transcompiler)
- Reword transcompiling => compiling in documentation
Diffstat (limited to 'src/ste/VariableNode.php')
-rw-r--r-- | src/ste/VariableNode.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/ste/VariableNode.php b/src/ste/VariableNode.php index d03fdce..9a4ced8 100644 --- a/src/ste/VariableNode.php +++ b/src/ste/VariableNode.php @@ -4,13 +4,24 @@ namespace kch42\ste; class VariableNode extends ASTNode { + /** @var string */ public $name; + + /** @var ASTNode[][] */ public $arrayfields = array(); + + /** + * @return string + */ public function transcompile() { $varaccess = '@$ste->scope[' . (is_numeric($this->name) ? $this->name : '"' . Misc::escape_text($this->name) . '"'). ']'; foreach ($this->arrayfields as $af) { - if ((count($af) == 1) and ($af[0] instanceof TextNode) and is_numeric($af[0]->text)) { + if ( + count($af) == 1 + && ($af[0] instanceof TextNode) + && is_numeric($af[0]->text) + ) { $varaccess .= '[' . $af->text . ']'; } else { $varaccess .= '[' . implode(".", array_map(function ($node) { |