Skip to content

Commit f1fa33b

Browse files
authored
Update Config.php
1 parent 333c227 commit f1fa33b

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

src/Config.php

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,33 +42,33 @@ public function getIterator(): \Generator
4242

4343
/**
4444
* @param $name
45-
* @return mixed|self
45+
* @return Config|mixed
4646
*/
47-
public function __get($name)
47+
public function __get(int|string|float $name): mixed
4848
{
4949
return $this->offsetGet($name);
5050
}
5151

5252
/**
5353
* @throws RuntimeException
5454
*/
55-
public function __set($name, $value)
55+
public function __set(int|string|float $name, mixed $value)
5656
{
5757
$this->offsetSet($name, $value);
5858
}
5959

6060
/**
61-
* @inerhitDoc
61+
* @return Config|mixed
6262
*/
63-
public function offsetGet($offset): mixed
63+
public function offsetGet(mixed $offset): mixed
6464
{
6565
return $this->get($offset);
6666
}
6767

6868
/**
6969
* @return self|null|mixed
7070
*/
71-
public function get($offset, mixed $default = null, bool $invoke = true, bool $toArray = false)
71+
public function get(int|string|float $offset, mixed $default = null, bool $invoke = true, bool $toArray = true): mixed
7272
{
7373
$data = $this->offsetExists($offset) ? $this->data[$offset]
7474
: ($invoke && is_callable($default) ? $default() : $default);
@@ -81,7 +81,7 @@ public function get($offset, mixed $default = null, bool $invoke = true, bool $t
8181
/**
8282
* @throws RuntimeException
8383
*/
84-
public function offsetSet($offset, $value): void
84+
public function offsetSet(mixed $offset, mixed $value): void
8585
{
8686
throw $this->notImmutable();
8787
}
@@ -101,35 +101,31 @@ public function toArray(): array
101101
return $array;
102102
}
103103

104-
/**
105-
* @param $name
106-
* @return bool
107-
*/
108-
public function __isset($name): bool
104+
public function __isset(string|int|float $offset): bool
109105
{
110-
return $this->offsetExists($name);
106+
return $this->offsetExists($offset);
111107
}
112108

113109
/**
114110
* @inerhitDoc
115111
*/
116-
public function offsetExists($offset): bool
112+
public function offsetExists(mixed $offset): bool
117113
{
118114
return array_key_exists($offset, $this->data);
119115
}
120116

121117
/**
122118
* @throws RuntimeException
123119
*/
124-
public function __unset($name): void
120+
public function __unset(string|int|float $name): void
125121
{
126122
$this->offsetUnset($name);
127123
}
128124

129125
/**
130126
* @throws RuntimeException
131127
*/
132-
public function offsetUnset($offset): void
128+
public function offsetUnset(mixed $offset): void
133129
{
134130
throw $this->notImmutable();
135131
}
@@ -184,10 +180,7 @@ public static function merge(callable ...$providers): array
184180

185181
public static function fromCache(string $filename): array
186182
{
187-
if (file_exists($filename)) {
188-
return include $filename;
189-
}
190-
183+
if (file_exists($filename)) return include $filename;
191184
throw new \RuntimeException('No such file '. $filename);
192185
}
193186

0 commit comments

Comments
 (0)