Skip to content

Commit 4e3390a

Browse files
minor #50821 Add missing return types and enforce return types on all methods (wouterj)
This PR was squashed before being merged into the 6.4 branch. Discussion ---------- Add missing return types and enforce return types on all methods | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | - | License | MIT | Doc PR | - In 6.3, we enforced return types on all interface methods. We're missing just a handful return types on non-interface methods (all fixed in this PR). As you can see, the added return types are either data collectors or methods introduced by 6.3 features. In my opinion, we should start to enforce return types on all methods from 6.4 (either as PHPdoc - for `resource` and to avoid BC breaks - or PHP native declaration). Commits ------- 189c3c8fa1 Add missing return types and enforce return types on all methods
2 parents 3316035 + 4c5b17f commit 4e3390a

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

DataCollector/DoctrineDataCollector.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,17 @@ public function reset()
113113
}
114114
}
115115

116+
/**
117+
* @return array
118+
*/
116119
public function getManagers()
117120
{
118121
return $this->data['managers'];
119122
}
120123

124+
/**
125+
* @return array
126+
*/
121127
public function getConnections()
122128
{
123129
return $this->data['connections'];
@@ -131,11 +137,17 @@ public function getQueryCount()
131137
return array_sum(array_map('count', $this->data['queries']));
132138
}
133139

140+
/**
141+
* @return array
142+
*/
134143
public function getQueries()
135144
{
136145
return $this->data['queries'];
137146
}
138147

148+
/**
149+
* @return int
150+
*/
139151
public function getTime()
140152
{
141153
$time = 0;

DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ public function __construct(string $connectionsParameter, string $managerTemplat
5353
$this->tagPrefix = $tagPrefix;
5454
}
5555

56+
/**
57+
* @return void
58+
*/
5659
public function process(ContainerBuilder $container)
5760
{
5861
if (!$container->hasParameter($this->connectionsParameter)) {

Form/DoctrineOrmTypeGuesser.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bridge\Doctrine\Form;
1313

1414
use Doctrine\DBAL\Types\Types;
15+
use Doctrine\ORM\Mapping\ClassMetadata;
1516
use Doctrine\ORM\Mapping\ClassMetadataInfo;
1617
use Doctrine\ORM\Mapping\MappingException as LegacyMappingException;
1718
use Doctrine\Persistence\ManagerRegistry;
@@ -151,6 +152,13 @@ public function guessPattern(string $class, string $property): ?ValueGuess
151152
return null;
152153
}
153154

155+
/**
156+
* @template T of object
157+
*
158+
* @param class-string<T> $class
159+
*
160+
* @return array{0:ClassMetadata<T>, 1:string}|null
161+
*/
154162
protected function getMetadata(string $class)
155163
{
156164
// normalize class name

0 commit comments

Comments
 (0)