Skip to content

Commit f2a2495

Browse files
authored
Merge pull request #5 from AngelFQC/master
Fix deprecations about return types
2 parents d6ff2bc + 7dc0604 commit f2a2495

File tree

3 files changed

+26
-107
lines changed

3 files changed

+26
-107
lines changed

src/Bundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@
2424
*/
2525
final class Configuration implements ConfigurationInterface
2626
{
27-
/**
28-
* {@inheritdoc}
29-
*/
30-
public function getConfigTreeBuilder()
27+
public function getConfigTreeBuilder(): TreeBuilder
3128
{
3229
$treeBuilder = new TreeBuilder('sylius_settings');
3330
$rootNode = $treeBuilder->getRootNode();

src/Bundle/Model/Settings.php

Lines changed: 15 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,17 @@ class Settings implements SettingsInterface
3838
*/
3939
protected $parameters = [];
4040

41-
/**
42-
* {@inheritdoc}
43-
*/
4441
public function getId()
4542
{
4643
return $this->id;
4744
}
4845

49-
/**
50-
* {@inheritdoc}
51-
*/
52-
public function getSchemaAlias()
46+
public function getSchemaAlias(): string
5347
{
5448
return $this->schemaAlias;
5549
}
5650

57-
/**
58-
* {@inheritdoc}
59-
*/
60-
public function setSchemaAlias($schemaAlias)
51+
public function setSchemaAlias(string $schemaAlias): void
6152
{
6253
if (null !== $this->schemaAlias) {
6354
throw new \LogicException('The schema alias of the settings model is immutable, instantiate a new object in order to use another schema.');
@@ -66,18 +57,12 @@ public function setSchemaAlias($schemaAlias)
6657
$this->schemaAlias = $schemaAlias;
6758
}
6859

69-
/**
70-
* {@inheritdoc}
71-
*/
72-
public function getNamespace()
60+
public function getNamespace(): string
7361
{
7462
return $this->namespace;
7563
}
7664

77-
/**
78-
* {@inheritdoc}
79-
*/
80-
public function setNamespace($namespace)
65+
public function setNamespace($namespace): void
8166
{
8267
if (null !== $this->namespace) {
8368
throw new \LogicException('The namespace of the settings model is immutable, instantiate a new object in order to use another namespace.');
@@ -86,66 +71,42 @@ public function setNamespace($namespace)
8671
$this->namespace = $namespace;
8772
}
8873

89-
/**
90-
* {@inheritdoc}
91-
*/
92-
public function getParameters()
74+
public function getParameters(): array
9375
{
9476
return $this->parameters;
9577
}
9678

97-
/**
98-
* {@inheritdoc}
99-
*/
100-
public function setParameters(array $parameters)
79+
public function setParameters(array $parameters): void
10180
{
10281
$this->parameters = $parameters;
10382
}
10483

105-
/**
106-
* {@inheritdoc}
107-
*/
108-
public function offsetExists($offset)
84+
public function offsetExists(mixed $offset): bool
10985
{
11086
return $this->has($offset);
11187
}
11288

113-
/**
114-
* {@inheritdoc}
115-
*/
116-
public function offsetGet($offset)
89+
public function offsetGet(mixed $offset): mixed
11790
{
11891
return $this->get($offset);
11992
}
12093

121-
/**
122-
* {@inheritdoc}
123-
*/
124-
public function offsetSet($offset, $value)
94+
public function offsetSet(mixed $offset, mixed $value): void
12595
{
12696
$this->set($offset, $value);
12797
}
12898

129-
/**
130-
* {@inheritdoc}
131-
*/
132-
public function offsetUnset($offset)
99+
public function offsetUnset(mixed $offset): void
133100
{
134101
$this->remove($offset);
135102
}
136103

137-
/**
138-
* {@inheritdoc}
139-
*/
140-
public function count()
104+
public function count(): int
141105
{
142106
return count($this->parameters);
143107
}
144108

145-
/**
146-
* {@inheritdoc}
147-
*/
148-
public function get($name)
109+
public function get(string $name): mixed
149110
{
150111
if (!$this->has($name)) {
151112
throw new ParameterNotFoundException($name);
@@ -154,26 +115,17 @@ public function get($name)
154115
return $this->parameters[$name];
155116
}
156117

157-
/**
158-
* {@inheritdoc}
159-
*/
160-
public function has($name)
118+
public function has(string $name): bool
161119
{
162120
return array_key_exists($name, $this->parameters);
163121
}
164122

165-
/**
166-
* {@inheritdoc}
167-
*/
168-
public function set($name, $value)
123+
public function set(string $name, mixed $value): void
169124
{
170125
$this->parameters[$name] = $value;
171126
}
172127

173-
/**
174-
* {@inheritdoc}
175-
*/
176-
public function remove($name)
128+
public function remove(string $name): void
177129
{
178130
if (!$this->has($name)) {
179131
throw new ParameterNotFoundException($name);

src/Bundle/Model/SettingsInterface.php

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -19,59 +19,29 @@
1919
*/
2020
interface SettingsInterface extends \ArrayAccess, \Countable //ResourceInterface,
2121
{
22-
/**
23-
* @return string
24-
*/
25-
public function getSchemaAlias();
22+
public function getSchemaAlias(): string;
2623

27-
/**
28-
* @param string $schemaAlias
29-
*/
30-
public function setSchemaAlias($schemaAlias);
24+
public function setSchemaAlias(string $schemaAlias);
3125

32-
/**
33-
* @return string
34-
*/
35-
public function getNamespace();
26+
public function getNamespace(): string;
3627

37-
/**
38-
* @param string $namespace
39-
*/
40-
public function setNamespace($namespace);
28+
public function setNamespace(string $namespace): void;
4129

42-
/**
43-
* @return array
44-
*/
45-
public function getParameters();
30+
public function getParameters(): array;
4631

47-
public function setParameters(array $parameters);
32+
public function setParameters(array $parameters): void;
4833

4934
/**
50-
* @param string $name
51-
*
52-
* @return mixed
53-
*
5435
* @throws ParameterNotFoundException
5536
*/
56-
public function get($name);
37+
public function get(string $name): mixed;
5738

58-
/**
59-
* @param string $name
60-
*
61-
* @return bool
62-
*/
63-
public function has($name);
39+
public function has(string $name): bool;
6440

65-
/**
66-
* @param string $name
67-
* @param mixed $value
68-
*/
69-
public function set($name, $value);
41+
public function set(string $name, mixed $value): void;
7042

7143
/**
72-
* @param string $name
73-
*
7444
* @throws ParameterNotFoundException
7545
*/
76-
public function remove($name);
46+
public function remove(string $name): void;
7747
}

0 commit comments

Comments
 (0)