Skip to content

Commit 15b58a0

Browse files
author
Alexandre Gérault
committed
fix: remove contract from methods and add phpdoc
1 parent b368c0b commit 15b58a0

File tree

2 files changed

+35
-30
lines changed

2 files changed

+35
-30
lines changed

src/Illuminate/Config/Repository.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@ public function offsetUnset($key): void
180180
$this->set($key, null);
181181
}
182182

183+
184+
/**
185+
* Get the specified configuration value typed as a string.
186+
* If the value isn't a string it should throw an exception.
187+
*
188+
* @param string $key
189+
* @return string
190+
*/
183191
public function string(string $key): string
184192
{
185193
$value = $this->get($key);
@@ -194,6 +202,10 @@ public function string(string $key): string
194202
}
195203

196204
/**
205+
* Get the specified configuration value typed as an array.
206+
* If the value isn't an array it should throw an exception.
207+
*
208+
* @param string $key
197209
* @return array<array-key, mixed>
198210
*/
199211
public function array(string $key): array
@@ -209,6 +221,14 @@ public function array(string $key): array
209221
return $value;
210222
}
211223

224+
225+
/**
226+
* Get the specified configuration value typed as a boolean.
227+
* If the value isn't a boolean it should throw an exception.
228+
*
229+
* @param string $key
230+
* @return bool
231+
*/
212232
public function boolean(string $key): bool
213233
{
214234
$value = $this->get($key);
@@ -222,6 +242,13 @@ public function boolean(string $key): bool
222242
return $value;
223243
}
224244

245+
/**
246+
* Get the specified configuration value typed as an integer.
247+
* If the value isn't an integer it should throw an exception.
248+
*
249+
* @param string $key
250+
* @return int
251+
*/
225252
public function integer(string $key): int
226253
{
227254
$value = $this->get($key);
@@ -235,6 +262,14 @@ public function integer(string $key): int
235262
return $value;
236263
}
237264

265+
266+
/**
267+
* Get the specified configuration value typed as a float.
268+
* If the value isn't a float it should throw an exception.
269+
*
270+
* @param string $key
271+
* @return float
272+
*/
238273
public function float(string $key): float
239274
{
240275
$value = $this->get($key);

src/Illuminate/Contracts/Config/Repository.php

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -54,34 +54,4 @@ public function prepend($key, $value);
5454
* @return void
5555
*/
5656
public function push($key, $value);
57-
58-
/**
59-
* Get the specified configuration value typed as a string.
60-
* If the value isn't a string it should throw an exception.
61-
*/
62-
public function string(string $key): string;
63-
64-
/**
65-
* Get the specified configuration value typed as an array.
66-
* If the value isn't an array it should throw an exception.
67-
*/
68-
public function array(string $key): array;
69-
70-
/**
71-
* Get the specified configuration value typed as an integer.
72-
* If the value isn't an integer it should throw an exception.
73-
*/
74-
public function integer(string $key): int;
75-
76-
/**
77-
* Get the specified configuration value typed as a boolean.
78-
* If the value isn't a boolean it should throw an exception.
79-
*/
80-
public function boolean(string $key): bool;
81-
82-
/**
83-
* Get the specified configuration value typed as a float.
84-
* If the value isn't a float it should throw an exception.
85-
*/
86-
public function float(string $key): float;
8757
}

0 commit comments

Comments
 (0)