8000 Ensure all properties have a type · symfony/symfony@fde7b90 · GitHub
[go: up one dir, main page]

Skip to content

Commit fde7b90

Browse files
Ensure all properties have a type
1 parent 1935af6 commit fde7b90

Some content is hidden

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

49 files changed

+102
-76
lines changed

src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTestCase.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\Framework\SkippedTestSuiteError;
1515
use Psr\Cache\CacheItemPoolInterface;
16+
use Relay\Relay;
1617
use Symfony\Component\Cache\Adapter\RedisAdapter;
1718

1819
abstract class AbstractRedisAdapterTestCase extends AdapterTestCase
@@ -23,7 +24,7 @@ abstract class AbstractRedisAdapterTestCase extends AdapterTestCase
2324
'testDefaultLifeTime' => 'Testing expiration slows down the test suite',
2425
];
2526

26-
protected static $redis;
27+
protected static \Redis|Relay|\RedisArray|\RedisCluster|\Predis\ClientInterface $redis;
2728

2829
public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
2930
{

src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function testStoredFile()
148148

149149
class PhpArrayAdapterWrapper extends PhpArrayAdapter
150150
{
151-
protected $data = [];
151+
protected array $data = [];
152152

153153
public function save(CacheItemInterface $item): bool
154154
{

src/Symfony/Component/Console/Cursor.php

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
final class Cursor
2020
{
2121
private OutputInterface $output;
22+
/** @var resource */
2223
private $input;
2324

2425
/**

src/Symfony/Component/Console/Input/Input.php

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
abstract class Input implements InputInterface, StreamableInputInterface
2929
{
3030
protected $definition;
31+
/** @var resource */
3132
protected $stream;
3233
protected $options = [];
3334
protected $arguments = [];

src/Symfony/Component/Console/Output/StreamOutput.php

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
*/
3030
class StreamOutput extends Output
3131
{
32+
/** @var resource */
3233
private $stream;
3334

3435
/**

src/Symfony/Component/Console/Tests/CursorTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
class CursorTest extends TestCase
1919
{
20+
/** @var resource */
2021
protected $stream;
2122

2223
protected function setUp(): void
@@ -26,8 +27,7 @@ protected function setUp(): void
2627

2728
protected function tearDown(): void
2829
{
29-
fclose($this->stream);
30-
$this->stream = null;
30+
unset($this->stream);
3131
}
3232

3333
public function testMoveUpOneLine()

src/Symfony/Component/Console/Tests/Helper/TableTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
class TableTest extends TestCase
2727
{
28+
/** @var resource */
2829
protected $stream;
2930

3031
protected function setUp(): void
@@ -34,8 +35,7 @@ protected function setUp(): void
3435

3536
protected function tearDown(): void
3637
{
37-
fclose($this->stream);
38-
$this->stream = null;
38+
unset($this->stream);
3939
}
4040

4141
/**

src/Symfony/Component/Console/Tests/Output/ConsoleSectionOutputTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
class ConsoleSectionOutputTest extends TestCase
2424
{
25+
/** @var resource */
2526
private $stream;
2627

2728
protected function setUp(): void
@@ -31,7 +32,7 @@ protected function setUp(): void
3132

3233
protected function tearDown(): void
3334
{
34-
$this->stream = null;
35+
unset($this->stream);
3536
}
3637

3738
public function testClearAll()

src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
class StreamOutputTest extends TestCase
1919
{
20+
/** @var resource */
2021
protected $stream;
2122

2223
protected function setUp(): void
@@ -26,7 +27,7 @@ protected function setUp(): void
2627

2728
protected function tearDown(): void
2829
{
29-
$this->stream = null;
30+
unset($this->stream);
3031
}
3132

3233
public function testConstructor()

src/Symfony/Component/Form/Console/Descriptor/Descriptor.php

+8-10
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,14 @@
2929
*/
3030
abstract class Descriptor implements DescriptorInterface
3131
{
32-
/** @var OutputStyle */
33-
protected $output;
34-
protected $type;
35-
protected $ownOptions = [];
36-
protected $overriddenOptions = [];
37-
protected $parentOptions = [];
38-
protected $extensionOptions = [];
39-
protected $requiredOptions = [];
40-
protected $parents = [];
41-
protected $extensions = [];
32+
protected OutputStyle $output;
33+
protected array $ownOptions = [];
34+
protected array $overriddenOptions = [];
35+
protected array $parentOptions = [];
36+
protected array $extensionOptions = [];
37+
protected array $requiredOptions = [];
38+
protected array $parents = [];
39+
protected array $extensions = [];
4240

4341
public function describe(OutputInterface $output, ?object $object, array $options = []): void
4442
{

src/Symfony/Component/Form/Tests/AbstractRequestHandlerTestCase.php

-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ abstract class AbstractRequestHandlerTestCase extends TestCase
3131
{
3232
protected RequestHandlerInterface $requestHandler;
3333
protected FormFactory $factory;
34-
protected $request;
3534
protected ServerParams $serverParams;
3635

3736
protected function setUp(): void
@@ -53,7 +52,6 @@ public function getNormalizedIniPostMaxSize(): string
5352

5453
$this->requestHandler = $this->getRequestHandler();
5554
$this->factory = Forms::createFormFactoryBuilder()->getFormFactory();
56-
$this->request = null;
5755
}
5856

5957
public static function methodExceptGetProvider()

src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
*/
2323
class HttpFoundationRequestHandlerTest extends AbstractRequestHandlerTestCase
2424
{
25+
protected Request $request;
26+
2527
public function testRequestShouldNotBeNull()
2628
{
2729
$this->expectException(UnexpectedTypeException::class);

src/Symfony/Component/HttpClient/Internal/AmpClientState.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,16 @@ private function getClient(array $options): array
145145
$options['crypto_method'] && $context = $context->withMinimumVersion($options['crypto_method']);
146146

147147
$connector = $handleConnector = new class() implements Connector {
148-
public $connector;
149-
public $uri;
148+
public DnsConnector $connector;
149+
public string $uri;
150+
/** @var resource|null */
150151
public $handle;
151152

152153
public function connect(string $uri, ConnectContext $context = null, CancellationToken $token = null): Promise
153154
{
154155
$result = $this->connector->connect($this->uri ?? $uri, $context, $token);
155156
$result->onResolve(function ($e, $socket) {
156-
$this->handle = null !== $socket ? $socket->getResource() : false;
157+
$this->handle = $socket?->getResource();
157158
});
158159

159160
return $result;

src/Symfony/Component/HttpClient/Internal/AmpListener.php

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class AmpListener implements EventListener
2828
private array $info;
2929
private array $pinSha256;
3030
private \Closure $onProgress;
31+
/** @var resource|null */
3132
private $handle;
3233

3334
public function __construct(array &$info, array $pinSha256, \Closure $onProgress, &$handle)

src/Symfony/Component/HttpClient/Response/AsyncContext.php

+2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
*/
2626
final class AsyncContext
2727
{
28+
/** @var callable|null */
2829
private $passthru;
2930
private HttpClientInterface $client;
3031
private ResponseInterface $response;
3132
private array $info = [];
33+
/** @var resource|null */
3234
private $content;
3335
private int $offset;
3436

src/Symfony/Component/HttpClient/Response/AsyncResponse.php

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class AsyncResponse implements ResponseInterface, StreamableInterface
3737
private ?HttpClientInterface $client;
3838
private ResponseInterface $response;
3939
private array $info = ['canceled' => false];
40+
/** @var callable|null */
4041
private $passthru;
4142
private ?\Iterator $stream = null;
4243
private ?int $yieldedState = null;

src/Symfony/Component/HttpClient/Response/CommonResponseTrait.php

+2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ trait CommonResponseTrait
3030
* @var callable|null A callback that tells whether we're waiting for response headers
3131
*/
3232
private $initializer;
33+
/** @var bool|\Closure|resource|null */
3334
private $shouldBuffer;
35+
/** @var resource|null */
3436
private $content;
3537
private int $offset = 0;
3638
private ?array $jsonData = null;

src/Symfony/Component/HttpClient/Response/NativeResponse.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ final class NativeResponse implements ResponseInterface, StreamableInterface
3434
*/
3535
private $context;
3636
private string $url;
37-
private $resolver;
38-
private $onProgress;
37+
private \Closure $resolver;
38+
private ?\Closure $onProgress;
3939
private ?int $remaining = null;
4040

4141
/**
@@ -58,8 +58,8 @@ public function __construct(NativeClientState $multi, $context, string $url, arr
5858
$this->logger = $logger;
5959
$this->timeout = $options['timeout'];
6060
$this->info = &$info;
61-
$this->resolver = $resolver;
62-
$this->onProgress = $onProgress;
61+
$this->resolver = $resolver(...);
62+
$this->onProgress = $onProgress ? $onProgress(...) : null;
6363
$this->inflate = !isset($options['normalized_headers']['accept-encoding']);
6464
$this->shouldBuffer = $options['buffer'] ?? true;
6565

@@ -177,7 +177,7 @@ private function open(): void
177177
}
178178

179179
stream_set_blocking($h, false);
180-
$this->context = $this->resolver = null;
180+
unset($this->context, $this->resolver);
181181

182182
// Create dechunk buffers
183183
if (isset($this->headers['content-length'])) {

src/Symfony/Component/HttpClient/Response/TransportResponseTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ trait TransportResponseTrait
3838
'canceled' => false,
3939
];
4040

41-
/** @var object|resource */
41+
/** @var object|resource|null */
4242
private $handle;
4343
private int|string $id;
4444
private ?float $timeout = 0;

src/Symfony/Component/HttpFoundation/Tests/ResponseFunctionalTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
class ResponseFunctionalTest extends TestCase
1818
{
19+
/** @var resource|false */
1920
private static $server;
2021

2122
public static function setUpBeforeClass(): void

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
class AbstractSessionHandlerTest extends TestCase
1818
{
19+
/** @var resource|false */
1920
private static $server;
2021

2122
public static function setUpBeforeClass(): void

src/Symfony/Component/HttpKernel/Tests/HttpCache/SubRequestHandlerTest.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,9 @@ private function getGlobalState(): array
142142

143143
class TestSubRequestHandlerKernel implements HttpKernelInterface
144144
{
145-
private $assertCallback;
146-
147-
public function __construct(\Closure $assertCallback)
148-
{
149-
$this->assertCallback = $assertCallback;
145+
public function __construct(
146+
private \Closure $assertCallback,
147+
) {
150148
}
151149

152150
public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = true): Response

src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php

+3
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@
2424
*/
2525
abstract class AbstractStream
2626
{
27+
/** @var resource|null */
2728
protected $stream;
29+
/** @var resource|null */
2830
protected $in;
31+
/** @var resource|null */
2932
protected $out;
3033

3134
private string $debug = '';

src/Symfony/Component/Messenger/Tests/Middleware/HandleMessageMiddlewareTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ private function process(array $jobs): void
261261
public function testBatchHandlerNoBatch()
262262
{
263263
$handler = new class() implements BatchHandlerInterface {
264-
public $processedMessages;
264+
public array $processedMessages;
265265

266266
use BatchHandlerTrait;
267267

src/Symfony/Component/Mime/Part/AbstractPart.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
abstract class AbstractPart
2020
{
21-
private $headers;
21+
private Headers $headers;
2222

2323
public function __construct()
2424
{

src/Symfony/Component/Mime/Part/TextPart.php

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class TextPart extends AbstractPart
2828

2929
private static array $encoders = [];
3030

31+
/** @var resource|string|File */
3132
private $body;
3233
private ?string $charset;
3334
private string $subtype;

src/Symfony/Component/Process/Pipes/AbstractPipes.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,18 @@ abstract class AbstractPipes implements PipesInterface
2323
public array $pipes = [];
2424

2525
private string $inputBuffer = '';
26+
/** @var resource|string|\Iterator */
2627
private $input;
2728
private bool $blocked = true;
2829
private ?string $lastError = null;
2930

3031
/**
31-
* @param resource|string|int|float|bool|\Iterator|null $input
32+
* @param resource|string|\Iterator $input
3233
*/
33-
public function __construct(mixed $input)
34+
public function __construct($input)
3435
{
3536
if (\is_resource($input) || $input instanceof \Iterator) {
3637
$this->input = $input;
37-
} elseif (\is_string($input)) {
38-
$this->inputBuffer = $input;
3938
} else {
4039
$this->inputBuffer = (string) $input;
4140
}

0 commit comments

Comments
 (0)
0