diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 0b547cb4c..bdcae7a6b 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -103,7 +103,7 @@ public function getConfigTreeBuilder(): TreeBuilder ->info('Set true to enable support for xsendfile in binary file responses.') ->defaultFalse() ->end() - ->scalarNode('ide')->defaultValue('%env(default::SYMFONY_IDE)%')->end() + ->scalarNode('ide')->defaultValue($this->debug ? '%env(default::SYMFONY_IDE)%' : null)->end() ->booleanNode('test')->end() ->scalarNode('default_locale')->defaultValue('en')->end() ->booleanNode('set_locale_from_accept_language') diff --git a/Tests/CacheWarmer/SerializerCacheWarmerTest.php b/Tests/CacheWarmer/SerializerCacheWarmerTest.php index 85dbd8810..5feb0c8ec 100644 --- a/Tests/CacheWarmer/SerializerCacheWarmerTest.php +++ b/Tests/CacheWarmer/SerializerCacheWarmerTest.php @@ -40,7 +40,7 @@ public function testWarmUp(array $loaders) $this->assertTrue($arrayPool->getItem('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Author')->isHit()); } - public static function loaderProvider() + public static function loaderProvider(): array { return [ [ diff --git a/Tests/Command/CachePoolClearCommandTest.php b/Tests/Command/CachePoolClearCommandTest.php index 12ae2bd39..62f66b614 100644 --- a/Tests/Command/CachePoolClearCommandTest.php +++ b/Tests/Command/CachePoolClearCommandTest.php @@ -44,7 +44,7 @@ public function testComplete(array $input, array $expectedSuggestions) $this->assertSame($expectedSuggestions, $suggestions); } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { yield 'pool_name' => [ ['f'], diff --git a/Tests/Command/CachePoolDeleteCommandTest.php b/Tests/Command/CachePoolDeleteCommandTest.php index b910489ab..a5c741cda 100644 --- a/Tests/Command/CachePoolDeleteCommandTest.php +++ b/Tests/Command/CachePoolDeleteCommandTest.php @@ -98,7 +98,7 @@ public function testComplete(array $input, array $expectedSuggestions) $this->assertSame($expectedSuggestions, $suggestions); } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { yield 'pool_name' => [ ['f'], diff --git a/Tests/Command/EventDispatcherDebugCommandTest.php b/Tests/Command/EventDispatcherDebugCommandTest.php index 331d8d44a..359196e11 100644 --- a/Tests/Command/EventDispatcherDebugCommandTest.php +++ b/Tests/Command/EventDispatcherDebugCommandTest.php @@ -32,7 +32,7 @@ public function testComplete(array $input, array $expectedSuggestions) $this->assertSame($expectedSuggestions, $suggestions); } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { yield 'event' => [[''], [MessageEvent::class, 'console.command']]; yield 'event for other dispatcher' => [['--dispatcher', 'other_event_dispatcher', ''], ['other_event', 'App\OtherEvent']]; diff --git a/Tests/Command/SecretsRemoveCommandTest.php b/Tests/Command/SecretsRemoveCommandTest.php index 88c247ec6..2c12b6128 100644 --- a/Tests/Command/SecretsRemoveCommandTest.php +++ b/Tests/Command/SecretsRemoveCommandTest.php @@ -37,7 +37,7 @@ public function testComplete(bool $withLocalVault, array $input, array $expected $this->assertSame($expectedSuggestions, $suggestions); } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { yield 'name' => [true, [''], ['SECRET', 'OTHER_SECRET']]; yield '--local name (with local vault)' => [true, ['--local', ''], ['SECRET']]; diff --git a/Tests/Command/SecretsSetCommandTest.php b/Tests/Command/SecretsSetCommandTest.php index 8e8e968c8..678fb417c 100644 --- a/Tests/Command/SecretsSetCommandTest.php +++ b/Tests/Command/SecretsSetCommandTest.php @@ -32,7 +32,7 @@ public function testComplete(array $input, array $expectedSuggestions) $this->assertSame($expectedSuggestions, $suggestions); } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { yield 'name' => [[''], ['SECRET', 'OTHER_SECRET']]; yield '--local name (with local vault)' => [['--local', ''], ['SECRET', 'OTHER_SECRET']]; diff --git a/Tests/Command/TranslationDebugCommandTest.php b/Tests/Command/TranslationDebugCommandTest.php index 846abd445..e3ac1066a 100644 --- a/Tests/Command/TranslationDebugCommandTest.php +++ b/Tests/Command/TranslationDebugCommandTest.php @@ -269,7 +269,7 @@ function ($path, $catalogue) use ($extractedMessagesWithDomains) { $this->assertSame($expectedSuggestions, $suggestions); } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { yield 'locale' => [ [''], diff --git a/Tests/Command/TranslationUpdateCommandCompletionTest.php b/Tests/Command/TranslationUpdateCommandCompletionTest.php index 91999d288..6992ade4d 100644 --- a/Tests/Command/TranslationUpdateCommandCompletionTest.php +++ b/Tests/Command/TranslationUpdateCommandCompletionTest.php @@ -42,7 +42,7 @@ public function testComplete(array $input, array $expectedSuggestions) $this->assertSame($expectedSuggestions, $suggestions); } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { $bundle = new ExtensionPresentBundle(); diff --git a/Tests/Controller/AbstractControllerTest.php b/Tests/Controller/AbstractControllerTest.php index efa9c7bec..aa3e67919 100644 --- a/Tests/Controller/AbstractControllerTest.php +++ b/Tests/Controller/AbstractControllerTest.php @@ -386,7 +386,7 @@ public function testdenyAccessUnlessGrantedSetsAttributesAsArray($attribute, $ex } } - public static function provideDenyAccessUnlessGrantedSetsAttributesAsArray() + public static function provideDenyAccessUnlessGrantedSetsAttributesAsArray(): array { $obj = new \stdClass(); $obj->foo = 'bar'; diff --git a/Tests/Controller/RedirectControllerTest.php b/Tests/Controller/RedirectControllerTest.php index de72396df..b2da9ef58 100644 --- a/Tests/Controller/RedirectControllerTest.php +++ b/Tests/Controller/RedirectControllerTest.php @@ -103,7 +103,7 @@ public function testRoute($permanent, $keepRequestMethod, $keepQueryParams, $ign $this->assertEquals($expectedCode, $returnResponse->getStatusCode()); } - public static function provider() + public static function provider(): array { return [ [true, false, false, false, 301, ['additional-parameter' => 'value']], @@ -210,7 +210,7 @@ public function testUrlRedirectDefaultPorts() $this->assertRedirectUrl($returnValue, $expectedUrl); } - public static function urlRedirectProvider() + public static function urlRedirectProvider(): array { return [ // Standard ports @@ -262,7 +262,7 @@ public function testUrlRedirect($scheme, $httpPort, $httpsPort, $requestScheme, $this->assertRedirectUrl($returnValue, $expectedUrl); } - public static function pathQueryParamsProvider() + public static function pathQueryParamsProvider(): array { return [ ['http://www.example.com/base/redirect-path', '/redirect-path', ''], diff --git a/Tests/Controller/TemplateControllerTest.php b/Tests/Controller/TemplateControllerTest.php index f558333f3..c0f5da11f 100644 --- a/Tests/Controller/TemplateControllerTest.php +++ b/Tests/Controller/TemplateControllerTest.php @@ -32,13 +32,23 @@ public function testTwig() $this->assertEquals('bar', $controller('mytemplate')->getContent()); } - public function testNoTwig() + public function testNoTwigTemplateActionMethod() { + $controller = new TemplateController(); + $this->expectException(\LogicException::class); $this->expectExceptionMessage('You cannot use the TemplateController if the Twig Bundle is not available. Try running "composer require symfony/twig-bundle".'); - $controller = new TemplateController(); $controller->templateAction('mytemplate')->getContent(); + } + + public function testNoTwigInvokeMethod() + { + $controller = new TemplateController(); + + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('You cannot use the TemplateController if the Twig Bundle is not available.'); + $controller('mytemplate')->getContent(); } diff --git a/Tests/DependencyInjection/ConfigurationTest.php b/Tests/DependencyInjection/ConfigurationTest.php index e3ecd982d..3f5b1332f 100644 --- a/Tests/DependencyInjection/ConfigurationTest.php +++ b/Tests/DependencyInjection/ConfigurationTest.php @@ -140,7 +140,7 @@ public function testValidAssetsPackageNameConfiguration($packageName) $this->assertArrayHasKey($packageName, $config['assets']['packages']); } - public static function provideValidAssetsPackageNameConfigurationTests() + public static function provideValidAssetsPackageNameConfigurationTests(): array { return [ ['foobar'], @@ -167,7 +167,7 @@ public function testInvalidAssetsConfiguration(array $assetConfig, $expectedMess ]); } - public static function provideInvalidAssetConfigurationTests() + public static function provideInvalidAssetConfigurationTests(): iterable { // helper to turn config into embedded package config $createPackageConfig = fn (array $packageConfig) => [ @@ -219,7 +219,7 @@ public function testValidLockConfiguration($lockConfig, $processedConfig) $this->assertEquals($processedConfig, $config['lock']); } - public static function provideValidLockConfigurationTests() + public static function provideValidLockConfigurationTests(): iterable { yield [null, ['enabled' => true, 'resources' => ['default' => [class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphore' : 'flock']]]]; diff --git a/Tests/Functional/ConfigDebugCommandTest.php b/Tests/Functional/ConfigDebugCommandTest.php index f81c32f66..c9bfba234 100644 --- a/Tests/Functional/ConfigDebugCommandTest.php +++ b/Tests/Functional/ConfigDebugCommandTest.php @@ -141,7 +141,7 @@ public function testParametersValuesAreFullyResolved(bool $debug) $this->assertStringContainsString('locale: en', $tester->getDisplay()); $this->assertStringContainsString('secret: test', $tester->getDisplay()); $this->assertStringContainsString('cookie_httponly: true', $tester->getDisplay()); - $this->assertStringContainsString('ide: '.($_ENV['SYMFONY_IDE'] ?? $_SERVER['SYMFONY_IDE'] ?? 'null'), $tester->getDisplay()); + $this->assertStringContainsString('ide: '.$debug ? ($_ENV['SYMFONY_IDE'] ?? $_SERVER['SYMFONY_IDE'] ?? 'null') : 'null', $tester->getDisplay()); } /** diff --git a/Tests/Functional/ContainerDebugCommandTest.php b/Tests/Functional/ContainerDebugCommandTest.php index 8e73cebc7..efbc1f54a 100644 --- a/Tests/Functional/ContainerDebugCommandTest.php +++ b/Tests/Functional/ContainerDebugCommandTest.php @@ -269,7 +269,7 @@ public function testGetDeprecationNoFile() $this->assertStringContainsString('[WARNING] The deprecation file does not exist', $tester->getDisplay()); } - public static function provideIgnoreBackslashWhenFindingService() + public static function provideIgnoreBackslashWhenFindingService(): array { return [ [BackslashClass::class], @@ -297,7 +297,7 @@ public function testComplete(array $input, array $expectedSuggestions, array $no } } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { $serviceId = 'console.command.container_debug'; $hiddenServiceId = '.console.command.container_debug.lazy'; diff --git a/Tests/Functional/RouterDebugCommandTest.php b/Tests/Functional/RouterDebugCommandTest.php index 9865e7ede..a428801ae 100644 --- a/Tests/Functional/RouterDebugCommandTest.php +++ b/Tests/Functional/RouterDebugCommandTest.php @@ -96,7 +96,7 @@ public function testComplete(array $input, array $expectedSuggestions) $this->assertSame($expectedSuggestions, $tester->complete($input)); } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { yield 'option --format' => [ ['--format', ''],