diff options
author | Laria Carolin Chabowski <laria@laria.me> | 2020-09-13 22:25:15 +0200 |
---|---|---|
committer | Laria Carolin Chabowski <laria@laria.me> | 2020-09-13 22:25:15 +0200 |
commit | 76a1e915e0eea54b9b9a01d921efa6f9edffb3a8 (patch) | |
tree | 2d3140702e971cbe492561fea0f2d4c512366c07 /src/ste/Scope.php | |
parent | 2bbb1646f56fe84f38ed2a0cba03a386acc6160e (diff) | |
download | ste-76a1e915e0eea54b9b9a01d921efa6f9edffb3a8.tar.gz ste-76a1e915e0eea54b9b9a01d921efa6f9edffb3a8.tar.bz2 ste-76a1e915e0eea54b9b9a01d921efa6f9edffb3a8.zip |
Code cleanup
- Add parameter and return types
- Add missing @throws tags
- Add visibilities to consts
Diffstat (limited to 'src/ste/Scope.php')
-rw-r--r-- | src/ste/Scope.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ste/Scope.php b/src/ste/Scope.php index ea71634..2ab4e7f 100644 --- a/src/ste/Scope.php +++ b/src/ste/Scope.php @@ -15,7 +15,7 @@ class Scope implements \ArrayAccess * @return string[] * @throws RuntimeError */ - private static function parse_name($name) + private static function parse_name(string $name): array { $remain = $name; $fields = []; @@ -58,7 +58,7 @@ class Scope implements \ArrayAccess * @return mixed A reference to the resolved variable * @throws VarNotInScope */ - private function &get_topvar_reference($name, $localonly) + private function &get_topvar_reference(string $name, bool $localonly) { if (array_key_exists($name, $this->vars)) { $ref = &$this->vars[$name]; @@ -80,7 +80,7 @@ class Scope implements \ArrayAccess * @return mixed A reference to the resolved variable * @throws RuntimeError */ - public function &get_var_reference($name, $create_if_not_exist, $localonly=false) + public function &get_var_reference(string $name, bool $create_if_not_exist, $localonly=false) { $nullref = null; @@ -133,7 +133,7 @@ class Scope implements \ArrayAccess * @param mixed $val * @throws RuntimeError */ - public function set_var_by_name($name, $val) + public function set_var_by_name(string $name, $val): void { $ref = &$this->get_var_reference($name, true); $ref = $val; @@ -144,7 +144,7 @@ class Scope implements \ArrayAccess * @param mixed $val * @throws RuntimeError */ - public function set_local_var($name, $val) + public function set_local_var(string $name, $val): void { $ref = &$this->get_var_reference($name, true, true); $ref = $val; @@ -155,7 +155,7 @@ class Scope implements \ArrayAccess * @return mixed Returns an empty string, if not found or unset * @throws RuntimeError */ - public function get_var_by_name($name) + public function get_var_by_name(string $name) { $ref = $this->get_var_reference($name, false); return $ref === null ? "" : $ref; @@ -164,7 +164,7 @@ class Scope implements \ArrayAccess /** * @return self */ - public function new_subscope() + public function new_subscope(): self { $o = new self(); $o->parent = $this; |