Skip to content

Commit 300b306

Browse files
committed
Fix some type hints
1 parent fabe2fc commit 300b306

File tree

22 files changed

+103
-77
lines changed

22 files changed

+103
-77
lines changed

src/Loggable/Document/MappedSuperclass/AbstractLogEntry.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ abstract class AbstractLogEntry
6969
protected $version;
7070

7171
/**
72-
* @var string
72+
* @var array<string, mixed>|null
7373
*
7474
* @MongoODM\Field(type="hash", nullable=true)
7575
*/
@@ -195,7 +195,7 @@ public function setLoggedAt()
195195
/**
196196
* Get data
197197
*
198-
* @return array or null
198+
* @return array<string, mixed>|null
199199
*/
200200
public function getData()
201201
{
@@ -205,7 +205,7 @@ public function getData()
205205
/**
206206
* Set data
207207
*
208-
* @param array $data
208+
* @param array<string, mixed> $data
209209
*/
210210
public function setData($data)
211211
{

src/Loggable/LoggableListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ protected function createLogEntry($action, $object, LoggableAdapter $ea)
267267

268268
// Filter embedded documents
269269
if (isset($meta->isEmbeddedDocument) && $meta->isEmbeddedDocument) {
270-
return;
270+
return null;
271271
}
272272

273273
if ($config = $this->getConfiguration($om, $meta->getName())) {

src/Mapping/Annotation/Tree.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class Tree extends Annotation
2424
/** @var string */
2525
public $type = 'nested';
2626

27-
/** @var string */
27+
/** @var bool */
2828
public $activateLocking = false;
2929

3030
/** @var int */

src/Mapping/Annotation/Uploadable.php

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,48 @@
2323
*/
2424
final class Uploadable extends Annotation
2525
{
26-
/** @var bool */
26+
/**
27+
* @var bool
28+
*/
2729
public $allowOverwrite = false;
2830

29-
/** @var bool */
31+
/**
32+
* @var bool
33+
*/
3034
public $appendNumber = false;
3135

32-
/** @var string */
36+
/**
37+
* @var string
38+
*/
3339
public $path = '';
3440

35-
/** @var string */
41+
/**
42+
* @var string
43+
*/
3644
public $pathMethod = '';
3745

38-
/** @var string */
46+
/**
47+
* @var string
48+
*/
3949
public $callback = '';
4050

41-
/** @var string */
51+
/**
52+
* @var string
53+
*/
4254
public $filenameGenerator = Validator::FILENAME_GENERATOR_NONE;
4355

44-
/** @var float */
56+
/**
57+
* @var float
58+
*/
4559
public $maxSize = 0;
4660

47-
/** @var array */
61+
/**
62+
* @var string A list of comma separate values of allowed types, like "text/plain,text/css"
63+
*/
4864
public $allowedTypes = '';
4965

50-
/** @var array */
66+
/**
67+
* @var string A list of comma separate values of disallowed types, like "video/jpeg,text/html"
68+
*/
5169
public $disallowedTypes = '';
5270
}

src/Mapping/Driver/Xml.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected function _getBooleanAttribute(SimpleXmlElement $node, $attributeName)
7575
*
7676
* @param string $attributeName
7777
*
78-
* @return string
78+
* @return bool
7979
*/
8080
protected function _isAttributeSet(SimpleXmlElement $node, $attributeName)
8181
{

src/Mapping/ExtensionMetadataFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function __construct(ObjectManager $objectManager, $extensionNamespace, $
8383
public function getExtensionMetadata($meta)
8484
{
8585
if ($meta->isMappedSuperclass) {
86-
return; // ignore mappedSuperclasses for now
86+
return []; // ignore mappedSuperclasses for now
8787
}
8888
$config = [];
8989
$cmf = $this->objectManager->getMetadataFactory();

src/Mapping/MappedEventSubscriber.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ abstract class MappedEventSubscriber implements EventSubscriber
5555
* ExtensionMetadataFactory used to read the extension
5656
* metadata through the extension drivers
5757
*
58-
* @var ExtensionMetadataFactory
58+
* @var array<int, ExtensionMetadataFactory>
5959
*/
6060
private $extensionMetadataFactory = [];
6161

6262
/**
6363
* List of event adapters used for this listener
6464
*
65-
* @var array
65+
* @var array<string, AdapterInterface>
6666
*/
6767
private $adapters = [];
6868

@@ -181,9 +181,9 @@ public function loadMetadataForObjectClass(ObjectManager $objectManager, $metada
181181
$config = $factory->getExtensionMetadata($metadata);
182182
} catch (\ReflectionException $e) {
183183
// entity\document generator is running
184-
$config = false; // will not store a cached version, to remap later
184+
$config = []; // will not store a cached version, to remap later
185185
}
186-
if ($config) {
186+
if ([] !== $config) {
187187
self::$configurations[$this->name][$metadata->getName()] = $config;
188188
}
189189
}

src/References/LazyCollection.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function clear()
3939
{
4040
$this->initialize();
4141

42-
return $this->results->clear();
42+
$this->results->clear();
4343
}
4444

4545
public function contains($element)
@@ -179,7 +179,7 @@ public function set($key, $value)
179179
{
180180
$this->initialize();
181181

182-
return $this->results->set($key, $value);
182+
$this->results->set($key, $value);
183183
}
184184

185185
public function slice($offset, $length = null)
@@ -214,14 +214,14 @@ public function offsetSet($offset, $value)
214214
{
215215
$this->initialize();
216216

217-
return $this->results->offsetSet($offset, $value);
217+
$this->results->offsetSet($offset, $value);
218218
}
219219

220220
public function offsetUnset($offset)
221221
{
222222
$this->initialize();
223223

224-
return $this->results->offsetUnset($offset);
224+
$this->results->offsetUnset($offset);
225225
}
226226

227227
public function getIterator()

src/References/Mapping/Event/Adapter/ORM.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ public function getIdentifier($om, $object, $single = true)
6262

6363
return [$meta->getIdentifier()[0] => $id];
6464
}
65+
66+
return null;
6567
}
6668

6769
/**

src/References/Mapping/Event/ReferencesAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function getSingleReference($om, $class, $identifier);
5050
* @param object $object
5151
* @param bool $single
5252
*
53-
* @return array|string|int array or single identifier
53+
* @return array|string|int|null array or single identifier
5454
*/
5555
public function extractIdentifier($om, $object, $single = true);
5656
}

0 commit comments

Comments
 (0)