Skip to content

Commit 5188230

Browse files
Add return types everywhere possible
1 parent 9004e35 commit 5188230

File tree

838 files changed

+2910
-2960
lines changed

Some content is hidden

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

838 files changed

+2910
-2960
lines changed

src/Symfony/Bridge/Doctrine/Form/DoctrineOrmExtension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Form;
1313

14+
use Symfony\Component\Form\FormTypeGuesserInterface;
15+
use Symfony\Component\Form\FormTypeInterface;
1416
use Doctrine\Persistence\ManagerRegistry;
1517
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
1618
use Symfony\Component\Form\AbstractExtension;

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection;
1313

14+
use Symfony\Component\Config\Definition\ConfigurationInterface;
1415
use Doctrine\Common\Annotations\AnnotationRegistry;
1516
use Doctrine\Common\Annotations\Reader;
1617
use Http\Client\HttpClient;

src/Symfony/Component/BrowserKit/AbstractBrowser.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function followMetaRefresh(bool $followMetaRefresh = true)
7878
*
7979
* @return bool
8080
*/
81-
public function isFollowingRedirects()
81+
public function isFollowingRedirects(): bool
8282
{
8383
return $this->followRedirects;
8484
}
@@ -97,7 +97,7 @@ public function setMaxRedirects(int $maxRedirects)
9797
*
9898
* @return int
9999
*/
100-
public function getMaxRedirects()
100+
public function getMaxRedirects(): int
101101
{
102102
return $this->maxRedirects;
103103
}
@@ -139,7 +139,7 @@ public function setServerParameter(string $key, string $value)
139139
*
140140
* @return mixed
141141
*/
142-
public function getServerParameter(string $key, mixed $default = '')
142+
public function getServerParameter(string $key, mixed $default = ''): mixed
143143
{
144144
return $this->server[$key] ?? $default;
145145
}
@@ -178,7 +178,7 @@ public function jsonRequest(string $method, string $uri, array $parameters = [],
178178
*
179179
* @return History
180180
*/
181-
public function getHistory()
181+
public function getHistory(): History
182182
{
183183
return $this->history;
184184
}
@@ -188,7 +188,7 @@ public function getHistory()
188188
*
189189
* @return CookieJar
190190
*/
191-
public function getCookieJar()
191+
public function getCookieJar(): CookieJar
192192
{
193193
return $this->cookieJar;
194194
}
@@ -198,7 +198,7 @@ public function getCookieJar()
198198
*
199199
* @return Crawler
200200
*/
201-
public function getCrawler()
201+
public function getCrawler(): Crawler
202202
{
203203
if (null === $this->crawler) {
204204
throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));
@@ -212,7 +212,7 @@ public function getCrawler()
212212
*
213213
* @return Response
214214
*/
215-
public function getInternalResponse()
215+
public function getInternalResponse(): Response
216216
{
217217
if (null === $this->internalResponse) {
218218
throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));
@@ -231,7 +231,7 @@ public function getInternalResponse()
231231
*
232232
* @see doRequest()
233233
*/
234-
public function getResponse()
234+
public function getResponse(): object
235235
{
236236
if (null === $this->response) {
237237
throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));
@@ -245,7 +245,7 @@ public function getResponse()
245245
*
246246
* @return Request
247247
*/
248-
public function getInternalRequest()
248+
public function getInternalRequest(): Request
249249
{
250250
if (null === $this->internalRequest) {
251251
throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));
@@ -264,7 +264,7 @@ public function getInternalRequest()
264264
*
265265
* @see doRequest()
266266
*/
267-
public function getRequest()
267+
public function getRequest(): object
268268
{
269269
if (null === $this->request) {
270270
throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));
@@ -278,7 +278,7 @@ public function getRequest()
278278
*
279279
* @return Crawler
280280
*/
281-
public function click(Link $link)
281+
public function click(Link $link): Crawler
282282
{
283283
if ($link instanceof Form) {
284284
return $this->submit($link);
@@ -309,7 +309,7 @@ public function clickLink(string $linkText): Crawler
309309
*
310310
* @return Crawler
311311
*/
312-
public function submit(Form $form, array $values = [], array $serverParameters = [])
312+
public function submit(Form $form, array $values = [], array $serverParameters = []): Crawler
313313
{
314314
$form->setValues($values);
315315

@@ -350,7 +350,7 @@ public function submitForm(string $button, array $fieldValues = [], string $meth
350350
*
351351
* @return Crawler
352352
*/
353-
public function request(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null, bool $changeHistory = true)
353+
public function request(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null, bool $changeHistory = true): Crawler
354354
{
355355
if ($this->isMainRequest) {
356356
$this->redirectCount = 0;
@@ -433,7 +433,7 @@ public function request(string $method, string $uri, array $parameters = [], arr
433433
*
434434
* @throws \RuntimeException When processing returns exit code
435435
*/
436-
protected function doRequestInProcess(object $request)
436+
protected function doRequestInProcess(object $request): object
437437
{
438438
$deprecationsFile = tempnam(sys_get_temp_dir(), 'deprec');
439439
putenv('SYMFONY_DEPRECATIONS_SERIALIZE='.$deprecationsFile);
@@ -466,7 +466,7 @@ protected function doRequestInProcess(object $request)
466466
*
467467
* @return object
468468
*/
469-
abstract protected function doRequest(object $request);
469+
abstract protected function doRequest(object $request): object;
470470

471471
/**
472472
* Returns the script to execute when the request must be insulated.
@@ -485,7 +485,7 @@ protected function getScript(object $request)
485485
*
486486
* @return object
487487
*/
488-
protected function filterRequest(Request $request)
488+
protected function filterRequest(Request $request): object
489489
{
490490
return $request;
491491
}
@@ -495,7 +495,7 @@ protected function filterRequest(Request $request)
495495
*
496496
* @return Response
497497
*/
498-
protected function filterResponse(object $response)
498+
protected function filterResponse(object $response): Response
499499
{
500500
return $response;
501501
}
@@ -507,7 +507,7 @@ protected function filterResponse(object $response)
507507
*
508508
* @return Crawler|null
509509
*/
510-
protected function createCrawlerFromContent(string $uri, string $content, string $type)
510+
protected function createCrawlerFromContent(string $uri, string $content, string $type): ?Crawler
511511
{
512512
if (!class_exists(Crawler::class)) {
513513
return null;
@@ -524,7 +524,7 @@ protected function createCrawlerFromContent(string $uri, string $content, string
524524
*
525525
* @return Crawler
526526
*/
527-
public function back()
527+
public function back(): Crawler
528528
{
529529
do {
530530
$request = $this->history->back();
@@ -538,7 +538,7 @@ public function back()
538538
*
539539
* @return Crawler
540540
*/
541-
public function forward()
541+
public function forward(): Crawler
542542
{
543543
do {
544544
$request = $this->history->forward();
@@ -552,7 +552,7 @@ public function forward()
552552
*
553553
* @return Crawler
554554
*/
555-
public function reload()
555+
public function reload(): Crawler
556556
{
557557
return $this->requestFromRequest($this->history->current(), false);
558558
}
@@ -564,7 +564,7 @@ public function reload()
564564
*
565565
* @throws \LogicException If request was not a redirect
566566
*/
567-
public function followRedirect()
567+
public function followRedirect(): Crawler
568568
{
569569
if (empty($this->redirect)) {
570570
throw new \LogicException('The request was not redirected.');
@@ -639,7 +639,7 @@ public function restart()
639639
*
640640
* @return string An absolute URI
641641
*/
642-
protected function getAbsoluteUri(string $uri)
642+
protected function getAbsoluteUri(string $uri): string
643643
{
644644
// already absolute?
645645
if (0 === strpos($uri, 'http://') || 0 === strpos($uri, 'https://')) {
@@ -685,7 +685,7 @@ protected function getAbsoluteUri(string $uri)
685685
*
686686
* @return Crawler
687687
*/
688-
protected function requestFromRequest(Request $request, bool $changeHistory = true)
688+
protected function requestFromRequest(Request $request, bool $changeHistory = true): Crawler
689689
{
690690
return $this->request($request->getMethod(), $request->getUri(), $request->getParameters(), $request->getFiles(), $request->getServer(), $request->getContent(), $changeHistory);
691691
}

src/Symfony/Component/BrowserKit/Cookie.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function __toString(): string
123123
*
124124
* @throws \InvalidArgumentException
125125
*/
126-
public static function fromString(string $cookie, string $url = null)
126+
public static function fromString(string $cookie, string $url = null): static
127127
{
128128
$parts = explode(';', $cookie);
129129

@@ -222,7 +222,7 @@ private static function parseDate(string $dateValue): ?string
222222
*
223223
* @return string The cookie name
224224
*/
225-
public function getName()
225+
public function getName(): string
226226
{
227227
return $this->name;
228228
}
@@ -232,7 +232,7 @@ public function getName()
232232
*
233233
* @return string The cookie value
234234
*/
235-
public function getValue()
235+
public function getValue(): string
236236
{
237237
return $this->value;
238238
}
@@ -242,7 +242,7 @@ public function getValue()
242242
*
243243
* @return string The cookie value
244244
*/
245-
public function getRawValue()
245+
public function getRawValue(): string
246246
{
247247
return $this->rawValue;
248248
}
@@ -252,7 +252,7 @@ public function getRawValue()
252252
*
253253
* @return string|null The cookie expires time
254254
*/
255-
public function getExpiresTime()
255+
public function getExpiresTime(): ?string
256256
{
257257
return $this->expires;
258258
}
@@ -262,7 +262,7 @@ public function getExpiresTime()
262262
*
263263
* @return string The cookie path
264264
*/
265-
public function getPath()
265+
public function getPath(): string
266266
{
267267
return $this->path;
268268
}
@@ -272,7 +272,7 @@ public function getPath()
272272
*
273273
* @return string The cookie domain
274274
*/
275-
public function getDomain()
275+
public function getDomain(): string
276276
{
277277
return $this->domain;
278278
}
@@ -282,7 +282,7 @@ public function getDomain()
282282
*
283283
* @return bool The cookie secure flag
284284
*/
285-
public function isSecure()
285+
public function isSecure(): bool
286286
{
287287
return $this->secure;
288288
}
@@ -292,7 +292,7 @@ public function isSecure()
292292
*
293293
* @return bool The cookie httponly flag
294294
*/
295-
public function isHttpOnly()
295+
public function isHttpOnly(): bool
296296
{
297297
return $this->httponly;
298298
}
@@ -302,7 +302,7 @@ public function isHttpOnly()
302302
*
303303
* @return bool true if the cookie has expired, false otherwise
304304
*/
305-
public function isExpired()
305+
public function isExpired(): bool
306306
{
307307
return null !== $this->expires && 0 != $this->expires && $this->expires <= time();
308308
}

src/Symfony/Component/BrowserKit/CookieJar.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function set(Cookie $cookie)
3535
*
3636
* @return Cookie|null
3737
*/
38-
public function get(string $name, string $path = '/', string $domain = null)
38+
public function get(string $name, string $path = '/', string $domain = null): ?Cookie
3939
{
4040
$this->flushExpiredCookies();
4141

@@ -143,7 +143,7 @@ public function updateFromResponse(Response $response, string $uri = null)
143143
*
144144
* @return Cookie[] An array of cookies
145145
*/
146-
public function all()
146+
public function all(): array
147147
{
148148
$this->flushExpiredCookies();
149149

@@ -164,7 +164,7 @@ public function all()
164164
*
165165
* @return array An array of cookie values
166166
*/
167-
public function allValues(string $uri, bool $returnsRawValue = false)
167+
public function allValues(string $uri, bool $returnsRawValue = false): array
168168
{
169169
$this->flushExpiredCookies();
170170

@@ -201,7 +201,7 @@ public function allValues(string $uri, bool $returnsRawValue = false)
201201
*
202202
* @return array An array of cookie values
203203
*/
204-
public function allRawValues(string $uri)
204+
public function allRawValues(string $uri): array
205205
{
206206
return $this->allValues($uri, true);
207207
}

src/Symfony/Component/BrowserKit/History.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function add(Request $request)
4545
*
4646
* @return bool true if the history is empty, false otherwise
4747
*/
48-
public function isEmpty()
48+
public function isEmpty(): bool
4949
{
5050
return 0 == \count($this->stack);
5151
}
@@ -57,7 +57,7 @@ public function isEmpty()
5757
*
5858
* @throws \LogicException if the stack is already on the first page
5959
*/
60-
public function back()
60+
public function back(): Request
6161
{
6262
if ($this->position < 1) {
6363
throw new \LogicException('You are already on the first page.');
@@ -73,7 +73,7 @@ public function back()
7373
*
7474
* @throws \LogicException if the stack is already on the last page
7575
*/
76-
public function forward()
76+
public function forward(): Request
7777
{
7878
if ($this->position > \count($this->stack) - 2) {
7979
throw new \LogicException('You are already on the last page.');
@@ -89,7 +89,7 @@ public function forward()
8989
*
9090
* @throws \LogicException if the stack is empty
9191
*/
92-
public function current()
92+
public function current(): Request
9393
{
9494
if (-1 == $this->position) {
9595
throw new \LogicException('The page history is empty.');

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy