Skip to content

Commit fd7c527

Browse files
phansysfranmomu
authored andcommitted
Add type declarations in private functions
1 parent 4d93e09 commit fd7c527

File tree

83 files changed

+157
-226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+157
-226
lines changed

src/Loggable/Document/Repository/LogEntryRepository.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,8 @@ protected function fillDocument($document, array $data)
140140
* Get the currently used LoggableListener
141141
*
142142
* @throws \Gedmo\Exception\RuntimeException if listener is not found
143-
*
144-
* @return LoggableListener
145143
*/
146-
private function getLoggableListener()
144+
private function getLoggableListener(): LoggableListener
147145
{
148146
if (null === $this->listener) {
149147
foreach ($this->dm->getEventManager()->getListeners() as $event => $listeners) {

src/Loggable/Entity/Repository/LogEntryRepository.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,8 @@ protected function mapValue(ClassMetadata $objectMeta, $field, &$value)
141141
* Get the currently used LoggableListener
142142
*
143143
* @throws \Gedmo\Exception\RuntimeException if listener is not found
144-
*
145-
* @return LoggableListener
146144
*/
147-
private function getLoggableListener()
145+
private function getLoggableListener(): LoggableListener
148146
{
149147
if (null === $this->listener) {
150148
foreach ($this->_em->getEventManager()->getListeners() as $event => $listeners) {

src/Loggable/Mapping/Driver/Annotation.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,8 @@ protected function isClassAnnotationInValid(ClassMetadata $meta, array &$config)
120120

121121
/**
122122
* Searches properties of embedded object for versioned fields
123-
*
124-
* @param string $field
125123
*/
126-
private function inspectEmbeddedForVersioned($field, array &$config, \Doctrine\ORM\Mapping\ClassMetadata $meta)
124+
private function inspectEmbeddedForVersioned(string $field, array &$config, \Doctrine\ORM\Mapping\ClassMetadata $meta): void
127125
{
128126
$class = new \ReflectionClass($meta->embeddedClasses[$field]['class']);
129127

src/Loggable/Mapping/Driver/Xml.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace Gedmo\Loggable\Mapping\Driver;
1111

12+
use Doctrine\Persistence\Mapping\ClassMetadata;
1213
use Gedmo\Exception\InvalidMappingException;
1314
use Gedmo\Mapping\Driver\Xml as BaseXml;
1415

@@ -85,10 +86,8 @@ public function readExtendedMetadata($meta, array &$config)
8586

8687
/**
8788
* Searches mappings on element for versioned fields
88-
*
89-
* @param object $meta
9089
*/
91-
private function inspectElementForVersioned(\SimpleXMLElement $element, array &$config, $meta)
90+
private function inspectElementForVersioned(\SimpleXMLElement $element, array &$config, ClassMetadata $meta): void
9291
{
9392
foreach ($element as $mapping) {
9493
$mappingDoctrine = $mapping;

src/Loggable/Mapping/Driver/Yaml.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,7 @@ protected function _loadMappingFile($file)
140140
return \Symfony\Component\Yaml\Yaml::parse(file_get_contents($file));
141141
}
142142

143-
/**
144-
* @param string $field
145-
*/
146-
private function inspectEmbeddedForVersioned($field, array $mapping, array &$config)
143+
private function inspectEmbeddedForVersioned(string $field, array $mapping, array &$config): void
147144
{
148145
if (isset($mapping['fields'])) {
149146
foreach ($mapping['fields'] as $property => $fieldMapping) {

src/Mapping/MappedEventSubscriber.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ abstract class MappedEventSubscriber implements EventSubscriber
7474
private $annotationReader;
7575

7676
/**
77-
* @var \Doctrine\Common\Annotations\AnnotationReader
77+
* @var AnnotationReader
7878
*/
7979
private static $defaultAnnotationReader;
8080

@@ -245,10 +245,8 @@ protected function setFieldValue(AdapterInterface $adapter, $object, $field, $ol
245245

246246
/**
247247
* Create default annotation reader for extensions
248-
*
249-
* @return \Doctrine\Common\Annotations\AnnotationReader
250248
*/
251-
private function getDefaultAnnotationReader()
249+
private function getDefaultAnnotationReader(): Reader
252250
{
253251
if (null === self::$defaultAnnotationReader) {
254252
AnnotationRegistry::registerAutoloadNamespace('Gedmo\\Mapping\\Annotation', __DIR__.'/../../');

src/References/LazyCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ public function count()
238238
return $this->results->count();
239239
}
240240

241-
private function initialize()
241+
private function initialize(): void
242242
{
243243
if (null === $this->results) {
244244
$this->results = call_user_func($this->callback);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function extractIdentifier($om, $object, $single = true)
9696
/**
9797
* Override so we don't get an exception. We want to allow this.
9898
*/
99-
private function throwIfNotEntityManager(EntityManagerInterface $em)
99+
private function throwIfNotEntityManager(EntityManagerInterface $em): void
100100
{
101101
}
102102
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function extractIdentifier($om, $object, $single = true)
110110
/**
111111
* Override so we don't get an exception. We want to allow this.
112112
*/
113-
private function throwIfNotDocumentManager($dm)
113+
private function throwIfNotDocumentManager($dm): void
114114
{
115115
if (!($dm instanceof MongoDocumentManager) && !($dm instanceof PhpcrDocumentManager)) {
116116
throw new InvalidArgumentException(sprintf('Expected a %s or %s instance but got "%s"', MongoDocumentManager::class, 'Doctrine\ODM\PHPCR\DocumentManager', is_object($dm) ? get_class($dm) : gettype($dm)));

src/References/ReferencesListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ protected function getNamespace()
183183
return __NAMESPACE__;
184184
}
185185

186-
private function updateReferences(EventArgs $eventArgs)
186+
private function updateReferences(EventArgs $eventArgs): void
187187
{
188188
$ea = $this->getEventAdapter($eventArgs);
189189
$om = $ea->getObjectManager();

0 commit comments

Comments
 (0)