Skip to content

Commit

Permalink
minor symfony#33519 Add types to constructors and private/final/inter…
Browse files Browse the repository at this point in the history
…nal methods (Batch I) (derrabus)

This PR was squashed before being merged into the 4.4 branch (closes symfony#33519).

Discussion
----------

Add types to constructors and private/final/internal methods (Batch I)

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#32179, symfony#33228
| License       | MIT
| Doc PR        | N/A

As promised, now a larger batch with the following components:
* Asset
* BrowserKit
* Config
* Console
* ~~CssSelector~~
* Debug
* ~~DomCrawler~~
* DotEnv
* ErrorHandler
* ErrorRenderer
* ExpressionLanguage
* ~~Filesystem~~
* ~~Finder~~

Commits
-------

4039b95 Add types to constructors and private/final/internal methods (Batch I)
  • Loading branch information
fabpot committed Sep 27, 2019
2 parents 372a695 + e2961fa commit a4db89f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Tests/DebugClassLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function testClassAlias()
/**
* @dataProvider provideDeprecatedSuper
*/
public function testDeprecatedSuper($class, $super, $type)
public function testDeprecatedSuper(string $class, string $super, string $type)
{
set_error_handler(function () { return false; });
$e = error_reporting(0);
Expand All @@ -140,7 +140,7 @@ class_exists('Test\\'.__NAMESPACE__.'\\'.$class, true);
$this->assertSame($xError, $lastError);
}

public function provideDeprecatedSuper()
public function provideDeprecatedSuper(): array
{
return [
['DeprecatedInterfaceClass', 'DeprecatedInterface', 'implements'],
Expand Down
4 changes: 2 additions & 2 deletions Tests/ErrorHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ public function testSendPhpResponse()
/**
* @dataProvider errorHandlerWhenLoggingProvider
*/
public function testErrorHandlerWhenLogging($previousHandlerWasDefined, $loggerSetsAnotherHandler, $nextHandlerIsDefined)
public function testErrorHandlerWhenLogging(bool $previousHandlerWasDefined, bool $loggerSetsAnotherHandler, bool $nextHandlerIsDefined)
{
try {
if ($previousHandlerWasDefined) {
Expand Down Expand Up @@ -612,7 +612,7 @@ public function testErrorHandlerWhenLogging($previousHandlerWasDefined, $loggerS
}
}

public function errorHandlerWhenLoggingProvider()
public function errorHandlerWhenLoggingProvider(): iterable
{
foreach ([false, true] as $previousHandlerWasDefined) {
foreach ([false, true] as $loggerSetsAnotherHandler) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static function setUpBeforeClass(): void
/**
* @dataProvider provideClassNotFoundData
*/
public function testHandleClassNotFound($error, $translatedMessage, $autoloader = null)
public function testHandleClassNotFound(array $error, string $translatedMessage, callable $autoloader = null)
{
if ($autoloader) {
// Unregister all autoloaders to ensure the custom provided
Expand All @@ -67,7 +67,7 @@ public function testHandleClassNotFound($error, $translatedMessage, $autoloader
$this->assertSame($error['line'], $exception->getLine());
}

public function provideClassNotFoundData()
public function provideClassNotFoundData(): array
{
$autoloader = new ComposerClassLoader();
$autoloader->add('Symfony\Component\ErrorHandler\Exception\\', realpath(__DIR__.'/../../Exception'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class UndefinedFunctionFatalErrorHandlerTest extends TestCase
/**
* @dataProvider provideUndefinedFunctionData
*/
public function testUndefinedFunction($error, $translatedMessage)
public function testUndefinedFunction(array $error, string $translatedMessage)
{
$handler = new UndefinedFunctionFatalErrorHandler();
$exception = $handler->handleError($error, new FatalErrorException('', 0, $error['type'], $error['file'], $error['line']));
Expand All @@ -33,7 +33,7 @@ public function testUndefinedFunction($error, $translatedMessage)
$this->assertSame($error['line'], $exception->getLine());
}

public function provideUndefinedFunctionData()
public function provideUndefinedFunctionData(): array
{
return [
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class UndefinedMethodFatalErrorHandlerTest extends TestCase
/**
* @dataProvider provideUndefinedMethodData
*/
public function testUndefinedMethod($error, $translatedMessage)
public function testUndefinedMethod(array $error, string $translatedMessage)
{
$handler = new UndefinedMethodFatalErrorHandler();
$exception = $handler->handleError($error, new FatalErrorException('', 0, $error['type'], $error['file'], $error['line']));
Expand All @@ -32,7 +32,7 @@ public function testUndefinedMethod($error, $translatedMessage)
$this->assertSame($error['line'], $exception->getLine());
}

public function provideUndefinedMethodData()
public function provideUndefinedMethodData(): array
{
return [
[
Expand Down

0 comments on commit a4db89f

Please sign in to comment.