Skip to content

Commit dff05a5

Browse files
committed
Removed since tag from class header.
1 parent 85f3a1a commit dff05a5

17 files changed

+73
-89
lines changed

ArrayCollection.php

+9-10
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @copyright 2020 Joshua Parker <[email protected]>
88
* @copyright 2016 Sinergi
99
* @license https://opensource.org/licenses/mit-license.php MIT License
10-
*
11-
* @since 1.0.0
1210
*/
1311

1412
declare(strict_types=1);
@@ -80,7 +78,7 @@ public function offsetSet(mixed $offset, mixed $value): void
8078

8179
/**
8280
* @param string $offset
83-
* @return null
81+
* @return void
8482
*/
8583
public function offsetUnset(mixed $offset): void
8684
{
@@ -98,11 +96,11 @@ public function getIterator(): ArrayIterator
9896
}
9997

10098
/**
101-
* @param string $key
102-
* @param mixed $default
99+
* @param mixed $key
100+
* @param mixed|null $default
103101
* @return null|mixed
104102
*/
105-
public function get($key, $default = null)
103+
public function get(mixed $key, mixed $default = null): mixed
106104
{
107105
if (isset($this->container[$key])) {
108106
return $this->container[$key];
@@ -114,15 +112,16 @@ public function get($key, $default = null)
114112
* @param string $key
115113
* @param mixed $value
116114
*/
117-
public function set($key, $value)
115+
public function set(string $key, mixed $value): void
118116
{
119117
$this->container[$key] = $value;
120118
}
121119

122120
/**
123121
* @param mixed $value
122+
* @return bool
124123
*/
125-
public function add($value): bool
124+
public function add(mixed $value): bool
126125
{
127126
$this->container[] = $value;
128127
return true;
@@ -131,7 +130,7 @@ public function add($value): bool
131130
/**
132131
* @return null|mixed
133132
*/
134-
public function remove(string $key)
133+
public function remove(string $key): mixed
135134
{
136135
if (isset($this->container[$key]) || array_key_exists($key, $this->container)) {
137136
$removed = $this->container[$key];
@@ -142,7 +141,7 @@ public function remove(string $key)
142141
return null;
143142
}
144143

145-
public function removeAll()
144+
public function removeAll(): void
146145
{
147146
$this->container = [];
148147
}

Collection.php

+22-17
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @copyright 2020 Joshua Parker <[email protected]>
88
* @copyright 2016 Sinergi
99
* @license https://opensource.org/licenses/mit-license.php MIT License
10-
*
11-
* @since 1.0.0
1210
*/
1311

1412
declare(strict_types=1);
@@ -39,15 +37,16 @@ public static function factory($config): Collection
3937
/**
4038
* Set a config
4139
*
42-
* @param array $config
43-
* @return void|self
40+
* @param string $key
41+
* @param mixed $value
42+
* @return self
4443
*/
45-
public function setConfigKey(string $key, $config)
44+
public function setConfigKey(string $key, mixed $value): static
4645
{
4746
if (! isset($this->container[$key])) {
48-
$this->container[$key] = $config;
47+
$this->container[$key] = $value;
4948
} else {
50-
$this->container[$key] = array_merge($this->container[$key], $config);
49+
$this->container[$key] = array_merge($this->container[$key], $value);
5150
}
5251
return $this;
5352
}
@@ -68,16 +67,16 @@ public function removeConfigKey(string $key): void
6867
/**
6968
* Get a config
7069
*
71-
* @param mixed $default
72-
* @throws TypeException
70+
* @param string $key
71+
* @param mixed|null $default
7372
* @return mixed
73+
* @throws TypeException
7474
*/
75-
public function getConfigKey(string $key, $default = null): mixed
75+
public function getConfigKey(string $key, mixed $default = null): mixed
7676
{
7777
if (! is_string($key) || empty($key)) {
7878
throw new TypeException(
79-
sprintf('Parameter %s passed to Config::get() is not a valid string resource.'),
80-
$key
79+
sprintf('Parameter %s passed to Config::get() is not a valid string resource.', $key),
8180
);
8281
}
8382

@@ -97,7 +96,7 @@ public function getConfigKey(string $key, $default = null): mixed
9796
/**
9897
* @return $this
9998
*/
100-
public function reset()
99+
public function reset(): static
101100
{
102101
$this->container = [];
103102
return $this;
@@ -106,33 +105,38 @@ public function reset()
106105
/**
107106
* @param string $key
108107
* @return mixed
108+
* @throws TypeException
109109
*/
110110
public function __get($key)
111111
{
112112
return $this->offsetGet($key);
113113
}
114114

115115
/**
116-
* @param string $key
116+
* @param mixed $key
117117
* @param array|null $args
118118
* @return mixed
119+
* @throws TypeException
119120
*/
120-
public function __call($key, $args = null)
121+
public function __call(mixed $key, array $args = null)
121122
{
122123
return $this->offsetGet($key);
123124
}
124125

125126
/**
126-
* @param string $key
127+
* @param mixed $key
127128
* @return bool
129+
* @throws TypeException
128130
*/
129-
public function __isset($key)
131+
public function __isset(mixed $key)
130132
{
131133
return $this->offsetExists($key);
132134
}
133135

134136
/**
135137
* @param mixed $offset
138+
* @return bool
139+
* @throws TypeException
136140
*/
137141
public function offsetExists(mixed $offset): bool
138142
{
@@ -143,6 +147,7 @@ public function offsetExists(mixed $offset): bool
143147
/**
144148
* @param mixed $offset
145149
* @return mixed
150+
* @throws TypeException
146151
*/
147152
public function offsetGet(mixed $offset): mixed
148153
{

ConfigContainer.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @copyright 2020 Joshua Parker <[email protected]>
88
* @copyright 2016 Sinergi
99
* @license https://opensource.org/licenses/mit-license.php MIT License
10-
*
11-
* @since 1.0.0
1210
*/
1311

1412
declare(strict_types=1);
@@ -22,19 +20,21 @@ interface ConfigContainer
2220
/**
2321
* Get an item from current configuration.
2422
*
25-
* @param mixed $default
23+
* @param string $key
24+
* @param mixed|null $default
2625
* @return mixed
2726
* @throws Exception
2827
*/
29-
public function getConfigKey(string $key, $default = null);
28+
public function getConfigKey(string $key, mixed $default = null): mixed;
3029

3130
/**
3231
* Set an item in current configuration.
3332
*
33+
* @param string $key
3434
* @param mixed $value
3535
* @return void|self
3636
*/
37-
public function setConfigKey(string $key, $value);
37+
public function setConfigKey(string $key, mixed $value);
3838

3939
/**
4040
* Checks if a key exists.

ConfigLoader.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @copyright 2020 Joshua Parker <[email protected]>
88
* @copyright 2016 Sinergi
99
* @license https://opensource.org/licenses/mit-license.php MIT License
10-
*
11-
* @since 1.0.0
1210
*/
1311

1412
declare(strict_types=1);
@@ -34,6 +32,9 @@ class ConfigLoader
3432
];
3533

3634
/**
35+
* @param PathCollection $paths
36+
* @param string|null $env
37+
* @param string $file
3738
* @return array
3839
*/
3940
public static function load(PathCollection $paths, ?string $env, string $file): array
@@ -49,6 +50,8 @@ public static function load(PathCollection $paths, ?string $env, string $file):
4950

5051
/**
5152
* @param string|PathCollection $path
53+
* @param string|null $env
54+
* @param string $file
5255
* @return array
5356
*/
5457
public static function loadFile($path, ?string $env, string $file): array
@@ -81,7 +84,7 @@ public static function loadFile($path, ?string $env, string $file): array
8184
/**
8285
* @param array $array1
8386
* @param array $array2
84-
* @param array $array3
87+
* @param array|null $array3
8588
* @return array
8689
*/
8790
public static function mergeArrays(array $array1, array $array2, ?array $array3 = null): array

Configuration.php

+5-7
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @copyright 2020 Joshua Parker <[email protected]>
88
* @copyright 2016 Sinergi
99
* @license https://opensource.org/licenses/mit-license.php MIT License
10-
*
11-
* @since 1.0.0
1210
*/
1311

1412
declare(strict_types=1);
@@ -37,7 +35,7 @@ class Configuration
3735
/**
3836
* @param array|Configuration $config
3937
*/
40-
public function __construct($config)
38+
public function __construct(array|Configuration $config)
4139
{
4240
$this->paths = new PathCollection();
4341
if (is_array($config)) {
@@ -72,7 +70,7 @@ public function getPaths(): PathCollection
7270
/**
7371
* @return $this
7472
*/
75-
public function setPaths(PathCollection $pathCollection)
73+
public function setPaths(PathCollection $pathCollection): static
7674
{
7775
$this->paths = $pathCollection;
7876
return $this;
@@ -81,7 +79,7 @@ public function setPaths(PathCollection $pathCollection)
8179
/**
8280
* @return $this
8381
*/
84-
public function setEnvironment(?string $environment = null)
82+
public function setEnvironment(?string $environment = null): static
8583
{
8684
if ($this->environment !== $environment) {
8785
if (method_exists($this, 'reset')) {
@@ -95,7 +93,7 @@ public function setEnvironment(?string $environment = null)
9593
/**
9694
* @return $this
9795
*/
98-
public function removeEnvironment()
96+
public function removeEnvironment(): static
9997
{
10098
if ($this->environment !== null) {
10199
if (method_exists($this, 'reset')) {
@@ -119,7 +117,7 @@ public function getDotenv(): ?Dotenv
119117
/**
120118
* @return $this
121119
*/
122-
public function setDotenv(Dotenv $dotenv)
120+
public function setDotenv(Dotenv $dotenv): static
123121
{
124122
$this->dotenv = $dotenv;
125123
$this->loadDotenv();

Container.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @copyright 2020 Joshua Parker <[email protected]>
88
* @copyright 2016 Sinergi
99
* @license https://opensource.org/licenses/mit-license.php MIT License
10-
*
11-
* @since 1.0.0
1210
*/
1311

1412
declare(strict_types=1);
@@ -32,7 +30,7 @@ class Container implements ContainerInterface
3230
/** @var array $instances */
3331
private array $instances = [];
3432

35-
public function __construct(ContainerInterface $diContainer )
33+
public function __construct(ContainerInterface $diContainer)
3634
{
3735
$this->diContainer = $diContainer ;
3836
}

Factory.php

+4-6
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @copyright 2020 Joshua Parker <[email protected]>
88
* @copyright 2016 Sinergi
99
* @license https://opensource.org/licenses/mit-license.php MIT License
10-
*
11-
* @since 1.0.0
1210
*/
1311

1412
declare(strict_types=1);
@@ -32,7 +30,7 @@ class Factory implements RequiresMandatoryOptions, RequiresConfig
3230
* @param array|Configuration $config
3331
* @return Collection
3432
*/
35-
public function __invoke($config)
33+
public function __invoke(array|Configuration $config): Collection
3634
{
3735
if (is_array($config)) {
3836
$config = new Configuration($config);
@@ -44,15 +42,15 @@ public function __invoke($config)
4442
/**
4543
* @return string
4644
*/
47-
public function vendorName()
45+
public function vendorName(): string
4846
{
4947
return self::VENDOR_NAME;
5048
}
5149

5250
/**
5351
* @return string
5452
*/
55-
public function packageName()
53+
public function packageName(): string
5654
{
5755
return self::PACKAGE_NAME;
5856
}
@@ -68,7 +66,7 @@ public function mandatoryOptions(): iterable
6866
/**
6967
* @return string[] List with optional options
7068
*/
71-
public function optionalOptions()
69+
public function optionalOptions(): array
7270
{
7371
return [
7472
'path',

Helpers/core.php

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @copyright 2020 Joshua Parker <[email protected]>
88
* @copyright 2016 Sinergi
99
* @license https://opensource.org/licenses/mit-license.php MIT License
10-
*
11-
* @since 1.0.0
1210
*/
1311

1412
declare(strict_types=1);

Loader/Loader.php

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @copyright 2020 Joshua Parker <[email protected]>
88
* @copyright 2016 Sinergi
99
* @license https://opensource.org/licenses/mit-license.php MIT License
10-
*
11-
* @since 1.0.0
1210
*/
1311

1412
declare(strict_types=1);

Loader/PhpLoader.php

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @copyright 2020 Joshua Parker <[email protected]>
88
* @copyright 2016 Sinergi
99
* @license https://opensource.org/licenses/mit-license.php MIT License
10-
*
11-
* @since 1.0.0
1210
*/
1311

1412
declare(strict_types=1);

0 commit comments

Comments
 (0)