From b0217c600f078d58d6c3bd9895d6a015d1f24c14 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 9 Feb 2022 15:00:38 +0100 Subject: [PATCH] Bump minimum version of PHP to 8.1 --- .appveyor.yml | 12 +- .github/expected-missing-return-types.diff | 65 ++++++----- .github/workflows/integration-tests.yml | 10 +- .github/workflows/intl-data-tests.yml | 2 +- .github/workflows/psalm.yml | 2 +- .github/workflows/unit-tests.yml | 12 +- composer.json | 3 +- .../Doctrine/Form/Type/DoctrineType.php | 2 +- .../Bridge/Doctrine/Form/Type/EntityType.php | 2 +- .../DoctrineExtensionTest.php | 6 - .../Tests/Form/Type/EntityTypeTest.php | 5 +- .../PropertyInfo/DoctrineExtractorTest.php | 3 - .../Tests/Validator/DoctrineLoaderTest.php | 3 - src/Symfony/Bridge/Doctrine/composer.json | 2 +- .../Monolog/Formatter/ConsoleFormatter.php | 4 +- .../Handler/ElasticsearchLogstashHandler.php | 2 +- .../Bridge/Monolog/Handler/MailerHandler.php | 2 +- .../Monolog/Handler/NotifierHandler.php | 2 +- src/Symfony/Bridge/Monolog/composer.json | 2 +- src/Symfony/Bridge/ProxyManager/composer.json | 2 +- .../Bridge/Twig/Command/DebugCommand.php | 2 +- .../Twig/ErrorRenderer/TwigErrorRenderer.php | 2 +- .../Bridge/Twig/Extension/AssetExtension.php | 4 +- .../Bridge/Twig/Extension/CodeExtension.php | 20 ++-- .../Bridge/Twig/Extension/DumpExtension.php | 2 +- .../Twig/Extension/ExpressionExtension.php | 2 +- .../Bridge/Twig/Extension/FormExtension.php | 12 +- .../Extension/HttpFoundationExtension.php | 4 +- .../Twig/Extension/LogoutUrlExtension.php | 4 +- .../Twig/Extension/RoutingExtension.php | 4 +- .../Twig/Extension/SecurityExtension.php | 6 +- .../Twig/Extension/TranslationExtension.php | 4 +- .../Twig/Extension/WebLinkExtension.php | 12 +- .../Twig/Extension/WorkflowExtension.php | 14 +-- .../Bridge/Twig/Extension/YamlExtension.php | 4 +- .../Tests/Translation/TwigExtractorTest.php | 1 - .../Twig/TokenParser/StopwatchTokenParser.php | 2 +- .../Twig/TokenParser/TransTokenParser.php | 2 +- src/Symfony/Bridge/Twig/composer.json | 2 +- src/Symfony/Bundle/DebugBundle/composer.json | 2 +- .../Command/ConfigDebugCommand.php | 1 - .../Command/ContainerDebugCommand.php | 2 +- .../Command/ContainerLintCommand.php | 1 - .../Command/DebugAutowiringCommand.php | 4 +- .../Console/Descriptor/Descriptor.php | 1 - .../FrameworkExtension.php | 2 +- .../Bundle/FrameworkBundle/Routing/Router.php | 4 +- .../AnnotationsCacheWarmerTest.php | 5 +- .../Command/CachePoolClearCommandTest.php | 5 +- .../Command/CachePoolDeleteCommandTest.php | 5 +- .../Tests/Command/CachePruneCommandTest.php | 10 +- .../Descriptor/AbstractDescriptorTest.php | 4 +- .../Console/Descriptor/ObjectsProvider.php | 6 +- .../Functional/CachePoolClearCommandTest.php | 1 - .../Bundle/FrameworkBundle/composer.json | 3 +- .../Security/StaticTokenProvider.php | 2 - .../Bundle/SecurityBundle/composer.json | 2 +- .../DependencyInjection/TwigExtensionTest.php | 1 - src/Symfony/Bundle/TwigBundle/composer.json | 2 +- .../WebDebugToolbarListenerTest.php | 1 - .../Tests/Profiler/TemplateManagerTest.php | 2 +- .../Twig/WebProfilerExtension.php | 4 +- .../Bundle/WebProfilerBundle/composer.json | 2 +- src/Symfony/Component/Asset/composer.json | 2 +- .../Component/BrowserKit/composer.json | 2 +- .../Cache/Adapter/AbstractAdapter.php | 2 +- .../Cache/Adapter/AbstractTagAwareAdapter.php | 2 +- .../Messenger/EarlyExpirationDispatcher.php | 2 +- .../Cache/Tests/Adapter/ChainAdapterTest.php | 1 - .../Tests/Adapter/DoctrineDbalAdapterTest.php | 1 - .../Tests/Adapter/FilesystemAdapterTest.php | 1 - .../Tests/Adapter/MaxIdLengthAdapterTest.php | 2 - .../Cache/Tests/Adapter/PdoAdapterTest.php | 1 - .../Tests/Adapter/PhpFilesAdapterTest.php | 1 - .../Tests/Adapter/TagAwareAdapterTest.php | 15 +-- .../Component/Cache/Tests/CacheItemTest.php | 3 - .../Messenger/EarlyExpirationHandlerTest.php | 2 +- .../Component/Cache/Tests/Psr16CacheTest.php | 1 - .../Component/Cache/Traits/ContractsTrait.php | 11 +- src/Symfony/Component/Cache/composer.json | 2 +- .../Config/Builder/ConfigBuilderGenerator.php | 6 +- .../Resource/ClassExistenceResource.php | 1 - .../Resource/ReflectionClassResource.php | 58 +--------- .../Config/Tests/ConfigCacheTest.php | 2 - .../Config/Tests/Definition/ArrayNodeTest.php | 6 - .../Builder/ArrayNodeDefinitionTest.php | 1 - .../Config/Tests/FileLocatorTest.php | 1 - .../Tests/Resource/GlobResourceTest.php | 3 - .../Resource/ReflectionClassResourceTest.php | 33 ++---- src/Symfony/Component/Config/composer.json | 7 +- .../Component/Console/Command/Command.php | 2 +- .../Console/Event/ConsoleErrorEvent.php | 1 - .../Component/Console/Input/ArrayInput.php | 2 +- .../Component/Console/Question/Question.php | 6 +- .../Console/SignalRegistry/SignalRegistry.php | 2 +- .../Component/Console/Tester/TesterTrait.php | 2 - .../Console/Tests/ApplicationTest.php | 1 - .../Console/Tests/Command/CommandTest.php | 4 - .../Tests/Completion/CompletionInputTest.php | 1 - .../Tests/Descriptor/JsonDescriptorTest.php | 4 +- .../Tests/Formatter/OutputFormatterTest.php | 1 - .../Tests/Helper/QuestionHelperTest.php | 1 - .../Console/Tests/Input/ArgvInputTest.php | 1 - .../Console/Tests/Input/StringInputTest.php | 1 - .../Component/Console/Tests/TerminalTest.php | 1 - src/Symfony/Component/Console/composer.json | 2 +- .../Parser/Handler/AbstractHandlerTest.php | 1 - .../CssSelector/Tests/Parser/ReaderTest.php | 1 - .../Extension/AttributeMatchingExtension.php | 16 +-- .../XPath/Extension/CombinationExtension.php | 8 +- .../XPath/Extension/FunctionExtension.php | 12 +- .../XPath/Extension/HtmlExtension.php | 18 +-- .../XPath/Extension/NodeExtension.php | 18 +-- .../XPath/Extension/PseudoClassExtension.php | 16 +-- .../Component/CssSelector/composer.json | 2 +- .../Argument/RewindableGenerator.php | 6 +- .../AttributeAutoconfigurationPass.php | 2 +- .../Compiler/AutowirePass.php | 2 +- .../DependencyInjection/Compiler/Compiler.php | 1 - .../RegisterAutoconfigureAttributesPass.php | 1 - .../Compiler/ResolveChildDefinitionsPass.php | 1 - .../DependencyInjection/Container.php | 4 +- .../DependencyInjection/ContainerBuilder.php | 4 +- .../DependencyInjection/Dumper/PhpDumper.php | 6 +- .../ExpressionLanguageProvider.php | 2 +- .../Loader/PhpFileLoader.php | 5 +- .../Loader/XmlFileLoader.php | 2 +- .../DependencyInjection/ServiceLocator.php | 1 - .../Tests/Compiler/AutowirePassTest.php | 6 - .../CheckTypeDeclarationsPassTest.php | 6 - .../Tests/Compiler/IntegrationTest.php | 2 - .../RegisterServiceSubscribersPassTest.php | 12 -- .../Compiler/ResolveBindingsPassTest.php | 3 - .../Tests/ContainerBuilderTest.php | 1 - .../Tests/ContainerTest.php | 1 - .../Tests/Dumper/PhpDumperTest.php | 12 +- .../Tests/Dumper/PreloaderTest.php | 6 - .../Tests/Dumper/XmlDumperTest.php | 3 - .../Tests/Dumper/YamlDumperTest.php | 3 - .../Tests/EnvVarProcessorTest.php | 4 +- .../Fixtures/includes/autowiring_classes.php | 4 +- .../php/services_non_shared_duplicates.php | 4 +- .../Fixtures/php/services_non_shared_lazy.php | 2 +- .../Tests/Fixtures/php/services_rot13_env.php | 4 +- .../php/services_service_locator_argument.php | 4 +- .../Fixtures/php/services_subscriber.php | 12 +- .../php/services_subscriber_php81.php | 106 ------------------ .../Tests/Loader/XmlFileLoaderTest.php | 7 -- .../Tests/Loader/YamlFileLoaderTest.php | 8 -- .../DependencyInjection/composer.json | 3 +- .../Component/DomCrawler/composer.json | 2 +- src/Symfony/Component/Dotenv/composer.json | 2 +- .../ErrorHandler/Error/ClassNotFoundError.php | 1 - .../ErrorHandler/Error/FatalError.php | 1 - .../Error/UndefinedFunctionError.php | 1 - .../Error/UndefinedMethodError.php | 1 - .../Component/ErrorHandler/ErrorHandler.php | 1 - .../ErrorRenderer/HtmlErrorRenderer.php | 4 +- .../ErrorRenderer/SerializerErrorRenderer.php | 4 +- .../Tests/DebugClassLoaderTest.php | 4 - .../phpt/fatal_with_nested_handlers.phpt | 2 - .../fatal_with_nested_handlers_pre81.phpt | 55 --------- .../Component/ErrorHandler/composer.json | 2 +- .../Debug/TraceableEventDispatcher.php | 2 +- .../EventDispatcher/Debug/WrappedListener.php | 2 +- .../EventDispatcher/EventDispatcher.php | 4 +- .../Component/EventDispatcher/composer.json | 2 +- .../ExpressionLanguage/ExpressionFunction.php | 4 +- .../ExpressionLanguage/composer.json | 2 +- .../Component/Filesystem/composer.json | 2 +- src/Symfony/Component/Finder/Finder.php | 2 +- .../Finder/Iterator/LazyIterator.php | 2 +- .../Finder/Iterator/SortableIterator.php | 2 +- src/Symfony/Component/Finder/composer.json | 2 +- .../Component/Form/CallbackTransformer.php | 4 +- .../Factory/Cache/AbstractStaticOption.php | 2 +- .../Form/ChoiceList/LazyChoiceList.php | 2 +- .../Loader/CallbackChoiceLoader.php | 2 +- .../Loader/FilterChoiceLoaderDecorator.php | 2 +- .../Component/Form/Command/DebugCommand.php | 1 - .../Console/Descriptor/TextDescriptor.php | 10 +- .../Core/EventListener/ResizeFormListener.php | 2 +- .../Form/Extension/Core/Type/EnumType.php | 2 +- .../Component/Form/FormConfigBuilder.php | 2 +- .../Component/Form/Tests/AbstractFormTest.php | 10 +- .../Form/Tests/Command/DebugCommandTest.php | 1 - .../Extension/Core/Type/EnumTypeTest.php | 5 +- .../Component/Form/Tests/FormBuilderTest.php | 3 - .../Form/Tests/FormFactoryBuilderTest.php | 1 - .../Form/Tests/ResolvedFormTypeTest.php | 15 +-- src/Symfony/Component/Form/composer.json | 3 +- .../Component/HtmlSanitizer/composer.json | 2 +- .../Component/HttpClient/AmpHttpClient.php | 2 +- .../Component/HttpClient/CurlHttpClient.php | 2 +- .../HttpClient/Internal/AmpClientState.php | 2 +- .../Component/HttpClient/MockHttpClient.php | 2 +- .../Component/HttpClient/NativeHttpClient.php | 2 +- .../HttpClient/Tests/CurlHttpClientTest.php | 2 - .../HttpClient/Tests/HttpClientTestCase.php | 3 +- .../Component/HttpClient/composer.json | 2 +- .../HttpFoundation/Session/Session.php | 2 +- .../Session/SessionBagProxy.php | 2 +- .../HttpFoundation/Session/SessionFactory.php | 2 +- .../Tests/BinaryFileResponseTest.php | 1 - .../HttpFoundation/Tests/RequestTest.php | 2 - .../HttpFoundation/Tests/ResponseTest.php | 1 - .../Handler/MemcachedSessionHandlerTest.php | 1 - .../Handler/MongoDbSessionHandlerTest.php | 1 - .../Storage/Handler/PdoSessionHandlerTest.php | 3 - .../Handler/SessionHandlerFactoryTest.php | 2 - .../Component/HttpFoundation/composer.json | 2 +- .../ArgumentResolver/ServiceValueResolver.php | 1 - .../EventListener/DebugHandlersListener.php | 2 +- .../EventListener/ErrorListener.php | 3 +- ...ntrollerDoesNotReturnResponseException.php | 1 - .../HttpKernel/HttpCache/HttpCache.php | 2 +- .../Component/HttpKernel/Log/Logger.php | 2 +- .../BackedEnumValueResolverTest.php | 3 - .../Tests/Controller/ArgumentResolverTest.php | 16 +-- .../ArgumentMetadataFactoryTest.php | 2 +- .../DataCollector/MemoryDataCollectorTest.php | 1 - .../AddAnnotatedClassesToCachePassTest.php | 1 - ...sterControllerArgumentLocatorsPassTest.php | 3 - .../Tests/EventListener/ErrorListenerTest.php | 2 - .../EventListener/SessionListenerTest.php | 14 +-- .../Fragment/RoutableFragmentRendererTest.php | 1 - .../Tests/HttpCache/HttpCacheTest.php | 3 - .../HttpKernel/Tests/HttpCache/StoreTest.php | 3 - .../Tests/HttpCache/TestHttpKernel.php | 2 +- .../HttpCache/TestMultipleHttpKernel.php | 2 +- .../Tests/HttpKernelBrowserTest.php | 2 - .../Profiler/FileProfilerStorageTest.php | 2 - .../HttpKernel/Tests/TestHttpKernel.php | 2 +- .../Component/HttpKernel/composer.json | 2 +- src/Symfony/Component/Intl/composer.json | 3 +- .../Adapter/ExtLdap/EntryManagerTest.php | 1 - src/Symfony/Component/Ldap/composer.json | 2 +- .../Lock/Tests/Store/MongoDbStoreTest.php | 2 - src/Symfony/Component/Lock/composer.json | 2 +- .../Tests/Transport/SesSmtpTransportTest.php | 1 - .../Mailer/Bridge/Amazon/composer.json | 2 +- .../Mailer/Bridge/Google/composer.json | 2 +- .../Transport/MandrillApiTransportTest.php | 3 - .../Transport/MandrillHttpTransportTest.php | 1 - .../Transport/MandrillSmtpTransportTest.php | 1 - .../Mailer/Bridge/Mailchimp/composer.json | 2 +- .../Transport/MailgunApiTransportTest.php | 3 - .../Transport/MailgunHttpTransportTest.php | 1 - .../Transport/MailgunSmtpTransportTest.php | 1 - .../Mailgun/Transport/MailgunApiTransport.php | 1 - .../Mailer/Bridge/Mailgun/composer.json | 2 +- .../Transport/MailjetApiTransportTest.php | 2 - .../Mailjet/Transport/MailjetApiTransport.php | 2 +- .../Mailer/Bridge/Mailjet/composer.json | 2 +- .../Transport/OhMySmtpApiTransportTest.php | 2 - .../Transport/OhMySmtpSmtpTransportTest.php | 2 - .../Mailer/Bridge/OhMySmtp/composer.json | 2 +- .../Transport/PostmarkApiTransportTest.php | 3 - .../Transport/PostmarkSmtpTransportTest.php | 3 - .../Mailer/Bridge/Postmark/composer.json | 2 +- .../Transport/SendgridApiTransportTest.php | 4 - .../Mailer/Bridge/Sendgrid/composer.json | 2 +- .../Transport/SendinblueApiTransportTest.php | 1 - .../Mailer/Bridge/Sendinblue/composer.json | 2 +- .../Tests/Transport/FailoverTransportTest.php | 2 - .../Transport/RoundRobinTransportTest.php | 5 - src/Symfony/Component/Mailer/composer.json | 2 +- .../Tests/Transport/ConnectionTest.php | 2 - .../Messenger/Bridge/AmazonSqs/composer.json | 2 +- .../Messenger/Bridge/Amqp/composer.json | 2 +- .../Messenger/Bridge/Beanstalkd/composer.json | 2 +- .../Messenger/Bridge/Doctrine/composer.json | 2 +- .../Transport/RedisExtIntegrationTest.php | 2 - .../Messenger/Bridge/Redis/composer.json | 2 +- .../StopWorkerOnMemoryLimitListener.php | 2 +- .../Messenger/Handler/HandlerDescriptor.php | 4 +- .../Middleware/ActivationMiddleware.php | 2 +- .../Messenger/Transport/InMemoryTransport.php | 5 +- .../Normalizer/FlattenExceptionNormalizer.php | 2 - src/Symfony/Component/Messenger/composer.json | 2 +- .../Component/Mime/Crypto/SMimeEncrypter.php | 2 +- src/Symfony/Component/Mime/Part/DataPart.php | 3 - .../Mime/Part/Multipart/FormDataPart.php | 5 +- src/Symfony/Component/Mime/Part/SMimePart.php | 1 - src/Symfony/Component/Mime/Part/TextPart.php | 1 - .../Mime/Tests/MessageConverterTest.php | 1 - .../Tests/Part/Multipart/FormDataPartTest.php | 1 - src/Symfony/Component/Mime/composer.json | 2 +- .../Notifier/Bridge/AllMySms/composer.json | 2 +- .../Notifier/Bridge/AmazonSns/composer.json | 2 +- .../Notifier/Bridge/Clickatell/composer.json | 2 +- .../Notifier/Bridge/Discord/composer.json | 2 +- .../Notifier/Bridge/Esendex/composer.json | 2 +- .../Notifier/Bridge/Expo/composer.json | 2 +- .../Notifier/Bridge/FakeChat/composer.json | 2 +- .../Notifier/Bridge/FakeSms/composer.json | 2 +- .../Notifier/Bridge/Firebase/composer.json | 2 +- .../Bridge/FortySixElks/composer.json | 2 +- .../Notifier/Bridge/FreeMobile/composer.json | 2 +- .../Notifier/Bridge/GatewayApi/composer.json | 2 +- .../Notifier/Bridge/Gitter/composer.json | 2 +- .../Notifier/Bridge/GoogleChat/composer.json | 2 +- .../Notifier/Bridge/Infobip/composer.json | 2 +- .../Notifier/Bridge/Iqsms/composer.json | 2 +- .../Notifier/Bridge/KazInfoTeh/composer.json | 2 +- .../Notifier/Bridge/LightSms/composer.json | 2 +- .../Notifier/Bridge/LinkedIn/composer.json | 2 +- .../Notifier/Bridge/Mailjet/composer.json | 2 +- .../Notifier/Bridge/Mattermost/composer.json | 2 +- .../Notifier/Bridge/Mercure/composer.json | 2 +- .../Notifier/Bridge/MessageBird/composer.json | 2 +- .../Bridge/MessageMedia/composer.json | 2 +- .../Bridge/MicrosoftTeams/composer.json | 2 +- .../Notifier/Bridge/Mobyt/composer.json | 2 +- .../Notifier/Bridge/Octopush/composer.json | 2 +- .../Notifier/Bridge/OneSignal/composer.json | 2 +- .../Notifier/Bridge/OrangeSms/composer.json | 2 +- .../Notifier/Bridge/OvhCloud/composer.json | 2 +- .../Notifier/Bridge/RocketChat/composer.json | 2 +- .../Notifier/Bridge/Sendinblue/composer.json | 2 +- .../Notifier/Bridge/Sinch/composer.json | 2 +- .../Notifier/Bridge/Slack/composer.json | 2 +- .../Notifier/Bridge/Sms77/composer.json | 2 +- .../Notifier/Bridge/SmsBiuras/composer.json | 2 +- .../Notifier/Bridge/Smsapi/composer.json | 2 +- .../Notifier/Bridge/Smsc/composer.json | 2 +- .../Notifier/Bridge/SpotHit/composer.json | 2 +- .../Notifier/Bridge/Telegram/composer.json | 2 +- .../Notifier/Bridge/Telnyx/composer.json | 2 +- .../Notifier/Bridge/TurboSms/composer.json | 2 +- .../Notifier/Bridge/Twilio/composer.json | 2 +- .../Notifier/Bridge/Yunpian/composer.json | 2 +- .../Notifier/Bridge/Zulip/composer.json | 2 +- src/Symfony/Component/Notifier/composer.json | 2 +- .../Component/OptionsResolver/composer.json | 2 +- .../Component/PasswordHasher/composer.json | 2 +- .../Component/Process/Pipes/UnixPipes.php | 2 +- src/Symfony/Component/Process/Process.php | 4 +- .../Component/Process/Tests/ProcessTest.php | 2 - src/Symfony/Component/Process/composer.json | 2 +- .../Component/PropertyAccess/composer.json | 2 +- .../Extractor/ReflectionExtractorTest.php | 1 - .../Component/PropertyInfo/composer.json | 2 +- .../Component/RateLimiter/composer.json | 2 +- .../Component/Routing/Tests/RouterTest.php | 4 - src/Symfony/Component/Routing/composer.json | 2 +- .../Component/Runtime/GenericRuntime.php | 7 +- src/Symfony/Component/Runtime/composer.json | 2 +- .../Token/Storage/TokenStorage.php | 2 +- .../TraceableAccessDecisionManager.php | 2 - .../Component/Security/Core/composer.json | 2 +- .../Security/Csrf/CsrfTokenManager.php | 2 +- .../Component/Security/Csrf/composer.json | 2 +- .../AbstractPreAuthenticatedAuthenticator.php | 2 +- .../Authenticator/FormLoginAuthenticator.php | 2 +- .../Authenticator/HttpBasicAuthenticator.php | 2 +- .../Authenticator/JsonLoginAuthenticator.php | 2 +- .../Credentials/CustomCredentials.php | 2 +- .../EventListener/UserProviderListener.php | 2 +- .../Http/Firewall/ContextListener.php | 6 +- .../Http/Firewall/ExceptionListener.php | 4 +- .../PasswordMigratingListenerTest.php | 2 +- .../UserProviderListenerTest.php | 3 - .../Tests/Firewall/ContextListenerTest.php | 12 +- .../Component/Security/Http/composer.json | 2 +- src/Symfony/Component/Semaphore/composer.json | 2 +- .../Normalizer/MimeMessageNormalizer.php | 1 - .../Normalizer/PropertyNormalizer.php | 10 -- .../Tests/Encoder/XmlEncoderTest.php | 5 +- .../Normalizer/BackedEnumNormalizerTest.php | 27 ----- .../Component/Serializer/composer.json | 2 +- .../Stopwatch/Tests/StopwatchTest.php | 2 - src/Symfony/Component/Stopwatch/composer.json | 2 +- src/Symfony/Component/String/composer.json | 2 +- .../Component/Templating/composer.json | 2 +- .../Translation/Bridge/Crowdin/composer.json | 2 +- .../Translation/Bridge/Loco/composer.json | 2 +- .../Bridge/Lokalise/LokaliseProvider.php | 2 +- .../Translation/Bridge/Lokalise/composer.json | 2 +- .../Translation/Command/XliffLintCommand.php | 4 +- .../Translation/Dumper/MoFileDumper.php | 2 +- .../Test/ProviderFactoryTestCase.php | 9 +- .../Translation/Test/ProviderTestCase.php | 3 - .../Tests/Command/XliffLintCommandTest.php | 2 +- .../Component/Translation/composer.json | 2 +- .../Uid/Command/GenerateUuidCommand.php | 4 +- src/Symfony/Component/Uid/composer.json | 2 +- .../Validator/Mapping/PropertyMetadata.php | 5 +- .../Tests/Constraints/FileValidatorTest.php | 1 - .../NotCompromisedPasswordValidatorTest.php | 1 - .../Tests/Mapping/GetterMetadataTest.php | 3 - .../Mapping/Loader/AnnotationLoaderTest.php | 5 +- .../Mapping/Loader/YamlFileLoaderTest.php | 1 - .../Validator/Tests/ValidatorBuilderTest.php | 2 - src/Symfony/Component/Validator/composer.json | 3 +- .../VarDumper/Caster/ReflectionCaster.php | 2 +- .../Component/VarDumper/Cloner/VarCloner.php | 42 +------ .../VarDumper/Dumper/AbstractDumper.php | 2 +- .../Tests/Caster/ReflectionCasterTest.php | 54 ++++----- .../VarDumper/Tests/Cloner/VarClonerTest.php | 3 - .../VarDumper/Tests/Dumper/CliDumperTest.php | 69 ------------ src/Symfony/Component/VarDumper/composer.json | 2 +- .../VarExporter/Internal/Hydrator.php | 5 +- .../VarExporter/Internal/Registry.php | 8 +- .../VarExporter/Tests/VarExporterTest.php | 6 +- .../Component/VarExporter/composer.json | 2 +- src/Symfony/Component/WebLink/composer.json | 2 +- src/Symfony/Component/Workflow/composer.json | 2 +- .../Component/Yaml/Command/LintCommand.php | 4 +- .../Component/Yaml/Tests/InlineTest.php | 3 - src/Symfony/Component/Yaml/composer.json | 2 +- src/Symfony/Contracts/Cache/composer.json | 2 +- .../Contracts/Deprecation/composer.json | 2 +- .../Contracts/EventDispatcher/composer.json | 2 +- .../Contracts/HttpClient/composer.json | 2 +- src/Symfony/Contracts/Service/composer.json | 2 +- .../Contracts/Translation/composer.json | 2 +- src/Symfony/Contracts/composer.json | 2 +- 418 files changed, 516 insertions(+), 1256 deletions(-) delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber_php81.php delete mode 100644 src/Symfony/Component/ErrorHandler/Tests/phpt/fatal_with_nested_handlers_pre81.phpt diff --git a/.appveyor.yml b/.appveyor.yml index 8a880a9b3c063..d2999514a6bff 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -17,13 +17,13 @@ init: install: - mkdir c:\php && cd c:\php - - appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php-8.0.2-Win32-vs16-x86.zip - - 7z x php-8.0.2-Win32-vs16-x86.zip -y >nul + - appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php-8.1.0-Win32-vs16-x86.zip + - 7z x php-8.1.0-Win32-vs16-x86.zip -y >nul - cd ext - - appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php_apcu-5.1.21-8.0-ts-vs16-x86.zip - - 7z x php_apcu-5.1.21-8.0-ts-vs16-x86.zip -y >nul - - appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php_redis-5.3.5-8.0-ts-vs16-x86.zip - - 7z x php_redis-5.3.5-8.0-ts-vs16-x86.zip -y >nul + - appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php_apcu-5.1.21-8.1-ts-vs16-x86.zip + - 7z x php_apcu-5.1.21-8.1-ts-vs16-x86.zip -y >nul + - appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php_redis-5.3.7rc1-8.1-ts-vs16-x86.zip + - 7z x php_redis-5.3.7rc1-8.1-ts-vs16-x86.zip -y >nul - cd .. - copy /Y php.ini-development php.ini-min - echo memory_limit=-1 >> php.ini-min diff --git a/.github/expected-missing-return-types.diff b/.github/expected-missing-return-types.diff index 2853463c6159b..9c69e3869d510 100644 --- a/.github/expected-missing-return-types.diff +++ b/.github/expected-missing-return-types.diff @@ -1,22 +1,11 @@ # Run these steps to update this file: sed -i 's/ *"\*\*\/Tests\/"//' composer.json composer u -o -SYMFONY_PATCH_TYPE_DECLARATIONS='force=2&php=8.0' php .github/patch-types.php +SYMFONY_PATCH_TYPE_DECLARATIONS='force=2&php=8.1' php .github/patch-types.php head=$(sed '/^diff /Q' .github/expected-missing-return-types.diff) -(echo "$head" && echo && git diff -U2 composer.json src/) > .github/expected-missing-return-types.diff +(echo "$head" && echo && git diff -U2 src/) > .github/expected-missing-return-types.diff git checkout composer.json src/ -diff --git a/composer.json b/composer.json -index c7b7eac4c7..2b60fb6a19 100644 ---- a/composer.json -+++ b/composer.json -@@ -180,5 +180,5 @@ - ], - "exclude-from-classmap": [ -- "**/Tests/" -+ - ] - }, diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php index d68ae4c8b3..8e980a9e70 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php @@ -60,6 +49,17 @@ index 697e34cb77..9a1e4c5618 100644 + protected function filterResponse(object $response): Response { return $response; +diff --git a/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php b/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php +index 89d6adb70e..c569992efc 100644 +--- a/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php ++++ b/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php +@@ -108,5 +108,5 @@ class NodeBuilder implements NodeParentInterface + * @return NodeDefinition&ParentNodeDefinitionInterface + */ +- public function end() ++ public function end(): NodeDefinition&ParentNodeDefinitionInterface + { + return $this->parent; diff --git a/src/Symfony/Component/Config/Definition/ConfigurationInterface.php b/src/Symfony/Component/Config/Definition/ConfigurationInterface.php index 7b5d443fe6..d64ae0d024 100644 --- a/src/Symfony/Component/Config/Definition/ConfigurationInterface.php @@ -156,7 +156,7 @@ index 6b1c6c5fbe..bb80ed461e 100644 + public function isFresh(ResourceInterface $resource, int $timestamp): bool; } diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php -index 0ed5649b8a..6c814bf82c 100644 +index c654b93790..ce744f5c6d 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -218,5 +218,5 @@ class Application implements ResetInterface @@ -209,17 +209,17 @@ index 0ed5649b8a..6c814bf82c 100644 { foreach ($command->getHelperSet() as $helper) { diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php -index 0bd3426c07..b38caf989e 100644 +index e84307207a..bc503462c1 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php -@@ -171,5 +171,5 @@ class Command +@@ -187,5 +187,5 @@ class Command * @return bool */ - public function isEnabled() + public function isEnabled(): bool { return true; -@@ -197,5 +197,5 @@ class Command +@@ -213,5 +213,5 @@ class Command * @see setCode() */ - protected function execute(InputInterface $input, OutputInterface $output) @@ -297,7 +297,7 @@ index c2824f4578..032f5c2318 100644 { if (\is_array($value)) { diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php -index b9dd838898..3a8cb63eac 100644 +index f9820f5ede..d28a418429 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -108,5 +108,5 @@ class Container implements ContainerInterface, ResetInterface @@ -308,7 +308,7 @@ index b9dd838898..3a8cb63eac 100644 { return $this->parameterBag->get($name); diff --git a/src/Symfony/Component/DependencyInjection/ContainerInterface.php b/src/Symfony/Component/DependencyInjection/ContainerInterface.php -index aa5d6b317e..31ffbca4ef 100644 +index cad44026c0..14cd192e07 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerInterface.php +++ b/src/Symfony/Component/DependencyInjection/ContainerInterface.php @@ -53,5 +53,5 @@ interface ContainerInterface extends PsrContainerInterface @@ -635,6 +635,17 @@ index 125b6eae50..ac327e8981 100644 + public function createLockFromKey(Key $key, ?float $ttl = 300.0, bool $autoRelease = true): SharedLockInterface { $lock = new Lock($key, $this->store, $ttl, $autoRelease); +diff --git a/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/AmazonSqsTransport.php b/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/AmazonSqsTransport.php +index 297fccbd3f..4c47d95b38 100644 +--- a/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/AmazonSqsTransport.php ++++ b/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/AmazonSqsTransport.php +@@ -109,5 +109,5 @@ class AmazonSqsTransport implements TransportInterface, SetupableTransportInterf + * @return MessageCountAwareInterface&ReceiverInterface + */ +- private function getReceiver(): ReceiverInterface ++ private function getReceiver(): MessageCountAwareInterface&ReceiverInterface + { + return $this->receiver ??= new AmazonSqsReceiver($this->connection, $this->serializer); diff --git a/src/Symfony/Component/OptionsResolver/OptionsResolver.php b/src/Symfony/Component/OptionsResolver/OptionsResolver.php index 205c15b4cd..e93e460ed1 100644 --- a/src/Symfony/Component/OptionsResolver/OptionsResolver.php @@ -720,10 +731,10 @@ index fbb37d9f94..522e0487a9 100644 + public function isIndex(int $index): bool; } diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php -index cfffdb2f71..3e2261898a 100644 +index 972d169caa..0b6dae1abe 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php -@@ -725,5 +725,5 @@ class PropertyAccessorTest extends TestCase +@@ -743,5 +743,5 @@ class PropertyAccessorTest extends TestCase * @return mixed */ - public function getFoo() @@ -923,7 +934,7 @@ index 7f86ed8d78..cf084423ec 100644 { if (null !== $object = $this->extractObjectToPopulate($class, $context, self::OBJECT_TO_POPULATE)) { diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php -index a8943113c4..2983dabd0f 100644 +index 1abdb634ce..d2e7f41562 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php @@ -138,5 +138,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer @@ -940,35 +951,35 @@ index a8943113c4..2983dabd0f 100644 + public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { if (!isset($context['cache_key'])) { -@@ -279,5 +279,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer +@@ -280,5 +280,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer * {@inheritdoc} */ - protected function instantiateObject(array &$data, string $class, array &$context, \ReflectionClass $reflectionClass, array|bool $allowedAttributes, string $format = null) + protected function instantiateObject(array &$data, string $class, array &$context, \ReflectionClass $reflectionClass, array|bool $allowedAttributes, string $format = null): object { if ($this->classDiscriminatorResolver && $mapping = $this->classDiscriminatorResolver->getMappingForClass($class)) { -@@ -341,5 +341,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer +@@ -342,5 +342,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer * @return string[] */ - abstract protected function extractAttributes(object $object, string $format = null, array $context = []); + abstract protected function extractAttributes(object $object, string $format = null, array $context = []): array; /** -@@ -348,5 +348,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer +@@ -349,5 +349,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer * @return mixed */ - abstract protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []); + abstract protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []): mixed; /** -@@ -355,5 +355,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer +@@ -356,5 +356,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer * @param array $context */ - public function supportsDenormalization(mixed $data, string $type, string $format = null /*, array $context = [] */) + public function supportsDenormalization(mixed $data, string $type, string $format = null /*, array $context = [] */): bool { return class_exists($type) || (interface_exists($type, false) && $this->classDiscriminatorResolver && null !== $this->classDiscriminatorResolver->getMappingForClass($type)); -@@ -363,5 +363,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer +@@ -364,5 +364,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer * {@inheritdoc} */ - public function denormalize(mixed $data, string $type, string $format = null, array $context = []) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index d3f97a643af4a..bf62788b7a81e 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -20,7 +20,7 @@ jobs: strategy: matrix: - php: ['8.0'] + php: ['8.1'] services: postgres: @@ -129,7 +129,7 @@ jobs: uses: shivammathur/setup-php@v2 with: coverage: "none" - extensions: "json,couchbase,memcached,mongodb-1.10.0,redis-5.3.4,rdkafka,xsl,ldap" + extensions: "json,couchbase,memcached,mongodb-1.12.0,redis-5.3.4,rdkafka,xsl,ldap" ini-values: date.timezone=Europe/Paris,memory_limit=-1,default_socket_timeout=10,session.gc_probability=0,apc.enable_cli=1,zend.assertions=1 php-version: "${{ matrix.php }}" tools: pecl @@ -153,7 +153,7 @@ jobs: echo COMPOSER_ROOT_VERSION=$COMPOSER_ROOT_VERSION >> $GITHUB_ENV echo "::group::composer update" - composer require --dev --no-update mongodb/mongodb:"1.9.1@dev|^1.9.1@stable" + composer require --dev --no-update mongodb/mongodb:"^1.11" composer update --no-progress --ansi echo "::endgroup::" @@ -176,11 +176,11 @@ jobs: POSTGRES_HOST: localhost #- name: Run HTTP push tests - # if: matrix.php == '8.0' + # if: matrix.php == '8.1' # run: | # [ -d .phpunit ] && mv .phpunit .phpunit.bak # wget -q https://github.com/symfony/binary-utils/releases/download/v0.1/vulcain_0.1.3_Linux_x86_64.tar.gz -O - | tar xz && mv vulcain /usr/local/bin - # docker run --rm -e COMPOSER_ROOT_VERSION -v $(pwd):/app -v $(which composer):/usr/local/bin/composer -v $(which vulcain):/usr/local/bin/vulcain -w /app php:8.0-alpine ./phpunit src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php --filter testHttp2Push + # docker run --rm -e COMPOSER_ROOT_VERSION -v $(pwd):/app -v $(which composer):/usr/local/bin/composer -v $(which vulcain):/usr/local/bin/vulcain -w /app php:8.1-alpine ./phpunit src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php --filter testHttp2Push # sudo rm -rf .phpunit # [ -d .phpunit.bak ] && mv .phpunit.bak .phpunit diff --git a/.github/workflows/intl-data-tests.yml b/.github/workflows/intl-data-tests.yml index a598db020e652..065c1a081cc1f 100644 --- a/.github/workflows/intl-data-tests.yml +++ b/.github/workflows/intl-data-tests.yml @@ -46,7 +46,7 @@ jobs: coverage: "none" extensions: "zip,intl-${{env.SYMFONY_ICU_VERSION}}" ini-values: "memory_limit=-1" - php-version: "8.0" + php-version: "8.1" - name: Install dependencies run: | diff --git a/.github/workflows/psalm.yml b/.github/workflows/psalm.yml index 5604b42001445..29a189ea086b4 100644 --- a/.github/workflows/psalm.yml +++ b/.github/workflows/psalm.yml @@ -20,7 +20,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: '8.1' extensions: "json,couchbase,memcached,mongodb,redis,xsl,ldap,dom" ini-values: "memory_limit=-1" coverage: none diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 23f535cb9b80e..3403d97a26b3e 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -24,7 +24,7 @@ jobs: matrix: include: - php: '8.1' - - php: '8.0' + - php: '8.1' mode: high-deps - php: '8.1' mode: low-deps @@ -144,8 +144,8 @@ jobs: patch -sp1 < .github/expected-missing-return-types.diff git add . composer install -q --optimize-autoloader - SYMFONY_PATCH_TYPE_DECLARATIONS='force=2&php=8.0' php .github/patch-types.php - SYMFONY_PATCH_TYPE_DECLARATIONS='force=2&php=8.0' php .github/patch-types.php # ensure the script is idempotent + SYMFONY_PATCH_TYPE_DECLARATIONS='force=2&php=8.1' php .github/patch-types.php + SYMFONY_PATCH_TYPE_DECLARATIONS='force=2&php=8.1' php .github/patch-types.php # ensure the script is idempotent git diff --exit-code - name: Run tests @@ -222,12 +222,12 @@ jobs: script -e -c './phpunit --group tty' /dev/null - name: Run tests with SIGCHLD enabled PHP - if: "matrix.php == '8.0' && ! matrix.mode" + if: "matrix.php == '8.1' && ! matrix.mode" run: | mkdir build cd build - wget -q https://github.com/symfony/binary-utils/releases/download/v0.1/php-8.0.2-pcntl-sigchild.tar.bz2 - tar -xjf php-8.0.2-pcntl-sigchild.tar.bz2 + wget -q https://github.com/symfony/binary-utils/releases/download/v0.1/php-8.1.2-pcntl-sigchild.tar.bz2 + tar -xjf php-8.1.2-pcntl-sigchild.tar.bz2 cd .. ./build/php/bin/php ./phpunit --colors=always src/Symfony/Component/Process diff --git a/composer.json b/composer.json index c1987e3d1dd1c..9df19cc3fc8a4 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "symfony/translation-implementation": "2.3|3.0" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "composer-runtime-api": ">=2.1", "ext-xml": "*", "friendsofphp/proxy-manager-lts": "^1.0.2", @@ -51,7 +51,6 @@ "symfony/polyfill-intl-idn": "^1.10", "symfony/polyfill-intl-normalizer": "~1.0", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php81": "^1.23", "symfony/polyfill-uuid": "^1.15" }, "replace": { diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php index f91d240451470..cd4dc42393059 100644 --- a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php +++ b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php @@ -156,7 +156,7 @@ public function configureOptions(OptionsResolver $resolver) $choiceValue = function (Options $options) { // If the entity has a single-column ID, use that ID as value if ($options['id_reader'] instanceof IdReader && $options['id_reader']->isSingleId()) { - return ChoiceList::value($this, [$options['id_reader'], 'getIdValue'], $options['id_reader']); + return ChoiceList::value($this, $options['id_reader']->getIdValue(...), $options['id_reader']); } // Otherwise, an incrementing integer is used as value automatically diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php b/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php index 6b73af766536f..d50ca5c339b95 100644 --- a/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php +++ b/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php @@ -82,7 +82,7 @@ public function getQueryBuilderPartsForCachingHash(object $queryBuilder): ?array return [ $queryBuilder->getQuery()->getSQL(), - array_map([$this, 'parameterToArray'], $queryBuilder->getParameters()->toArray()), + array_map($this->parameterToArray(...), $queryBuilder->getParameters()->toArray()), ]; } diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php index 17df373369d95..c993b89610184 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php @@ -79,7 +79,6 @@ public function testFixManagersAutoMappingsWithTwoAutomappings() $reflection = new \ReflectionClass(\get_class($this->extension)); $method = $reflection->getMethod('fixManagersAutoMappings'); - $method->setAccessible(true); $method->invoke($this->extension, $emConfigs, $bundles); } @@ -168,7 +167,6 @@ public function testFixManagersAutoMappings(array $originalEm1, array $originalE $reflection = new \ReflectionClass(\get_class($this->extension)); $method = $reflection->getMethod('fixManagersAutoMappings'); - $method->setAccessible(true); $newEmConfigs = $method->invoke($this->extension, $emConfigs, $bundles); @@ -186,7 +184,6 @@ public function testMappingTypeDetection() $reflection = new \ReflectionClass(\get_class($this->extension)); $method = $reflection->getMethod('detectMappingType'); - $method->setAccessible(true); // The ordinary fixtures contain annotation $mappingType = $method->invoke($this->extension, __DIR__.'/../Fixtures', $container); @@ -329,7 +326,6 @@ public function testBundleAutoMapping(string $bundle, string $expectedType, stri $reflection = new \ReflectionClass(\get_class($this->extension)); $method = $reflection->getMethod('getMappingDriverBundleConfigDefaults'); - $method->setAccessible(true); $this->assertSame( [ @@ -347,8 +343,6 @@ protected function invokeLoadCacheDriver(array $objectManager, ContainerBuilder { $method = new \ReflectionMethod($this->extension, 'loadObjectManagerCacheDriver'); - $method->setAccessible(true); - $method->invokeArgs($this->extension, [$objectManager, $container, $cacheName]); } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php index d1c2c04b88956..fd167bbe764ae 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php @@ -1310,10 +1310,7 @@ public function testLoaderCachingWithParameters() $this->assertSame($choiceList1, $choiceList3); } - /** - * @return MockObject&ManagerRegistry - */ - protected function createRegistryMock($name, $em): ManagerRegistry + protected function createRegistryMock($name, $em): MockObject&ManagerRegistry { $registry = $this->createMock(ManagerRegistry::class); $registry->expects($this->any()) diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php index 5d0a09f5f906a..c53a8d3c4dbea 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php @@ -128,9 +128,6 @@ public function testExtractWithEmbedded() $this->assertEquals($expectedTypes, $actualTypes); } - /** - * @requires PHP 8.1 - */ public function testExtractEnum() { if (!property_exists(Column::class, 'enumType')) { diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php index 0bb9591e185df..14e30604f52a8 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php @@ -151,9 +151,6 @@ public function testLoadClassMetadata() $this->assertSame(AutoMappingStrategy::DISABLED, $noAutoMappingMetadata[0]->getAutoMappingStrategy()); } - /** - * @requires PHP 8.1 - */ public function testExtractEnum() { if (!property_exists(Column::class, 'enumType')) { diff --git a/src/Symfony/Bridge/Doctrine/composer.json b/src/Symfony/Bridge/Doctrine/composer.json index d482efec66af8..0b4ae502172cb 100644 --- a/src/Symfony/Bridge/Doctrine/composer.json +++ b/src/Symfony/Bridge/Doctrine/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "doctrine/event-manager": "~1.0", "doctrine/persistence": "^2", "symfony/deprecation-contracts": "^2.1|^3", diff --git a/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php b/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php index 5778dbb3b37c0..5b04c4a62434f 100644 --- a/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php +++ b/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php @@ -72,14 +72,14 @@ public function __construct(array $options = []) if (class_exists(VarCloner::class)) { $this->cloner = new VarCloner(); $this->cloner->addCasters([ - '*' => [$this, 'castObject'], + '*' => $this->castObject(...), ]); $this->outputBuffer = fopen('php://memory', 'r+'); if ($this->options['multiline']) { $output = $this->outputBuffer; } else { - $output = [$this, 'echoLine']; + $output = $this->echoLine(...); } $this->dumper = new CliDumper($output, null, CliDumper::DUMP_LIGHT_ARRAY | CliDumper::DUMP_COMMA_SEPARATOR); diff --git a/src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php b/src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php index 65486f6b9d444..86af1d21bd02d 100644 --- a/src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php @@ -80,7 +80,7 @@ public function handle(array $record): bool public function handleBatch(array $records): void { - $records = array_filter($records, [$this, 'isHandling']); + $records = array_filter($records, $this->isHandling(...)); if ($records) { $this->sendToElasticsearch($records); diff --git a/src/Symfony/Bridge/Monolog/Handler/MailerHandler.php b/src/Symfony/Bridge/Monolog/Handler/MailerHandler.php index a7610f337be2a..f0446b09f3169 100644 --- a/src/Symfony/Bridge/Monolog/Handler/MailerHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/MailerHandler.php @@ -32,7 +32,7 @@ public function __construct(MailerInterface $mailer, callable|Email $messageTemp parent::__construct($level, $bubble); $this->mailer = $mailer; - $this->messageTemplate = !\is_callable($messageTemplate) || $messageTemplate instanceof \Closure ? $messageTemplate : \Closure::fromCallable($messageTemplate); + $this->messageTemplate = $messageTemplate instanceof Email ? $messageTemplate : $messageTemplate(...); } /** diff --git a/src/Symfony/Bridge/Monolog/Handler/NotifierHandler.php b/src/Symfony/Bridge/Monolog/Handler/NotifierHandler.php index 9355ee23457f5..a129085c905e5 100644 --- a/src/Symfony/Bridge/Monolog/Handler/NotifierHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/NotifierHandler.php @@ -46,7 +46,7 @@ public function handle(array $record): bool public function handleBatch(array $records): void { - if ($records = array_filter($records, [$this, 'isHandling'])) { + if ($records = array_filter($records, $this->isHandling(...))) { $this->notify($records); } } diff --git a/src/Symfony/Bridge/Monolog/composer.json b/src/Symfony/Bridge/Monolog/composer.json index 1fd9424f683a9..040ec44353576 100644 --- a/src/Symfony/Bridge/Monolog/composer.json +++ b/src/Symfony/Bridge/Monolog/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "monolog/monolog": "^1.25.1|^2", "symfony/service-contracts": "^1.1|^2|^3", "symfony/http-kernel": "^5.4|^6.0" diff --git a/src/Symfony/Bridge/ProxyManager/composer.json b/src/Symfony/Bridge/ProxyManager/composer.json index 430c4edd1e608..d141f99ba6ee5 100644 --- a/src/Symfony/Bridge/ProxyManager/composer.json +++ b/src/Symfony/Bridge/ProxyManager/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "friendsofphp/proxy-manager-lts": "^1.0.2", "symfony/dependency-injection": "^5.4|^6.0" }, diff --git a/src/Symfony/Bridge/Twig/Command/DebugCommand.php b/src/Symfony/Bridge/Twig/Command/DebugCommand.php index 542ec78218d4d..d5e64859a6c20 100644 --- a/src/Symfony/Bridge/Twig/Command/DebugCommand.php +++ b/src/Symfony/Bridge/Twig/Command/DebugCommand.php @@ -294,7 +294,7 @@ private function getLoaderPaths(string $name = null): array } foreach ($namespaces as $namespace) { - $paths = array_map([$this, 'getRelativePath'], $loader->getPaths($namespace)); + $paths = array_map($this->getRelativePath(...), $loader->getPaths($namespace)); if (FilesystemLoader::MAIN_NAMESPACE === $namespace) { $namespace = '(None)'; diff --git a/src/Symfony/Bridge/Twig/ErrorRenderer/TwigErrorRenderer.php b/src/Symfony/Bridge/Twig/ErrorRenderer/TwigErrorRenderer.php index ef3d433b94ce9..4dde73f62c902 100644 --- a/src/Symfony/Bridge/Twig/ErrorRenderer/TwigErrorRenderer.php +++ b/src/Symfony/Bridge/Twig/ErrorRenderer/TwigErrorRenderer.php @@ -36,7 +36,7 @@ public function __construct(Environment $twig, HtmlErrorRenderer $fallbackErrorR { $this->twig = $twig; $this->fallbackErrorRenderer = $fallbackErrorRenderer ?? new HtmlErrorRenderer(); - $this->debug = !\is_callable($debug) || $debug instanceof \Closure ? $debug : \Closure::fromCallable($debug); + $this->debug = \is_bool($debug) ? $debug : $debug(...); } /** diff --git a/src/Symfony/Bridge/Twig/Extension/AssetExtension.php b/src/Symfony/Bridge/Twig/Extension/AssetExtension.php index 35c69b6988910..3e12371ba99c3 100644 --- a/src/Symfony/Bridge/Twig/Extension/AssetExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/AssetExtension.php @@ -35,8 +35,8 @@ public function __construct(Packages $packages) public function getFunctions(): array { return [ - new TwigFunction('asset', [$this, 'getAssetUrl']), - new TwigFunction('asset_version', [$this, 'getAssetVersion']), + new TwigFunction('asset', $this->getAssetUrl(...)), + new TwigFunction('asset_version', $this->getAssetVersion(...)), ]; } diff --git a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php index 62573d9f961e6..7287ec8e749fe 100644 --- a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php @@ -39,16 +39,16 @@ public function __construct(string|FileLinkFormatter $fileLinkFormat, string $pr public function getFilters(): array { return [ - new TwigFilter('abbr_class', [$this, 'abbrClass'], ['is_safe' => ['html']]), - new TwigFilter('abbr_method', [$this, 'abbrMethod'], ['is_safe' => ['html']]), - new TwigFilter('format_args', [$this, 'formatArgs'], ['is_safe' => ['html']]), - new TwigFilter('format_args_as_text', [$this, 'formatArgsAsText']), - new TwigFilter('file_excerpt', [$this, 'fileExcerpt'], ['is_safe' => ['html']]), - new TwigFilter('format_file', [$this, 'formatFile'], ['is_safe' => ['html']]), - new TwigFilter('format_file_from_text', [$this, 'formatFileFromText'], ['is_safe' => ['html']]), - new TwigFilter('format_log_message', [$this, 'formatLogMessage'], ['is_safe' => ['html']]), - new TwigFilter('file_link', [$this, 'getFileLink']), - new TwigFilter('file_relative', [$this, 'getFileRelative']), + new TwigFilter('abbr_class', $this->abbrClass(...), ['is_safe' => ['html']]), + new TwigFilter('abbr_method', $this->abbrMethod(...), ['is_safe' => ['html']]), + new TwigFilter('format_args', $this->formatArgs(...), ['is_safe' => ['html']]), + new TwigFilter('format_args_as_text', $this->formatArgsAsText(...)), + new TwigFilter('file_excerpt', $this->fileExcerpt(...), ['is_safe' => ['html']]), + new TwigFilter('format_file', $this->formatFile(...), ['is_safe' => ['html']]), + new TwigFilter('format_file_from_text', $this->formatFileFromText(...), ['is_safe' => ['html']]), + new TwigFilter('format_log_message', $this->formatLogMessage(...), ['is_safe' => ['html']]), + new TwigFilter('file_link', $this->getFileLink(...)), + new TwigFilter('file_relative', $this->getFileRelative(...)), ]; } diff --git a/src/Symfony/Bridge/Twig/Extension/DumpExtension.php b/src/Symfony/Bridge/Twig/Extension/DumpExtension.php index 1ce6593a13ec0..910fece83b9bb 100644 --- a/src/Symfony/Bridge/Twig/Extension/DumpExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/DumpExtension.php @@ -41,7 +41,7 @@ public function __construct(ClonerInterface $cloner, HtmlDumper $dumper = null) public function getFunctions(): array { return [ - new TwigFunction('dump', [$this, 'dump'], ['is_safe' => ['html'], 'needs_context' => true, 'needs_environment' => true]), + new TwigFunction('dump', $this->dump(...), ['is_safe' => ['html'], 'needs_context' => true, 'needs_environment' => true]), ]; } diff --git a/src/Symfony/Bridge/Twig/Extension/ExpressionExtension.php b/src/Symfony/Bridge/Twig/Extension/ExpressionExtension.php index 8d2a35c99f682..a30499620ea0f 100644 --- a/src/Symfony/Bridge/Twig/Extension/ExpressionExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/ExpressionExtension.php @@ -28,7 +28,7 @@ final class ExpressionExtension extends AbstractExtension public function getFunctions(): array { return [ - new TwigFunction('expression', [$this, 'createExpression']), + new TwigFunction('expression', $this->createExpression(...)), ]; } diff --git a/src/Symfony/Bridge/Twig/Extension/FormExtension.php b/src/Symfony/Bridge/Twig/Extension/FormExtension.php index fd9eaf9652d97..f3484ca7715d1 100644 --- a/src/Symfony/Bridge/Twig/Extension/FormExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/FormExtension.php @@ -68,12 +68,12 @@ public function getFunctions(): array new TwigFunction('form_end', null, ['node_class' => RenderBlockNode::class, 'is_safe' => ['html']]), new TwigFunction('csrf_token', [FormRenderer::class, 'renderCsrfToken']), new TwigFunction('form_parent', 'Symfony\Bridge\Twig\Extension\twig_get_form_parent'), - new TwigFunction('field_name', [$this, 'getFieldName']), - new TwigFunction('field_value', [$this, 'getFieldValue']), - new TwigFunction('field_label', [$this, 'getFieldLabel']), - new TwigFunction('field_help', [$this, 'getFieldHelp']), - new TwigFunction('field_errors', [$this, 'getFieldErrors']), - new TwigFunction('field_choices', [$this, 'getFieldChoices']), + new TwigFunction('field_name', $this->getFieldName(...)), + new TwigFunction('field_value', $this->getFieldValue(...)), + new TwigFunction('field_label', $this->getFieldLabel(...)), + new TwigFunction('field_help', $this->getFieldHelp(...)), + new TwigFunction('field_errors', $this->getFieldErrors(...)), + new TwigFunction('field_choices', $this->getFieldChoices(...)), ]; } diff --git a/src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php b/src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php index 365e11733c92b..104bd3231f773 100644 --- a/src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php @@ -36,8 +36,8 @@ public function __construct(UrlHelper $urlHelper) public function getFunctions(): array { return [ - new TwigFunction('absolute_url', [$this, 'generateAbsoluteUrl']), - new TwigFunction('relative_path', [$this, 'generateRelativePath']), + new TwigFunction('absolute_url', $this->generateAbsoluteUrl(...)), + new TwigFunction('relative_path', $this->generateRelativePath(...)), ]; } diff --git a/src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php b/src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php index 5b29b4896906e..3ac7582b8fbeb 100644 --- a/src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php @@ -35,8 +35,8 @@ public function __construct(LogoutUrlGenerator $generator) public function getFunctions(): array { return [ - new TwigFunction('logout_url', [$this, 'getLogoutUrl']), - new TwigFunction('logout_path', [$this, 'getLogoutPath']), + new TwigFunction('logout_url', $this->getLogoutUrl(...)), + new TwigFunction('logout_path', $this->getLogoutPath(...)), ]; } diff --git a/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php b/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php index 26591fd5533b5..3b3a2ac58e27b 100644 --- a/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php @@ -38,8 +38,8 @@ public function __construct(UrlGeneratorInterface $generator) public function getFunctions(): array { return [ - new TwigFunction('url', [$this, 'getUrl'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]), - new TwigFunction('path', [$this, 'getPath'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]), + new TwigFunction('url', $this->getUrl(...), ['is_safe_callback' => $this->isUrlGenerationSafe(...)]), + new TwigFunction('path', $this->getPath(...), ['is_safe_callback' => $this->isUrlGenerationSafe(...)]), ]; } diff --git a/src/Symfony/Bridge/Twig/Extension/SecurityExtension.php b/src/Symfony/Bridge/Twig/Extension/SecurityExtension.php index 3f24b82de5a17..de75f8ff35cd7 100644 --- a/src/Symfony/Bridge/Twig/Extension/SecurityExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/SecurityExtension.php @@ -75,9 +75,9 @@ public function getImpersonateExitPath(string $exitTo = null): string public function getFunctions(): array { return [ - new TwigFunction('is_granted', [$this, 'isGranted']), - new TwigFunction('impersonation_exit_url', [$this, 'getImpersonateExitUrl']), - new TwigFunction('impersonation_exit_path', [$this, 'getImpersonateExitPath']), + new TwigFunction('is_granted', $this->isGranted(...)), + new TwigFunction('impersonation_exit_url', $this->getImpersonateExitUrl(...)), + new TwigFunction('impersonation_exit_path', $this->getImpersonateExitPath(...)), ]; } } diff --git a/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php b/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php index 8371291d04f85..cbb7394e7d848 100644 --- a/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php @@ -64,7 +64,7 @@ public function getTranslator(): TranslatorInterface public function getFunctions(): array { return [ - new TwigFunction('t', [$this, 'createTranslatable']), + new TwigFunction('t', $this->createTranslatable(...)), ]; } @@ -74,7 +74,7 @@ public function getFunctions(): array public function getFilters(): array { return [ - new TwigFilter('trans', [$this, 'trans']), + new TwigFilter('trans', $this->trans(...)), ]; } diff --git a/src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php b/src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php index de2884a71b987..fcc34ecb5aad6 100644 --- a/src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php @@ -37,12 +37,12 @@ public function __construct(RequestStack $requestStack) public function getFunctions(): array { return [ - new TwigFunction('link', [$this, 'link']), - new TwigFunction('preload', [$this, 'preload']), - new TwigFunction('dns_prefetch', [$this, 'dnsPrefetch']), - new TwigFunction('preconnect', [$this, 'preconnect']), - new TwigFunction('prefetch', [$this, 'prefetch']), - new TwigFunction('prerender', [$this, 'prerender']), + new TwigFunction('link', $this->link(...)), + new TwigFunction('preload', $this->preload(...)), + new TwigFunction('dns_prefetch', $this->dnsPrefetch(...)), + new TwigFunction('preconnect', $this->preconnect(...)), + new TwigFunction('prefetch', $this->prefetch(...)), + new TwigFunction('prerender', $this->prerender(...)), ]; } diff --git a/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php b/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php index 2b13d29195afe..895faf457f648 100644 --- a/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php @@ -38,13 +38,13 @@ public function __construct(Registry $workflowRegistry) public function getFunctions(): array { return [ - new TwigFunction('workflow_can', [$this, 'canTransition']), - new TwigFunction('workflow_transitions', [$this, 'getEnabledTransitions']), - new TwigFunction('workflow_transition', [$this, 'getEnabledTransition']), - new TwigFunction('workflow_has_marked_place', [$this, 'hasMarkedPlace']), - new TwigFunction('workflow_marked_places', [$this, 'getMarkedPlaces']), - new TwigFunction('workflow_metadata', [$this, 'getMetadata']), - new TwigFunction('workflow_transition_blockers', [$this, 'buildTransitionBlockerList']), + new TwigFunction('workflow_can', $this->canTransition(...)), + new TwigFunction('workflow_transitions', $this->getEnabledTransitions(...)), + new TwigFunction('workflow_transition', $this->getEnabledTransition(...)), + new TwigFunction('workflow_has_marked_place', $this->hasMarkedPlace(...)), + new TwigFunction('workflow_marked_places', $this->getMarkedPlaces(...)), + new TwigFunction('workflow_metadata', $this->getMetadata(...)), + new TwigFunction('workflow_transition_blockers', $this->buildTransitionBlockerList(...)), ]; } diff --git a/src/Symfony/Bridge/Twig/Extension/YamlExtension.php b/src/Symfony/Bridge/Twig/Extension/YamlExtension.php index 919834e24a5d6..2d0595b7e9bca 100644 --- a/src/Symfony/Bridge/Twig/Extension/YamlExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/YamlExtension.php @@ -28,8 +28,8 @@ final class YamlExtension extends AbstractExtension public function getFilters(): array { return [ - new TwigFilter('yaml_encode', [$this, 'encode']), - new TwigFilter('yaml_dump', [$this, 'dump']), + new TwigFilter('yaml_encode', $this->encode(...)), + new TwigFilter('yaml_dump', $this->dump(...)), ]; } diff --git a/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php b/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php index 4a8b4d19c066e..c93bd718bc903 100644 --- a/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php @@ -41,7 +41,6 @@ public function testExtract($template, $messages) $catalogue = new MessageCatalogue('en'); $m = new \ReflectionMethod($extractor, 'extractTemplate'); - $m->setAccessible(true); $m->invoke($extractor, $template, $catalogue); if (0 === \count($messages)) { diff --git a/src/Symfony/Bridge/Twig/TokenParser/StopwatchTokenParser.php b/src/Symfony/Bridge/Twig/TokenParser/StopwatchTokenParser.php index f0b3ac2e9240e..b332485d02577 100644 --- a/src/Symfony/Bridge/Twig/TokenParser/StopwatchTokenParser.php +++ b/src/Symfony/Bridge/Twig/TokenParser/StopwatchTokenParser.php @@ -42,7 +42,7 @@ public function parse(Token $token): Node $stream->expect(Token::BLOCK_END_TYPE); // {% endstopwatch %} - $body = $this->parser->subparse([$this, 'decideStopwatchEnd'], true); + $body = $this->parser->subparse($this->decideStopwatchEnd(...), true); $stream->expect(Token::BLOCK_END_TYPE); if ($this->stopwatchIsAvailable) { diff --git a/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php b/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php index ffe8828590852..b440931bba794 100644 --- a/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php +++ b/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php @@ -69,7 +69,7 @@ public function parse(Token $token): Node // {% trans %}message{% endtrans %} $stream->expect(Token::BLOCK_END_TYPE); - $body = $this->parser->subparse([$this, 'decideTransFork'], true); + $body = $this->parser->subparse($this->decideTransFork(...), true); if (!$body instanceof TextNode && !$body instanceof AbstractExpression) { throw new SyntaxError('A message inside a trans tag must be a simple text.', $body->getTemplateLine(), $stream->getSourceContext()); diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json index 0765818346b6d..44fb5527abec1 100644 --- a/src/Symfony/Bridge/Twig/composer.json +++ b/src/Symfony/Bridge/Twig/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/translation-contracts": "^1.1|^2|^3", "twig/twig": "^2.13|^3.0.4" }, diff --git a/src/Symfony/Bundle/DebugBundle/composer.json b/src/Symfony/Bundle/DebugBundle/composer.json index a36dec760ce15..619db7d66feed 100644 --- a/src/Symfony/Bundle/DebugBundle/composer.json +++ b/src/Symfony/Bundle/DebugBundle/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "ext-xml": "*", "symfony/dependency-injection": "^5.4|^6.0", "symfony/http-kernel": "^5.4|^6.0", diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php index fd01616394763..8b8f986c4460a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php @@ -127,7 +127,6 @@ private function compileContainer(): ContainerBuilder $kernel->boot(); $method = new \ReflectionMethod($kernel, 'buildContainer'); - $method->setAccessible(true); $container = $method->invoke($kernel); $container->getCompiler()->compile($container); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php index b579998231215..c5c2da4a4407c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php @@ -132,7 +132,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $options = ['env-vars' => true, 'name' => $envVar]; } elseif ($input->getOption('types')) { $options = []; - $options['filter'] = [$this, 'filterToServiceTypes']; + $options['filter'] = $this->filterToServiceTypes(...); } elseif ($input->getOption('parameters')) { $parameters = []; foreach ($object->getParameterBag()->all() as $k => $v) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerLintCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerLintCommand.php index bb595e305f591..d0180ffad8ad5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerLintCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerLintCommand.php @@ -104,7 +104,6 @@ private function getContainerBuilder(): ContainerBuilder (new XmlFileLoader($container = new ContainerBuilder($parameterBag = new EnvPlaceholderParameterBag()), new FileLocator()))->load($kernelContainer->getParameter('debug.container.dump')); $refl = new \ReflectionProperty($parameterBag, 'resolved'); - $refl->setAccessible(true); $refl->setValue($parameterBag, true); $skippedIds = []; diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php index 58e7ae1b437c1..ecd507127c00c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php @@ -78,7 +78,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $builder = $this->getContainerBuilder($this->getApplication()->getKernel()); $serviceIds = $builder->getServiceIds(); - $serviceIds = array_filter($serviceIds, [$this, 'filterToServiceTypes']); + $serviceIds = array_filter($serviceIds, $this->filterToServiceTypes(...)); if ($search = $input->getArgument('search')) { $searchNormalized = preg_replace('/[^a-zA-Z0-9\x7f-\xff $]++/', '', $search); @@ -169,7 +169,7 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti if ($input->mustSuggestArgumentValuesFor('search')) { $builder = $this->getContainerBuilder($this->getApplication()->getKernel()); - $suggestions->suggestValues(array_filter($builder->getServiceIds(), [$this, 'filterToServiceTypes'])); + $suggestions->suggestValues(array_filter($builder->getServiceIds(), $this->filterToServiceTypes(...))); } } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php index c6545f70abaa2..c90a40987f30c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php @@ -326,7 +326,6 @@ private function getContainerEnvVars(ContainerBuilder $container): array $getDefaultParameter = $getDefaultParameter->bindTo($bag, \get_class($bag)); $getEnvReflection = new \ReflectionMethod($container, 'getEnv'); - $getEnvReflection->setAccessible(true); $envs = []; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index b179cbbee2a1f..f0b15e6522aff 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -248,7 +248,7 @@ public function load(array $configs, ContainerBuilder $container) $loader->load('web.php'); - if (\PHP_VERSION_ID < 80100 || !class_exists(BackedEnumValueResolver::class)) { + if (!class_exists(BackedEnumValueResolver::class)) { $container->removeDefinition('argument_resolver.backed_enum_resolver'); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php index b213019d3579a..aa0ff6243bdc0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php +++ b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php @@ -49,9 +49,9 @@ public function __construct(ContainerInterface $container, mixed $resource, arra $this->setOptions($options); if ($parameters) { - $this->paramFetcher = \Closure::fromCallable([$parameters, 'get']); + $this->paramFetcher = $parameters->get(...); } elseif ($container instanceof SymfonyContainerInterface) { - $this->paramFetcher = \Closure::fromCallable([$container, 'getParameter']); + $this->paramFetcher = $container->getParameter(...); } else { throw new \LogicException(sprintf('You should either pass a "%s" instance or provide the $parameters argument of the "%s" method.', SymfonyContainerInterface::class, __METHOD__)); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php index 8253c525df8f6..33ea1b357b466 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php @@ -151,10 +151,7 @@ public function testWarmupRemoveCacheMisses() $this->assertTrue(isset($data[0]['bar_hit'])); } - /** - * @return MockObject&Reader - */ - private function getReadOnlyReader(): Reader + private function getReadOnlyReader(): MockObject&Reader { $readerMock = $this->createMock(Reader::class); $readerMock->expects($this->exactly(0))->method('getClassAnnotations'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolClearCommandTest.php index 169fcd8c2d75d..722199f227296 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolClearCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolClearCommandTest.php @@ -52,10 +52,7 @@ public function provideCompletionSuggestions() ]; } - /** - * @return MockObject&KernelInterface - */ - private function getKernel(): KernelInterface + private function getKernel(): MockObject&KernelInterface { $container = $this->createMock(ContainerInterface::class); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php index f643bc1259901..24371b9f532dd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php @@ -106,10 +106,7 @@ public function provideCompletionSuggestions() ]; } - /** - * @return MockObject&KernelInterface - */ - private function getKernel(): KernelInterface + private function getKernel(): MockObject&KernelInterface { $container = $this->createMock(ContainerInterface::class); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePruneCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePruneCommandTest.php index 32d60124ebb5a..983956fcb9b82 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePruneCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePruneCommandTest.php @@ -50,10 +50,7 @@ private function getEmptyRewindableGenerator(): RewindableGenerator }, 0); } - /** - * @return MockObject&KernelInterface - */ - private function getKernel(): KernelInterface + private function getKernel(): MockObject&KernelInterface { $container = $this->createMock(ContainerInterface::class); @@ -71,10 +68,7 @@ private function getKernel(): KernelInterface return $kernel; } - /** - * @return MockObject&PruneableInterface - */ - private function getPruneableInterfaceMock(): PruneableInterface + private function getPruneableInterfaceMock(): MockObject&PruneableInterface { $pruneable = $this->createMock(PruneableInterface::class); $pruneable diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php index 3a38da0d14ed6..c4a674b669b18 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php @@ -122,9 +122,7 @@ public function getDescribeContainerDefinitionWithArgumentsShownTestData() $definitionsWithArgs[str_replace('definition_', 'definition_arguments_', $key)] = $definition; } - if (\PHP_VERSION_ID >= 80100) { - $definitionsWithArgs['definition_arguments_with_enum'] = (new Definition('definition_with_enum'))->setArgument(0, FooUnitEnum::FOO); - } + $definitionsWithArgs['definition_arguments_with_enum'] = (new Definition('definition_with_enum'))->setArgument(0, FooUnitEnum::FOO); return $this->getDescriptionTestData($definitionsWithArgs); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php index a9fc9252bf350..5987e7812a1f4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php @@ -71,10 +71,6 @@ public static function getContainerParameters() 'array' => [12, 'Hello world!', true], ]); - if (\PHP_VERSION_ID < 80100) { - return; - } - yield 'parameters_enums' => new ParameterBag([ 'unit_enum' => FooUnitEnum::BAR, 'backed_enum' => Suit::Hearts, @@ -259,7 +255,7 @@ public static function getCallables() 'callable_5' => ['Symfony\\Bundle\\FrameworkBundle\\Tests\\Console\\Descriptor\\ExtendedCallableClass', 'parent::staticMethod'], 'callable_6' => function () { return 'Closure'; }, 'callable_7' => new CallableClass(), - 'callable_from_callable' => \Closure::fromCallable(new CallableClass()), + 'callable_from_callable' => (new CallableClass())(...), ]; } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php index b3885edaa3f36..b01295607b17f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php @@ -86,7 +86,6 @@ public function testClearFailed() $pool->save($item); $r = new \ReflectionObject($pool); $p = $r->getProperty('directory'); - $p->setAccessible(true); $poolDir = $p->getValue($pool); /** @var SplFileInfo $entry */ diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index f86766ad51fcb..633f91d028976 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "composer-runtime-api": ">=2.1", "ext-xml": "*", "symfony/cache": "^5.4|^6.0", @@ -27,7 +27,6 @@ "symfony/http-foundation": "^5.4|^6.0", "symfony/http-kernel": "^5.4|^6.0", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php81": "^1.22", "symfony/filesystem": "^5.4|^6.0", "symfony/finder": "^5.4|^6.0", "symfony/routing": "^5.4|^6.0" diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/StaticTokenProvider.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/StaticTokenProvider.php index a51702eec15b6..24ff10a4d0199 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/StaticTokenProvider.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/StaticTokenProvider.php @@ -49,11 +49,9 @@ public function updateToken(string $series, string $tokenValue, \DateTime $lastU $token = $this->loadTokenBySeries($series); $refl = new \ReflectionClass($token); $tokenValueProp = $refl->getProperty('tokenValue'); - $tokenValueProp->setAccessible(true); $tokenValueProp->setValue($token, $tokenValue); $lastUsedProp = $refl->getProperty('lastUsed'); - $lastUsedProp->setAccessible(true); $lastUsedProp->setValue($token, $lastUsed); self::$db[$series] = $token; diff --git a/src/Symfony/Bundle/SecurityBundle/composer.json b/src/Symfony/Bundle/SecurityBundle/composer.json index 9f928c2c4fb57..9c3db8d752dc6 100644 --- a/src/Symfony/Bundle/SecurityBundle/composer.json +++ b/src/Symfony/Bundle/SecurityBundle/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "composer-runtime-api": ">=2.1", "ext-xml": "*", "symfony/config": "^5.4|^6.0", diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index 9d57d304ab5af..361e0b8b24d0c 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -225,7 +225,6 @@ public function testStopwatchExtensionAvailability($debug, $stopwatchEnabled, $e $tokenParsers = $container->get('test.twig.extension.debug.stopwatch')->getTokenParsers(); $stopwatchIsAvailable = new \ReflectionProperty($tokenParsers[0], 'stopwatchIsAvailable'); - $stopwatchIsAvailable->setAccessible(true); $this->assertSame($expected, $stopwatchIsAvailable->getValue($tokenParsers[0])); } diff --git a/src/Symfony/Bundle/TwigBundle/composer.json b/src/Symfony/Bundle/TwigBundle/composer.json index f2ed7227ab62d..379d95c2fd3cb 100644 --- a/src/Symfony/Bundle/TwigBundle/composer.json +++ b/src/Symfony/Bundle/TwigBundle/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "composer-runtime-api": ">=2.1", "symfony/config": "^5.4|^6.0", "symfony/dependency-injection": "^5.4|^6.0", diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php index dd2de44bc350f..845d141354ca3 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php @@ -32,7 +32,6 @@ public function testInjectToolbar($content, $expected) { $listener = new WebDebugToolbarListener($this->getTwigMock()); $m = new \ReflectionMethod($listener, 'injectToolbar'); - $m->setAccessible(true); $response = new Response($content); diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php index d65c1f81080aa..4ad4070d3cee3 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php @@ -68,7 +68,7 @@ public function testGetNameValidTemplate() $this->profiler->expects($this->any()) ->method('has') ->withAnyParameters() - ->willReturnCallback([$this, 'profilerHasCallback']); + ->willReturnCallback($this->profilerHasCallback(...)); $this->assertEquals('@Foo/Collector/foo.html.twig', $this->templateManager->getName(new ProfileDummy(), 'foo')); } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php b/src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php index 8a8721a3a1516..c29b4c4f52911 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php @@ -66,8 +66,8 @@ public function leave(Profile $profile): void public function getFunctions(): array { return [ - new TwigFunction('profiler_dump', [$this, 'dumpData'], ['is_safe' => ['html'], 'needs_environment' => true]), - new TwigFunction('profiler_dump_log', [$this, 'dumpLog'], ['is_safe' => ['html'], 'needs_environment' => true]), + new TwigFunction('profiler_dump', $this->dumpData(...), ['is_safe' => ['html'], 'needs_environment' => true]), + new TwigFunction('profiler_dump_log', $this->dumpLog(...), ['is_safe' => ['html'], 'needs_environment' => true]), ]; } diff --git a/src/Symfony/Bundle/WebProfilerBundle/composer.json b/src/Symfony/Bundle/WebProfilerBundle/composer.json index 53353c440a28c..9b425459b21ba 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/composer.json +++ b/src/Symfony/Bundle/WebProfilerBundle/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/config": "^5.4|^6.0", "symfony/framework-bundle": "^5.4|^6.0", "symfony/http-kernel": "^5.4|^6.0", diff --git a/src/Symfony/Component/Asset/composer.json b/src/Symfony/Component/Asset/composer.json index bc28a18cb7c78..4759be09b3571 100644 --- a/src/Symfony/Component/Asset/composer.json +++ b/src/Symfony/Component/Asset/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "suggest": { "symfony/http-foundation": "" diff --git a/src/Symfony/Component/BrowserKit/composer.json b/src/Symfony/Component/BrowserKit/composer.json index 1cb02cdd18d8b..357064ec006c9 100644 --- a/src/Symfony/Component/BrowserKit/composer.json +++ b/src/Symfony/Component/BrowserKit/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/dom-crawler": "^5.4|^6.0" }, "require-dev": { diff --git a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php index 86ed7e65c4c0e..666e6049a858e 100644 --- a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php @@ -147,7 +147,7 @@ public static function createConnection(string $dsn, array $options = []) public function commit(): bool { $ok = true; - $byLifetime = (self::$mergeByLifetime)($this->deferred, $this->namespace, $expiredIds, \Closure::fromCallable([$this, 'getId']), $this->defaultLifetime); + $byLifetime = (self::$mergeByLifetime)($this->deferred, $this->namespace, $expiredIds, $this->getId(...), $this->defaultLifetime); $retry = $this->deferred = []; if ($expiredIds) { diff --git a/src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php index 565bc9b8fad68..65a33a9b0ee7e 100644 --- a/src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php @@ -170,7 +170,7 @@ protected function doDeleteYieldTags(array $ids): iterable public function commit(): bool { $ok = true; - $byLifetime = (self::$mergeByLifetime)($this->deferred, $expiredIds, \Closure::fromCallable([$this, 'getId']), self::TAGS_PREFIX, $this->defaultLifetime); + $byLifetime = (self::$mergeByLifetime)($this->deferred, $expiredIds, $this->getId(...), self::TAGS_PREFIX, $this->defaultLifetime); $retry = $this->deferred = []; if ($expiredIds) { diff --git a/src/Symfony/Component/Cache/Messenger/EarlyExpirationDispatcher.php b/src/Symfony/Component/Cache/Messenger/EarlyExpirationDispatcher.php index 5aeacf1d598ef..9b94c4f1b28bb 100644 --- a/src/Symfony/Component/Cache/Messenger/EarlyExpirationDispatcher.php +++ b/src/Symfony/Component/Cache/Messenger/EarlyExpirationDispatcher.php @@ -31,7 +31,7 @@ public function __construct(MessageBusInterface $bus, ReverseContainer $reverseC { $this->bus = $bus; $this->reverseContainer = $reverseContainer; - $this->callbackWrapper = null === $callbackWrapper || $callbackWrapper instanceof \Closure ? $callbackWrapper : \Closure::fromCallable($callbackWrapper); + $this->callbackWrapper = null === $callbackWrapper ? null : $callbackWrapper(...); } public function __invoke(callable $callback, CacheItem $item, bool &$save, AdapterInterface $pool, \Closure $setMetadata, LoggerInterface $logger = null) diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php index 0734e9818cc47..79f0719f679aa 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php @@ -205,7 +205,6 @@ public function testExpirationOnAllAdapters() $itemValidator = function (CacheItem $item) { $refl = new \ReflectionObject($item); $propExpiry = $refl->getProperty('expiry'); - $propExpiry->setAccessible(true); $expiry = $propExpiry->getValue($item); $this->assertGreaterThan(10, $expiry - time(), 'Item should be saved with the given ttl, not the default for the adapter.'); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/DoctrineDbalAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/DoctrineDbalAdapterTest.php index cf8a60a598ae9..67f14fd66b51a 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/DoctrineDbalAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/DoctrineDbalAdapterTest.php @@ -136,7 +136,6 @@ protected function isPruned(DoctrineDbalAdapter $cache, string $name): bool { $o = new \ReflectionObject($cache); $connProp = $o->getProperty('conn'); - $connProp->setAccessible(true); /** @var Connection $conn */ $conn = $connProp->getValue($cache); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php index 74c6ee870477f..848d164115038 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php @@ -33,7 +33,6 @@ public static function tearDownAfterClass(): void protected function isPruned(CacheItemPoolInterface $cache, string $name): bool { $getFileMethod = (new \ReflectionObject($cache))->getMethod('getFile'); - $getFileMethod->setAccessible(true); return !file_exists($getFileMethod->invoke($cache, $name)); } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/MaxIdLengthAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/MaxIdLengthAdapterTest.php index 00a288e01b45b..7f91101eb5b97 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/MaxIdLengthAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/MaxIdLengthAdapterTest.php @@ -48,7 +48,6 @@ public function testLongKeyVersioning() $reflectionClass = new \ReflectionClass(AbstractAdapter::class); $reflectionMethod = $reflectionClass->getMethod('getId'); - $reflectionMethod->setAccessible(true); // No versioning enabled $this->assertEquals('--------------------------:------------', $reflectionMethod->invokeArgs($cache, [str_repeat('-', 12)])); @@ -57,7 +56,6 @@ public function testLongKeyVersioning() $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 40)]))); $reflectionProperty = $reflectionClass->getProperty('versioningIsEnabled'); - $reflectionProperty->setAccessible(true); $reflectionProperty->setValue($cache, true); // Versioning enabled diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php index 27429f33c9022..9752faab3aba9 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php @@ -101,7 +101,6 @@ protected function isPruned(PdoAdapter $cache, string $name): bool $o = new \ReflectionObject($cache); $getPdoConn = $o->getMethod('getConnection'); - $getPdoConn->setAccessible(true); /** @var \PDOStatement $select */ $select = $getPdoConn->invoke($cache)->prepare('SELECT 1 FROM cache_items WHERE item_id LIKE :id'); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterTest.php index e084114e48625..c645bbc3b1eca 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterTest.php @@ -37,7 +37,6 @@ public static function tearDownAfterClass(): void protected function isPruned(CacheItemPoolInterface $cache, string $name): bool { $getFileMethod = (new \ReflectionObject($cache))->getMethod('getFile'); - $getFileMethod->setAccessible(true); return !file_exists($getFileMethod->invoke($cache, $name)); } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php index 0f83ba364a281..6d430ae8cad21 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php @@ -180,10 +180,7 @@ public function testGetItemReturnsCacheMissWhenPoolDoesNotHaveItemAndOnlyHasTags $this->assertFalse($item->isHit()); } - /** - * @return PruneableInterface&MockObject - */ - private function getPruneableMock(): PruneableInterface + private function getPruneableMock(): PruneableInterface&MockObject { $pruneable = $this->createMock(PrunableAdapter::class); @@ -195,10 +192,7 @@ private function getPruneableMock(): PruneableInterface return $pruneable; } - /** - * @return PruneableInterface&MockObject - */ - private function getFailingPruneableMock(): PruneableInterface + private function getFailingPruneableMock(): PruneableInterface&MockObject { $pruneable = $this->createMock(PrunableAdapter::class); @@ -210,10 +204,7 @@ private function getFailingPruneableMock(): PruneableInterface return $pruneable; } - /** - * @return AdapterInterface&MockObject - */ - private function getNonPruneableMock(): AdapterInterface + private function getNonPruneableMock(): AdapterInterface&MockObject { return $this->createMock(AdapterInterface::class); } diff --git a/src/Symfony/Component/Cache/Tests/CacheItemTest.php b/src/Symfony/Component/Cache/Tests/CacheItemTest.php index bf9afc56c2702..12337f67b993a 100644 --- a/src/Symfony/Component/Cache/Tests/CacheItemTest.php +++ b/src/Symfony/Component/Cache/Tests/CacheItemTest.php @@ -59,7 +59,6 @@ public function testTag() { $item = new CacheItem(); $r = new \ReflectionProperty($item, 'isTaggable'); - $r->setAccessible(true); $r->setValue($item, true); $this->assertSame($item, $item->tag('foo')); @@ -81,7 +80,6 @@ public function testInvalidTag($tag) $this->expectExceptionMessage('Cache tag'); $item = new CacheItem(); $r = new \ReflectionProperty($item, 'isTaggable'); - $r->setAccessible(true); $r->setValue($item, true); $item->tag($tag); @@ -93,7 +91,6 @@ public function testNonTaggableItem() $this->expectExceptionMessage('Cache item "foo" comes from a non tag-aware pool: you cannot tag it.'); $item = new CacheItem(); $r = new \ReflectionProperty($item, 'key'); - $r->setAccessible(true); $r->setValue($item, 'foo'); $item->tag([]); diff --git a/src/Symfony/Component/Cache/Tests/Messenger/EarlyExpirationHandlerTest.php b/src/Symfony/Component/Cache/Tests/Messenger/EarlyExpirationHandlerTest.php index f42bca5525aff..66df7ed9d4d60 100644 --- a/src/Symfony/Component/Cache/Tests/Messenger/EarlyExpirationHandlerTest.php +++ b/src/Symfony/Component/Cache/Tests/Messenger/EarlyExpirationHandlerTest.php @@ -62,7 +62,7 @@ public function __invoke(CacheItem $item) $handler($msg); - $this->assertSame(123, $pool->get('foo', [$this, 'fail'], 0.0, $metadata)); + $this->assertSame(123, $pool->get('foo', $this->fail(...), 0.0, $metadata)); $this->assertGreaterThan(25, $metadata['ctime']); $this->assertGreaterThan(time(), $metadata['expiry']); diff --git a/src/Symfony/Component/Cache/Tests/Psr16CacheTest.php b/src/Symfony/Component/Cache/Tests/Psr16CacheTest.php index cd4375c441fc0..562d6e11bf50b 100644 --- a/src/Symfony/Component/Cache/Tests/Psr16CacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Psr16CacheTest.php @@ -169,7 +169,6 @@ protected function isPruned(CacheInterface $cache, string $name): bool $pool = ((array) $cache)[sprintf("\0%s\0pool", Psr16Cache::class)]; $getFileMethod = (new \ReflectionObject($pool))->getMethod('getFile'); - $getFileMethod->setAccessible(true); return !file_exists($getFileMethod->invoke($pool, $name)); } diff --git a/src/Symfony/Component/Cache/Traits/ContractsTrait.php b/src/Symfony/Component/Cache/Traits/ContractsTrait.php index 7864e5a15d406..76934ff11bb9f 100644 --- a/src/Symfony/Component/Cache/Traits/ContractsTrait.php +++ b/src/Symfony/Component/Cache/Traits/ContractsTrait.php @@ -31,10 +31,7 @@ trait ContractsTrait doGet as private contractsGet; } - /** - * @var callable - */ - private $callbackWrapper; + private \Closure $callbackWrapper; private array $computing = []; /** @@ -45,7 +42,7 @@ trait ContractsTrait public function setCallbackWrapper(?callable $callbackWrapper): callable { if (!isset($this->callbackWrapper)) { - $this->callbackWrapper = [LockRegistry::class, 'compute']; + $this->callbackWrapper = LockRegistry::compute(...); if (\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) { $this->setCallbackWrapper(null); @@ -53,7 +50,7 @@ public function setCallbackWrapper(?callable $callbackWrapper): callable } if (null !== $callbackWrapper && !$callbackWrapper instanceof \Closure) { - $callbackWrapper = \Closure::fromCallable($callbackWrapper); + $callbackWrapper = $callbackWrapper(...); } $previousWrapper = $this->callbackWrapper; @@ -85,7 +82,7 @@ static function (CacheItem $item, float $startTime, ?array &$metadata) { CacheItem::class ); - $this->callbackWrapper ??= \Closure::fromCallable([LockRegistry::class, 'compute']); + $this->callbackWrapper ??= LockRegistry::compute(...); return $this->contractsGet($pool, $key, function (CacheItem $item, bool &$save) use ($pool, $callback, $setMetadata, &$metadata, $key) { // don't wrap nor save recursive calls diff --git a/src/Symfony/Component/Cache/composer.json b/src/Symfony/Component/Cache/composer.json index 8969c33192055..39a620c774c44 100644 --- a/src/Symfony/Component/Cache/composer.json +++ b/src/Symfony/Component/Cache/composer.json @@ -21,7 +21,7 @@ "symfony/cache-implementation": "1.1|2.0|3.0" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/cache": "^2.0|^3.0", "psr/log": "^1.1|^2|^3", "symfony/cache-contracts": "^1.1.7|^2|^3", diff --git a/src/Symfony/Component/Config/Builder/ConfigBuilderGenerator.php b/src/Symfony/Component/Config/Builder/ConfigBuilderGenerator.php index d0020efb240ae..7b1221c714952 100644 --- a/src/Symfony/Component/Config/Builder/ConfigBuilderGenerator.php +++ b/src/Symfony/Component/Config/Builder/ConfigBuilderGenerator.php @@ -64,14 +64,12 @@ public function NAME(): string $this->writeClasses(); } - $loader = \Closure::fromCallable(function () use ($path, $rootClass) { + return function () use ($path, $rootClass) { require_once $path; $className = $rootClass->getFqcn(); return new $className(); - }); - - return $loader; + }; } private function getFullPath(ClassBuilder $class): string diff --git a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php index c948ca558f1f5..22b4309e98464 100644 --- a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php +++ b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php @@ -221,7 +221,6 @@ public static function throwOnRequiredClass(string $class, \Exception $previous foreach ($props as $p => $v) { if (null !== $v) { $r = new \ReflectionProperty(\Exception::class, $p); - $r->setAccessible(true); $r->setValue($e, $v); } } diff --git a/src/Symfony/Component/Config/Resource/ReflectionClassResource.php b/src/Symfony/Component/Config/Resource/ReflectionClassResource.php index 6381d70bb3674..050c665a3b91e 100644 --- a/src/Symfony/Component/Config/Resource/ReflectionClassResource.php +++ b/src/Symfony/Component/Config/Resource/ReflectionClassResource.php @@ -121,7 +121,7 @@ private function generateSignature(\ReflectionClass $class): iterable { $attributes = []; foreach ($class->getAttributes() as $a) { - $attributes[] = [$a->getName(), \PHP_VERSION_ID >= 80100 ? (string) $a : $a->getArguments()]; + $attributes[] = [$a->getName(), (string) $a]; } yield print_r($attributes, true); $attributes = []; @@ -143,7 +143,7 @@ private function generateSignature(\ReflectionClass $class): iterable foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) { foreach ($p->getAttributes() as $a) { - $attributes[] = [$a->getName(), \PHP_VERSION_ID >= 80100 ? (string) $a : $a->getArguments()]; + $attributes[] = [$a->getName(), (string) $a]; } yield print_r($attributes, true); $attributes = []; @@ -161,16 +161,15 @@ private function generateSignature(\ReflectionClass $class): iterable foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $m) { foreach ($m->getAttributes() as $a) { - $attributes[] = [$a->getName(), \PHP_VERSION_ID >= 80100 ? (string) $a : $a->getArguments()]; + $attributes[] = [$a->getName(), (string) $a]; } yield print_r($attributes, true); $attributes = []; $defaults = []; - $parametersWithUndefinedConstants = []; foreach ($m->getParameters() as $p) { foreach ($p->getAttributes() as $a) { - $attributes[] = [$a->getName(), \PHP_VERSION_ID >= 80100 ? (string) $a : $a->getArguments()]; + $attributes[] = [$a->getName(), (string) $a]; } yield print_r($attributes, true); $attributes = []; @@ -181,55 +180,10 @@ private function generateSignature(\ReflectionClass $class): iterable continue; } - if (\PHP_VERSION_ID >= 80100) { - $defaults[$p->name] = (string) $p; - - continue; - } - - if (!$p->isDefaultValueConstant() || $defined($p->getDefaultValueConstantName())) { - $defaults[$p->name] = $p->getDefaultValue(); - - continue; - } - - $defaults[$p->name] = $p->getDefaultValueConstantName(); - $parametersWithUndefinedConstants[$p->name] = true; - } - - if (!$parametersWithUndefinedConstants) { - yield preg_replace('/^ @@.*/m', '', $m); - } else { - $t = $m->getReturnType(); - $stack = [ - $m->getDocComment(), - $m->getName(), - $m->isAbstract(), - $m->isFinal(), - $m->isStatic(), - $m->isPublic(), - $m->isPrivate(), - $m->isProtected(), - $m->returnsReference(), - $t instanceof \ReflectionNamedType ? ((string) $t->allowsNull()).$t->getName() : (string) $t, - ]; - - foreach ($m->getParameters() as $p) { - if (!isset($parametersWithUndefinedConstants[$p->name])) { - $stack[] = (string) $p; - } else { - $t = $p->getType(); - $stack[] = $p->isOptional(); - $stack[] = $t instanceof \ReflectionNamedType ? ((string) $t->allowsNull()).$t->getName() : (string) $t; - $stack[] = $p->isPassedByReference(); - $stack[] = $p->isVariadic(); - $stack[] = $p->getName(); - } - } - - yield implode(',', $stack); + $defaults[$p->name] = (string) $p; } + yield preg_replace('/^ @@.*/m', '', $m); yield print_r($defaults, true); } diff --git a/src/Symfony/Component/Config/Tests/ConfigCacheTest.php b/src/Symfony/Component/Config/Tests/ConfigCacheTest.php index 79de702224e0a..182f941c3f1d6 100644 --- a/src/Symfony/Component/Config/Tests/ConfigCacheTest.php +++ b/src/Symfony/Component/Config/Tests/ConfigCacheTest.php @@ -71,7 +71,6 @@ public function testIsFreshWhenNoResourceProvided(bool $debug) public function testFreshResourceInDebug() { $p = (new \ReflectionClass(SelfCheckingResourceChecker::class))->getProperty('cache'); - $p->setAccessible(true); $p->setValue(SelfCheckingResourceChecker::class, []); $freshResource = new ResourceStub(); @@ -86,7 +85,6 @@ public function testFreshResourceInDebug() public function testStaleResourceInDebug() { $p = (new \ReflectionClass(SelfCheckingResourceChecker::class))->getProperty('cache'); - $p->setAccessible(true); $p->setValue(SelfCheckingResourceChecker::class, []); $staleResource = new ResourceStub(); diff --git a/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php index aae845c5346a7..354ba5a97dbc8 100644 --- a/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php @@ -90,7 +90,6 @@ public function testPreNormalize(array $denormalized, array $normalized) $node = new ArrayNode('foo'); $r = new \ReflectionMethod($node, 'preNormalize'); - $r->setAccessible(true); $this->assertSame($normalized, $r->invoke($node, $denormalized)); } @@ -132,7 +131,6 @@ public function testNodeNameCanBeZero(array $denormalized, array $normalized) $rootNode->addChild($fiveNode); $rootNode->addChild(new ScalarNode('string_key')); $r = new \ReflectionMethod($rootNode, 'normalizeValue'); - $r->setAccessible(true); $this->assertSame($normalized, $r->invoke($rootNode, $denormalized)); } @@ -179,7 +177,6 @@ public function testChildrenOrderIsMaintainedOnNormalizeValue(array $prenormaliz $node->addChild($scalar2); $r = new \ReflectionMethod($node, 'normalizeValue'); - $r->setAccessible(true); $this->assertSame($normalized, $r->invoke($node, $prenormalized)); } @@ -278,7 +275,6 @@ public function testMergeWithoutIgnoringExtraKeys(array $prenormalizeds) $node->setIgnoreExtraKeys(false); $r = new \ReflectionMethod($node, 'mergeValues'); - $r->setAccessible(true); $r->invoke($node, ...$prenormalizeds); } @@ -296,7 +292,6 @@ public function testMergeWithIgnoringAndRemovingExtraKeys(array $prenormalizeds) $node->setIgnoreExtraKeys(true); $r = new \ReflectionMethod($node, 'mergeValues'); - $r->setAccessible(true); $r->invoke($node, ...$prenormalizeds); } @@ -312,7 +307,6 @@ public function testMergeWithIgnoringExtraKeys(array $prenormalizeds, array $mer $node->setIgnoreExtraKeys(true, false); $r = new \ReflectionMethod($node, 'mergeValues'); - $r->setAccessible(true); $this->assertEquals($merged, $r->invoke($node, ...$prenormalizeds)); } diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php index 45e3ccf5de249..a57a0c12c0890 100644 --- a/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php @@ -438,7 +438,6 @@ protected function assertNode(string $expectedName, string $expectedType, NodeDe protected function getField(object $object, string $field) { $reflection = new \ReflectionProperty($object, $field); - $reflection->setAccessible(true); return $reflection->getValue($object); } diff --git a/src/Symfony/Component/Config/Tests/FileLocatorTest.php b/src/Symfony/Component/Config/Tests/FileLocatorTest.php index ced35690990b1..638535ef3481c 100644 --- a/src/Symfony/Component/Config/Tests/FileLocatorTest.php +++ b/src/Symfony/Component/Config/Tests/FileLocatorTest.php @@ -25,7 +25,6 @@ public function testIsAbsolutePath(string $path) $loader = new FileLocator([]); $r = new \ReflectionObject($loader); $m = $r->getMethod('isAbsolutePath'); - $m->setAccessible(true); $this->assertTrue($m->invoke($loader, $path), '->isAbsolutePath() returns true for an absolute path'); } diff --git a/src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php index fd317eb55c067..ed823584d7564 100644 --- a/src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php @@ -172,7 +172,6 @@ public function testBraceFallback() $resource = new GlobResource($dir, '/*{/*/*.txt,.x{m,n}l}', true); $p = new \ReflectionProperty($resource, 'globBrace'); - $p->setAccessible(true); $p->setValue($resource, 0); $expected = [ @@ -190,7 +189,6 @@ public function testUnbalancedBraceFallback() $resource = new GlobResource($dir, '/*{/*/*.txt,.x{m,nl}', true); $p = new \ReflectionProperty($resource, 'globBrace'); - $p->setAccessible(true); $p->setValue($resource, 0); $this->assertSame([], array_keys(iterator_to_array($resource))); @@ -204,7 +202,6 @@ public function testSerializeUnserialize() $newResource = unserialize(serialize($resource)); $p = new \ReflectionProperty($resource, 'globBrace'); - $p->setAccessible(true); $this->assertEquals($p->getValue($resource), $p->getValue($newResource)); } diff --git a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php index c6d52a147a745..370a9efae8614 100644 --- a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php @@ -98,7 +98,6 @@ public function testHashedSignature(bool $changeExpected, int $changedLine, ?str eval(sprintf($code, $class = 'Foo'.str_replace('.', '_', uniqid('', true)))); $r = new \ReflectionClass(ReflectionClassResource::class); $generateSignature = $r->getMethod('generateSignature'); - $generateSignature->setAccessible(true); $generateSignature = $generateSignature->getClosure($r->newInstanceWithoutConstructor()); $expectedSignature = implode("\n", iterator_to_array($generateSignature(new \ReflectionClass($class)))); } @@ -122,11 +121,7 @@ public function provideHashedSignature(): iterable yield [false, 0, "// line change\n\n"]; yield [true, 0, '/** class docblock */']; yield [true, 0, '#[Foo]']; - - if (\PHP_VERSION_ID >= 80100) { - yield [true, 0, '#[Foo(new MissingClass)]']; - } - + yield [true, 0, '#[Foo(new MissingClass)]']; yield [true, 1, 'abstract class %s']; yield [true, 1, 'final class %s']; yield [true, 1, 'class %s extends Exception']; @@ -136,11 +131,7 @@ public function provideHashedSignature(): iterable yield [true, 4, '/** pub docblock */']; yield [true, 5, 'protected $pub = [];']; yield [true, 5, 'public $pub = [123];']; - - if (\PHP_VERSION_ID >= 80100) { - yield [true, 5, '#[Foo(new MissingClass)] public $pub = [];']; - } - + yield [true, 5, '#[Foo(new MissingClass)] public $pub = [];']; yield [true, 6, '/** prot docblock */']; yield [true, 7, 'private $prot;']; yield [false, 8, '/** priv docblock */']; @@ -153,12 +144,8 @@ public function provideHashedSignature(): iterable yield [true, 13, 'protected function prot($a = [123]) {}']; yield [true, 13, '#[Foo] protected function prot($a = []) {}']; yield [true, 13, 'protected function prot(#[Foo] $a = []) {}']; - - if (\PHP_VERSION_ID >= 80100) { - yield [true, 13, '#[Foo(new MissingClass)] protected function prot($a = []) {}']; - yield [true, 13, 'protected function prot(#[Foo(new MissingClass)] $a = []) {}']; - } - + yield [true, 13, '#[Foo(new MissingClass)] protected function prot($a = []) {}']; + yield [true, 13, 'protected function prot(#[Foo(new MissingClass)] $a = []) {}']; yield [false, 14, '/** priv docblock */']; yield [false, 15, '']; @@ -167,17 +154,13 @@ public function provideHashedSignature(): iterable yield [true, 5, 'public array $pub;']; yield [false, 7, 'protected int $prot;']; yield [false, 9, 'private string $priv;']; - - if (\PHP_VERSION_ID >= 80100) { - yield [true, 17, 'public function __construct(private $bar = new \stdClass()) {}']; - yield [true, 17, 'public function ccc($bar = new \stdClass()) {}']; - yield [true, 17, 'public function ccc($bar = new MissingClass()) {}']; - } - + yield [true, 17, 'public function __construct(private $bar = new \stdClass()) {}']; + yield [true, 17, 'public function ccc($bar = new \stdClass()) {}']; + yield [true, 17, 'public function ccc($bar = new MissingClass()) {}']; yield [true, 17, 'public function ccc($bar = 187) {}']; yield [true, 17, 'public function ccc($bar = ANOTHER_ONE_THAT_WILL_NEVER_BE_DEFINED_CCCCCCCCC) {}']; yield [true, 17, 'public function ccc($bar = parent::BOOM) {}']; - yield [\PHP_VERSION_ID < 80100, 17, null, static function () { \define('A_CONSTANT_THAT_FOR_SURE_WILL_NEVER_BE_DEFINED_CCCCCC', 'foo'); }]; + yield [false, 17, null, static function () { \define('A_CONSTANT_THAT_FOR_SURE_WILL_NEVER_BE_DEFINED_CCCCCC', 'foo'); }]; } public function testEventSubscriber() diff --git a/src/Symfony/Component/Config/composer.json b/src/Symfony/Component/Config/composer.json index 1375ad83582a7..85d842a533162 100644 --- a/src/Symfony/Component/Config/composer.json +++ b/src/Symfony/Component/Config/composer.json @@ -16,11 +16,10 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/deprecation-contracts": "^2.1|^3", "symfony/filesystem": "^5.4|^6.0", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php81": "^1.22" + "symfony/polyfill-ctype": "~1.8" }, "require-dev": { "symfony/event-dispatcher": "^5.4|^6.0", @@ -30,7 +29,7 @@ "symfony/yaml": "^5.4|^6.0" }, "conflict": { - "symfony/finder": "<4.4" + "symfony/finder": "<5.4" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index e84307207a92f..147682e1e954c 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -350,7 +350,7 @@ public function setCode(callable $code): static } } } else { - $code = \Closure::fromCallable($code); + $code = $code(...); } $this->code = $code; diff --git a/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php b/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php index 19bd4bfddf4c5..d4a6912162310 100644 --- a/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php +++ b/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php @@ -47,7 +47,6 @@ public function setExitCode(int $exitCode): void $this->exitCode = $exitCode; $r = new \ReflectionProperty($this->error, 'code'); - $r->setAccessible(true); $r->setValue($this->error, $this->exitCode); } diff --git a/src/Symfony/Component/Console/Input/ArrayInput.php b/src/Symfony/Component/Console/Input/ArrayInput.php index fdb47df4de4a4..369eb0ca4147f 100644 --- a/src/Symfony/Component/Console/Input/ArrayInput.php +++ b/src/Symfony/Component/Console/Input/ArrayInput.php @@ -115,7 +115,7 @@ public function __toString(): string $params[] = $param.('' != $val ? $glue.$this->escapeToken($val) : ''); } } else { - $params[] = \is_array($val) ? implode(' ', array_map([$this, 'escapeToken'], $val)) : $this->escapeToken($val); + $params[] = \is_array($val) ? implode(' ', array_map($this->escapeToken(...), $val)) : $this->escapeToken($val); } } diff --git a/src/Symfony/Component/Console/Question/Question.php b/src/Symfony/Component/Console/Question/Question.php index f25e938a83197..972732b394be8 100644 --- a/src/Symfony/Component/Console/Question/Question.php +++ b/src/Symfony/Component/Console/Question/Question.php @@ -182,7 +182,7 @@ public function setAutocompleterCallback(callable $callback = null): static throw new LogicException('A hidden question cannot use the autocompleter.'); } - $this->autocompleterCallback = null === $callback || $callback instanceof \Closure ? $callback : \Closure::fromCallable($callback); + $this->autocompleterCallback = null === $callback ? null : $callback(...); return $this; } @@ -194,7 +194,7 @@ public function setAutocompleterCallback(callable $callback = null): static */ public function setValidator(callable $validator = null): static { - $this->validator = null === $validator || $validator instanceof \Closure ? $validator : \Closure::fromCallable($validator); + $this->validator = null === $validator ? null : $validator(...); return $this; } @@ -246,7 +246,7 @@ public function getMaxAttempts(): ?int */ public function setNormalizer(callable $normalizer): static { - $this->normalizer = $normalizer instanceof \Closure ? $normalizer : \Closure::fromCallable($normalizer); + $this->normalizer = $normalizer(...); return $this; } diff --git a/src/Symfony/Component/Console/SignalRegistry/SignalRegistry.php b/src/Symfony/Component/Console/SignalRegistry/SignalRegistry.php index 0833c7ea28856..ef2e5f04e16d6 100644 --- a/src/Symfony/Component/Console/SignalRegistry/SignalRegistry.php +++ b/src/Symfony/Component/Console/SignalRegistry/SignalRegistry.php @@ -34,7 +34,7 @@ public function register(int $signal, callable $signalHandler): void $this->signalHandlers[$signal][] = $signalHandler; - pcntl_signal($signal, [$this, 'handle']); + pcntl_signal($signal, $this->handle(...)); } public static function isSupported(): bool diff --git a/src/Symfony/Component/Console/Tester/TesterTrait.php b/src/Symfony/Component/Console/Tester/TesterTrait.php index 0d2a371e4b327..9670a49686e26 100644 --- a/src/Symfony/Component/Console/Tester/TesterTrait.php +++ b/src/Symfony/Component/Console/Tester/TesterTrait.php @@ -152,12 +152,10 @@ private function initOutput(array $options) $reflectedOutput = new \ReflectionObject($this->output); $strErrProperty = $reflectedOutput->getProperty('stderr'); - $strErrProperty->setAccessible(true); $strErrProperty->setValue($this->output, $errorOutput); $reflectedParent = $reflectedOutput->getParentClass(); $streamProperty = $reflectedParent->getProperty('stream'); - $streamProperty->setAccessible(true); $streamProperty->setValue($this->output, fopen('php://memory', 'w', false)); } } diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index 77764de3cdbc1..1983ccc4bef30 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -234,7 +234,6 @@ public function testHasGet() // simulate --help $r = new \ReflectionObject($application); $p = $r->getProperty('wantHelps'); - $p->setAccessible(true); $p->setValue($application, true); $command = $application->get('foo:bar'); $this->assertInstanceOf(HelpCommand::class, $command, '->get() returns the help command if --help is provided as the input'); diff --git a/src/Symfony/Component/Console/Tests/Command/CommandTest.php b/src/Symfony/Component/Console/Tests/Command/CommandTest.php index 044cb2037f35d..1d0a383de7d82 100644 --- a/src/Symfony/Component/Console/Tests/Command/CommandTest.php +++ b/src/Symfony/Component/Console/Tests/Command/CommandTest.php @@ -230,7 +230,6 @@ public function testMergeApplicationDefinition() $r = new \ReflectionObject($command); $m = $r->getMethod('mergeApplicationDefinition'); - $m->setAccessible(true); $m->invoke($command); $this->assertTrue($command->getDefinition()->hasArgument('foo'), '->mergeApplicationDefinition() merges the application arguments and the command arguments'); $this->assertTrue($command->getDefinition()->hasArgument('bar'), '->mergeApplicationDefinition() merges the application arguments and the command arguments'); @@ -252,7 +251,6 @@ public function testMergeApplicationDefinitionWithoutArgsThenWithArgsAddsArgs() $r = new \ReflectionObject($command); $m = $r->getMethod('mergeApplicationDefinition'); - $m->setAccessible(true); $m->invoke($command, false); $this->assertTrue($command->getDefinition()->hasOption('bar'), '->mergeApplicationDefinition(false) merges the application and the command options'); $this->assertFalse($command->getDefinition()->hasArgument('foo'), '->mergeApplicationDefinition(false) does not merge the application arguments'); @@ -470,13 +468,11 @@ public function testDefaultCommand() $apl = new Application(); $apl->setDefaultCommand(Php8Command::getDefaultName()); $property = new \ReflectionProperty($apl, 'defaultCommand'); - $property->setAccessible(true); $this->assertEquals('foo', $property->getValue($apl)); $apl->setDefaultCommand(Php8Command2::getDefaultName()); $property = new \ReflectionProperty($apl, 'defaultCommand'); - $property->setAccessible(true); $this->assertEquals('foo2', $property->getValue($apl)); } diff --git a/src/Symfony/Component/Console/Tests/Completion/CompletionInputTest.php b/src/Symfony/Component/Console/Tests/Completion/CompletionInputTest.php index ee370076c17ac..946e51d20d269 100644 --- a/src/Symfony/Component/Console/Tests/Completion/CompletionInputTest.php +++ b/src/Symfony/Component/Console/Tests/Completion/CompletionInputTest.php @@ -119,7 +119,6 @@ public function testFromString($inputStr, array $expectedTokens) $input = CompletionInput::fromString($inputStr, 1); $tokensProperty = (new \ReflectionClass($input))->getProperty('tokens'); - $tokensProperty->setAccessible(true); $this->assertEquals($expectedTokens, $tokensProperty->getValue($input)); } diff --git a/src/Symfony/Component/Console/Tests/Descriptor/JsonDescriptorTest.php b/src/Symfony/Component/Console/Tests/Descriptor/JsonDescriptorTest.php index 60ef029777778..baaa992752336 100644 --- a/src/Symfony/Component/Console/Tests/Descriptor/JsonDescriptorTest.php +++ b/src/Symfony/Component/Console/Tests/Descriptor/JsonDescriptorTest.php @@ -27,13 +27,13 @@ protected function getFormat() protected function normalizeOutput($output) { - return array_map([$this, 'normalizeOutputRecursively'], json_decode($output, true)); + return array_map($this->normalizeOutputRecursively(...), json_decode($output, true)); } private function normalizeOutputRecursively($output) { if (\is_array($output)) { - return array_map([$this, 'normalizeOutputRecursively'], $output); + return array_map($this->normalizeOutputRecursively(...), $output); } if (null === $output) { diff --git a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php index 21970f79ea598..0c76963457390 100644 --- a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php +++ b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php @@ -171,7 +171,6 @@ public function testInlineStyleOptions(string $tag, string $expected = null, str $styleString = substr($tag, 1, -1); $formatter = new OutputFormatter(true); $method = new \ReflectionMethod($formatter, 'createStyleFromString'); - $method->setAccessible(true); $result = $method->invoke($formatter, $styleString); if (null === $expected) { $this->assertNull($result); diff --git a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php index 1297b92f98a87..637b21125d2b6 100644 --- a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php @@ -872,7 +872,6 @@ public function testDisableStty() $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question); } finally { $reflection = new \ReflectionProperty(QuestionHelper::class, 'stty'); - $reflection->setAccessible(true); $reflection->setValue(null, true); } } diff --git a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php index 23333327027dd..fbbe85e3ab3ec 100644 --- a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php +++ b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php @@ -25,7 +25,6 @@ public function testConstructor() $input = new ArgvInput(); $r = new \ReflectionObject($input); $p = $r->getProperty('tokens'); - $p->setAccessible(true); $this->assertEquals(['foo'], $p->getValue($input), '__construct() automatically get its input from the argv server variable'); } diff --git a/src/Symfony/Component/Console/Tests/Input/StringInputTest.php b/src/Symfony/Component/Console/Tests/Input/StringInputTest.php index 2bd40dec9c365..5257cc258a011 100644 --- a/src/Symfony/Component/Console/Tests/Input/StringInputTest.php +++ b/src/Symfony/Component/Console/Tests/Input/StringInputTest.php @@ -27,7 +27,6 @@ public function testTokenize($input, $tokens, $message) $input = new StringInput($input); $r = new \ReflectionClass(ArgvInput::class); $p = $r->getProperty('tokens'); - $p->setAccessible(true); $this->assertEquals($tokens, $p->getValue($input), $message); } diff --git a/src/Symfony/Component/Console/Tests/TerminalTest.php b/src/Symfony/Component/Console/Tests/TerminalTest.php index c2d36fe0ab899..416319e39e74b 100644 --- a/src/Symfony/Component/Console/Tests/TerminalTest.php +++ b/src/Symfony/Component/Console/Tests/TerminalTest.php @@ -40,7 +40,6 @@ private function resetStatics() { foreach (['height', 'width', 'stty'] as $name) { $property = new \ReflectionProperty(Terminal::class, $name); - $property->setAccessible(true); $property->setValue(null); } } diff --git a/src/Symfony/Component/Console/composer.json b/src/Symfony/Component/Console/composer.json index 4045b7f2154c2..bafe5d16511f4 100644 --- a/src/Symfony/Component/Console/composer.json +++ b/src/Symfony/Component/Console/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", "symfony/service-contracts": "^1.1|^2|^3", diff --git a/src/Symfony/Component/CssSelector/Tests/Parser/Handler/AbstractHandlerTest.php b/src/Symfony/Component/CssSelector/Tests/Parser/Handler/AbstractHandlerTest.php index aaed55c205a9a..8afc7ae8e2646 100644 --- a/src/Symfony/Component/CssSelector/Tests/Parser/Handler/AbstractHandlerTest.php +++ b/src/Symfony/Component/CssSelector/Tests/Parser/Handler/AbstractHandlerTest.php @@ -52,7 +52,6 @@ abstract protected function generateHandler(); protected function assertStreamEmpty(TokenStream $stream) { $property = new \ReflectionProperty($stream, 'tokens'); - $property->setAccessible(true); $this->assertEquals([], $property->getValue($stream)); } diff --git a/src/Symfony/Component/CssSelector/Tests/Parser/ReaderTest.php b/src/Symfony/Component/CssSelector/Tests/Parser/ReaderTest.php index 8f57979332d0f..fa056dd141e50 100644 --- a/src/Symfony/Component/CssSelector/Tests/Parser/ReaderTest.php +++ b/src/Symfony/Component/CssSelector/Tests/Parser/ReaderTest.php @@ -96,7 +96,6 @@ public function testToEnd() private function assignPosition(Reader $reader, int $value) { $position = new \ReflectionProperty($reader, 'position'); - $position->setAccessible(true); $position->setValue($reader, $value); } } diff --git a/src/Symfony/Component/CssSelector/XPath/Extension/AttributeMatchingExtension.php b/src/Symfony/Component/CssSelector/XPath/Extension/AttributeMatchingExtension.php index a9879f1be8077..b40a86bf66ae9 100644 --- a/src/Symfony/Component/CssSelector/XPath/Extension/AttributeMatchingExtension.php +++ b/src/Symfony/Component/CssSelector/XPath/Extension/AttributeMatchingExtension.php @@ -32,14 +32,14 @@ class AttributeMatchingExtension extends AbstractExtension public function getAttributeMatchingTranslators(): array { return [ - 'exists' => [$this, 'translateExists'], - '=' => [$this, 'translateEquals'], - '~=' => [$this, 'translateIncludes'], - '|=' => [$this, 'translateDashMatch'], - '^=' => [$this, 'translatePrefixMatch'], - '$=' => [$this, 'translateSuffixMatch'], - '*=' => [$this, 'translateSubstringMatch'], - '!=' => [$this, 'translateDifferent'], + 'exists' => $this->translateExists(...), + '=' => $this->translateEquals(...), + '~=' => $this->translateIncludes(...), + '|=' => $this->translateDashMatch(...), + '^=' => $this->translatePrefixMatch(...), + '$=' => $this->translateSuffixMatch(...), + '*=' => $this->translateSubstringMatch(...), + '!=' => $this->translateDifferent(...), ]; } diff --git a/src/Symfony/Component/CssSelector/XPath/Extension/CombinationExtension.php b/src/Symfony/Component/CssSelector/XPath/Extension/CombinationExtension.php index aee976e9493ef..e75da8b49e30c 100644 --- a/src/Symfony/Component/CssSelector/XPath/Extension/CombinationExtension.php +++ b/src/Symfony/Component/CssSelector/XPath/Extension/CombinationExtension.php @@ -31,10 +31,10 @@ class CombinationExtension extends AbstractExtension public function getCombinationTranslators(): array { return [ - ' ' => [$this, 'translateDescendant'], - '>' => [$this, 'translateChild'], - '+' => [$this, 'translateDirectAdjacent'], - '~' => [$this, 'translateIndirectAdjacent'], + ' ' => $this->translateDescendant(...), + '>' => $this->translateChild(...), + '+' => $this->translateDirectAdjacent(...), + '~' => $this->translateIndirectAdjacent(...), ]; } diff --git a/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php b/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php index d3f7222a4d0ab..4ed9c2392d112 100644 --- a/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php +++ b/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php @@ -36,12 +36,12 @@ class FunctionExtension extends AbstractExtension public function getFunctionTranslators(): array { return [ - 'nth-child' => [$this, 'translateNthChild'], - 'nth-last-child' => [$this, 'translateNthLastChild'], - 'nth-of-type' => [$this, 'translateNthOfType'], - 'nth-last-of-type' => [$this, 'translateNthLastOfType'], - 'contains' => [$this, 'translateContains'], - 'lang' => [$this, 'translateLang'], + 'nth-child' => $this->translateNthChild(...), + 'nth-last-child' => $this->translateNthLastChild(...), + 'nth-of-type' => $this->translateNthOfType(...), + 'nth-last-of-type' => $this->translateNthLastOfType(...), + 'contains' => $this->translateContains(...), + 'lang' => $this->translateLang(...), ]; } diff --git a/src/Symfony/Component/CssSelector/XPath/Extension/HtmlExtension.php b/src/Symfony/Component/CssSelector/XPath/Extension/HtmlExtension.php index 6edc085810d77..95289818a194e 100644 --- a/src/Symfony/Component/CssSelector/XPath/Extension/HtmlExtension.php +++ b/src/Symfony/Component/CssSelector/XPath/Extension/HtmlExtension.php @@ -42,14 +42,14 @@ public function __construct(Translator $translator) public function getPseudoClassTranslators(): array { return [ - 'checked' => [$this, 'translateChecked'], - 'link' => [$this, 'translateLink'], - 'disabled' => [$this, 'translateDisabled'], - 'enabled' => [$this, 'translateEnabled'], - 'selected' => [$this, 'translateSelected'], - 'invalid' => [$this, 'translateInvalid'], - 'hover' => [$this, 'translateHover'], - 'visited' => [$this, 'translateVisited'], + 'checked' => $this->translateChecked(...), + 'link' => $this->translateLink(...), + 'disabled' => $this->translateDisabled(...), + 'enabled' => $this->translateEnabled(...), + 'selected' => $this->translateSelected(...), + 'invalid' => $this->translateInvalid(...), + 'hover' => $this->translateHover(...), + 'visited' => $this->translateVisited(...), ]; } @@ -59,7 +59,7 @@ public function getPseudoClassTranslators(): array public function getFunctionTranslators(): array { return [ - 'lang' => [$this, 'translateLang'], + 'lang' => $this->translateLang(...), ]; } diff --git a/src/Symfony/Component/CssSelector/XPath/Extension/NodeExtension.php b/src/Symfony/Component/CssSelector/XPath/Extension/NodeExtension.php index 642702bbb89fb..70f287b569621 100644 --- a/src/Symfony/Component/CssSelector/XPath/Extension/NodeExtension.php +++ b/src/Symfony/Component/CssSelector/XPath/Extension/NodeExtension.php @@ -65,15 +65,15 @@ public function hasFlag(int $flag): bool public function getNodeTranslators(): array { return [ - 'Selector' => [$this, 'translateSelector'], - 'CombinedSelector' => [$this, 'translateCombinedSelector'], - 'Negation' => [$this, 'translateNegation'], - 'Function' => [$this, 'translateFunction'], - 'Pseudo' => [$this, 'translatePseudo'], - 'Attribute' => [$this, 'translateAttribute'], - 'Class' => [$this, 'translateClass'], - 'Hash' => [$this, 'translateHash'], - 'Element' => [$this, 'translateElement'], + 'Selector' => $this->translateSelector(...), + 'CombinedSelector' => $this->translateCombinedSelector(...), + 'Negation' => $this->translateNegation(...), + 'Function' => $this->translateFunction(...), + 'Pseudo' => $this->translatePseudo(...), + 'Attribute' => $this->translateAttribute(...), + 'Class' => $this->translateClass(...), + 'Hash' => $this->translateHash(...), + 'Element' => $this->translateElement(...), ]; } diff --git a/src/Symfony/Component/CssSelector/XPath/Extension/PseudoClassExtension.php b/src/Symfony/Component/CssSelector/XPath/Extension/PseudoClassExtension.php index a50b0486ac8e2..a9b6abc4bf011 100644 --- a/src/Symfony/Component/CssSelector/XPath/Extension/PseudoClassExtension.php +++ b/src/Symfony/Component/CssSelector/XPath/Extension/PseudoClassExtension.php @@ -32,14 +32,14 @@ class PseudoClassExtension extends AbstractExtension public function getPseudoClassTranslators(): array { return [ - 'root' => [$this, 'translateRoot'], - 'first-child' => [$this, 'translateFirstChild'], - 'last-child' => [$this, 'translateLastChild'], - 'first-of-type' => [$this, 'translateFirstOfType'], - 'last-of-type' => [$this, 'translateLastOfType'], - 'only-child' => [$this, 'translateOnlyChild'], - 'only-of-type' => [$this, 'translateOnlyOfType'], - 'empty' => [$this, 'translateEmpty'], + 'root' => $this->translateRoot(...), + 'first-child' => $this->translateFirstChild(...), + 'last-child' => $this->translateLastChild(...), + 'first-of-type' => $this->translateFirstOfType(...), + 'last-of-type' => $this->translateLastOfType(...), + 'only-child' => $this->translateOnlyChild(...), + 'only-of-type' => $this->translateOnlyOfType(...), + 'empty' => $this->translateEmpty(...), ]; } diff --git a/src/Symfony/Component/CssSelector/composer.json b/src/Symfony/Component/CssSelector/composer.json index 7c9551cdeee31..c08fdc2cd6ceb 100644 --- a/src/Symfony/Component/CssSelector/composer.json +++ b/src/Symfony/Component/CssSelector/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "autoload": { "psr-4": { "Symfony\\Component\\CssSelector\\": "" }, diff --git a/src/Symfony/Component/DependencyInjection/Argument/RewindableGenerator.php b/src/Symfony/Component/DependencyInjection/Argument/RewindableGenerator.php index a9d9c6396ff53..9fee3743aa700 100644 --- a/src/Symfony/Component/DependencyInjection/Argument/RewindableGenerator.php +++ b/src/Symfony/Component/DependencyInjection/Argument/RewindableGenerator.php @@ -21,8 +21,8 @@ class RewindableGenerator implements \IteratorAggregate, \Countable public function __construct(callable $generator, int|callable $count) { - $this->generator = $generator instanceof \Closure ? $generator : \Closure::fromCallable($generator); - $this->count = \is_callable($count) && !$count instanceof \Closure ? \Closure::fromCallable($count) : $count; + $this->generator = $generator(...); + $this->count = \is_int($count) ? $count : $count(...); } public function getIterator(): \Traversable @@ -34,7 +34,7 @@ public function getIterator(): \Traversable public function count(): int { - if (\is_callable($count = $this->count)) { + if (!\is_int($count = $this->count)) { $this->count = $count(); } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AttributeAutoconfigurationPass.php b/src/Symfony/Component/DependencyInjection/Compiler/AttributeAutoconfigurationPass.php index 2fd1be6917dc0..350ed64474945 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AttributeAutoconfigurationPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AttributeAutoconfigurationPass.php @@ -34,7 +34,7 @@ public function process(ContainerBuilder $container): void } foreach ($container->getAutoconfiguredAttributes() as $attributeName => $callable) { - $callableReflector = new \ReflectionFunction(\Closure::fromCallable($callable)); + $callableReflector = new \ReflectionFunction($callable(...)); if ($callableReflector->getNumberOfParameters() <= 2) { $this->classAttributeConfigurators[$attributeName] = $callable; continue; diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index f65e2b827e4d6..a6f1dbc5b95be 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -205,7 +205,7 @@ private function autowireCalls(\ReflectionClass $reflectionClass, bool $isRoot, continue; } - if (\PHP_VERSION_ID >= 80100 && (\is_array($value->value) ? $value->value : \is_object($value->value))) { + if (\is_array($value->value) ? $value->value : \is_object($value->value)) { unset($arguments[$j]); $namedArguments = $value->names; } else { diff --git a/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php b/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php index 81ebd65924d31..4102d8039d53d 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php @@ -81,7 +81,6 @@ public function compile(ContainerBuilder $container) if ($msg !== $resolvedMsg = $container->resolveEnvPlaceholders($msg, null, $usedEnvs)) { $r = new \ReflectionProperty($prev, 'message'); - $r->setAccessible(true); $r->setValue($prev, $resolvedMsg); } } while ($prev = $prev->getPrevious()); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/RegisterAutoconfigureAttributesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/RegisterAutoconfigureAttributesPass.php index c1ada7a9343b0..de18b501f15c0 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/RegisterAutoconfigureAttributesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/RegisterAutoconfigureAttributesPass.php @@ -57,7 +57,6 @@ private static function registerForAutoconfiguration(ContainerBuilder $container } $parseDefinitions = new \ReflectionMethod(YamlFileLoader::class, 'parseDefinitions'); - $parseDefinitions->setAccessible(true); $yamlLoader = $parseDefinitions->getDeclaringClass()->newInstanceWithoutConstructor(); self::$registerForAutoconfiguration = static function (ContainerBuilder $container, \ReflectionClass $class, \ReflectionAttribute $attribute) use ($parseDefinitions, $yamlLoader) { diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveChildDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveChildDefinitionsPass.php index a1a14947727f1..46a2e04fd6b65 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveChildDefinitionsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveChildDefinitionsPass.php @@ -63,7 +63,6 @@ private function resolveDefinition(ChildDefinition $definition): Definition throw $e; } catch (ExceptionInterface $e) { $r = new \ReflectionProperty($e, 'message'); - $r->setAccessible(true); $r->setValue($e, sprintf('Service "%s": %s', $this->currentId, $e->getMessage())); throw $e; diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index f9820f5ede674..bc6cba1fc4f21 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -194,7 +194,7 @@ public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALI { return $this->services[$id] ?? $this->services[$id = $this->aliases[$id] ?? $id] - ?? ('service_container' === $id ? $this : ($this->factories[$id] ?? [$this, 'make'])($id, $invalidBehavior)); + ?? ('service_container' === $id ? $this : ($this->factories[$id] ?? $this->make(...))($id, $invalidBehavior)); } /** @@ -345,7 +345,7 @@ protected function getEnv(string $name): mixed if (!$this->has($id = 'container.env_var_processors_locator')) { $this->set($id, new ServiceLocator([])); } - $this->getEnv ??= \Closure::fromCallable([$this, 'getEnv']); + $this->getEnv ??= $this->getEnv(...); $processors = $this->get($id); if (false !== $i = strpos($name, ':')) { diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index c4976cc086887..6e8b25c7617f3 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -1154,7 +1154,7 @@ private function doResolveServices(mixed $value, array &$inlineServices = [], bo $types[$k] = $v instanceof TypedReference ? $v->getType() : '?'; } } - $value = new ServiceLocator(\Closure::fromCallable([$this, 'resolveServices']), $refs, $types); + $value = new ServiceLocator($this->resolveServices(...), $refs, $types); } elseif ($value instanceof Reference) { $value = $this->doGet((string) $value, $value->getInvalidBehavior(), $inlineServices, $isConstructorArgument); } elseif ($value instanceof Definition) { @@ -1586,7 +1586,7 @@ private function getExpressionLanguage(): ExpressionLanguage if (!class_exists(\Symfony\Component\ExpressionLanguage\ExpressionLanguage::class)) { throw new LogicException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); } - $this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders, null, \Closure::fromCallable([$this, 'getEnv'])); + $this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders, null, $this->getEnv(...)); } return $this->expressionLanguage; diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index b1d0fb41c2164..7b75bfbb49a11 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -226,7 +226,7 @@ public function dump(array $options = []): string|array if ($this->addGetService) { $code = preg_replace( "/(\r?\n\r?\n public function __construct.+?\\{\r?\n)/s", - "\n protected \$getService;$1 \$this->getService = \\Closure::fromCallable([\$this, 'getService']);\n", + "\n protected \Closure \$getService;$1 \$this->getService = \$this->getService(...);\n", $code, 1 ); @@ -334,7 +334,7 @@ class %s extends {$options['class']} if (!$class || str_contains($class, '$') || \in_array($class, ['int', 'float', 'string', 'bool', 'resource', 'object', 'array', 'null', 'callable', 'iterable', 'mixed', 'void'], true)) { continue; } - if (!(class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false)) || ((new \ReflectionClass($class))->isUserDefined() && !\in_array($class, ['Attribute', 'JsonException', 'ReturnTypeWillChange', 'Stringable', 'UnhandledMatchError', 'ValueError'], true))) { + if (!(class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false)) || (new \ReflectionClass($class))->isUserDefined()) { $code[$options['class'].'.preload.php'] .= sprintf("\$classes[] = '%s';\n", $class); } } @@ -891,7 +891,7 @@ protected function {$methodName}($lazyInitialization) $code .= " return self::do(\$container);\n"; $code .= " };\n\n"; } else { - $code .= sprintf("\\Closure::fromCallable([\$this, '%s']);\n\n", $methodName); + $code .= sprintf("\$this->%s(...);\n\n", $methodName); } } diff --git a/src/Symfony/Component/DependencyInjection/ExpressionLanguageProvider.php b/src/Symfony/Component/DependencyInjection/ExpressionLanguageProvider.php index 2cac25a031bde..d5166ebfd037f 100644 --- a/src/Symfony/Component/DependencyInjection/ExpressionLanguageProvider.php +++ b/src/Symfony/Component/DependencyInjection/ExpressionLanguageProvider.php @@ -32,7 +32,7 @@ class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface public function __construct(callable $serviceCompiler = null, \Closure $getEnv = null) { - $this->serviceCompiler = null !== $serviceCompiler && !$serviceCompiler instanceof \Closure ? \Closure::fromCallable($serviceCompiler) : $serviceCompiler; + $this->serviceCompiler = null === $serviceCompiler ? null : $serviceCompiler(...); $this->getEnv = $getEnv; } diff --git a/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php index 2bc6484a3d661..629ca506845c6 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php @@ -95,10 +95,7 @@ public function supports(mixed $resource, string $type = null): bool */ private function executeCallback(callable $callback, ContainerConfigurator $containerConfigurator, string $path) { - if (!$callback instanceof \Closure) { - $callback = \Closure::fromCallable($callback); - } - + $callback = $callback(...); $arguments = []; $configBuilders = []; $r = new \ReflectionFunction($callback); diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 4d05133e8823b..f657706d5c4b6 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -402,7 +402,7 @@ private function parseDefinition(\DOMElement $service, string $file, Definition private function parseFileToDOM(string $file): \DOMDocument { try { - $dom = XmlUtils::loadFile($file, [$this, 'validateSchema']); + $dom = XmlUtils::loadFile($file, $this->validateSchema(...)); } catch (\InvalidArgumentException $e) { throw new InvalidArgumentException(sprintf('Unable to parse file "%s": ', $file).$e->getMessage(), $e->getCode(), $e); } diff --git a/src/Symfony/Component/DependencyInjection/ServiceLocator.php b/src/Symfony/Component/DependencyInjection/ServiceLocator.php index ca21075b75034..31a21410a9800 100644 --- a/src/Symfony/Component/DependencyInjection/ServiceLocator.php +++ b/src/Symfony/Component/DependencyInjection/ServiceLocator.php @@ -53,7 +53,6 @@ public function get(string $id): mixed } $r = new \ReflectionProperty($e, 'message'); - $r->setAccessible(true); $r->setValue($e, $message); throw $e; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php index 66082a9814127..0dd57a8065748 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php @@ -271,9 +271,6 @@ public function testGuessableUnionType() $this->assertSame('b', (string) $aDefinition->getArgument(0)); } - /** - * @requires PHP 8.1 - */ public function testTypeNotGuessableIntersectionType() { $container = new ContainerBuilder(); @@ -291,9 +288,6 @@ public function testTypeNotGuessableIntersectionType() $pass->process($container); } - /** - * @requires PHP 8.1 - */ public function testGuessableIntersectionType() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckTypeDeclarationsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckTypeDeclarationsPassTest.php index 9b55c68e77885..dfc4ebe3171c7 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckTypeDeclarationsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckTypeDeclarationsPassTest.php @@ -929,9 +929,6 @@ public function testReferencePassesMixed() $this->addToAssertionCount(1); } - /** - * @requires PHP 8.1 - */ public function testIntersectionTypePassesWithReference() { $container = new ContainerBuilder(); @@ -945,9 +942,6 @@ public function testIntersectionTypePassesWithReference() $this->addToAssertionCount(1); } - /** - * @requires PHP 8.1 - */ public function testIntersectionTypeFailsWithReference() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php index b0dacbed4fd82..bf164ebe5b104 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php @@ -563,7 +563,6 @@ public function testTaggedLocatorWithDefaultPriorityMethodConfiguredViaAttribute // We need to check priority of instances in the factories $factories = (new \ReflectionClass($locator))->getProperty('factories'); - $factories->setAccessible(true); self::assertSame([FooTagClass::class, BarTagClass::class], array_keys($factories->getValue($locator))); } @@ -593,7 +592,6 @@ public function testTaggedLocatorWithDefaultIndexMethodAndWithDefaultPriorityMet // We need to check priority of instances in the factories $factories = (new \ReflectionClass($locator))->getProperty('factories'); - $factories->setAccessible(true); self::assertSame(['foo_tag_class', 'bar_tag_class'], array_keys($factories->getValue($locator))); self::assertSame($container->get(BarTagClass::class), $locator->get('bar_tag_class')); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php index 984abfe7ace55..e4ca7499ff300 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php @@ -131,9 +131,6 @@ public function testWithAttributes() $this->assertEquals($expected, $container->getDefinition((string) $locator->getFactory()[0])->getArgument(0)); } - /** - * @requires PHP 8 - */ public function testUnionServices() { $container = new ContainerBuilder(); @@ -173,9 +170,6 @@ public function testUnionServices() $this->assertEquals($expected, $container->getDefinition((string) $locator->getFactory()[0])->getArgument(0)); } - /** - * @requires PHP 8.1 - */ public function testIntersectionServices() { $container = new ContainerBuilder(); @@ -310,9 +304,6 @@ public function method() $subscriber::getSubscribedServices(); } - /** - * @requires PHP 8 - */ public function testServiceSubscriberTraitWithUnionReturnType() { if (!class_exists(SubscribedService::class)) { @@ -340,9 +331,6 @@ public function testServiceSubscriberTraitWithUnionReturnType() $this->assertEquals($expected, $container->getDefinition((string) $locator->getFactory()[0])->getArgument(0)); } - /** - * @requires PHP 8.1 - */ public function testServiceSubscriberTraitWithIntersectionReturnType() { if (!class_exists(SubscribedService::class)) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php index c12a49fefa535..d6e9b344da349 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php @@ -68,9 +68,6 @@ public function testProcess() $this->assertEquals([['setSensitiveClass', [new Reference('foo')]]], $definition->getMethodCalls()); } - /** - * @requires PHP 8.1 - */ public function testProcessEnum() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index c777694c4118d..ecd5c60c7e09d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -1172,7 +1172,6 @@ public function testLazyLoadedService() $container->compile(); $r = new \ReflectionProperty($container, 'resources'); - $r->setAccessible(true); $resources = $r->getValue($container); $classInList = false; diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php index bfa5b02fab666..7c1380e41fd15 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php @@ -369,7 +369,6 @@ public function testGetThrowsExceptionOnServiceConfiguration() protected function getField($obj, $field) { $reflection = new \ReflectionProperty($obj, $field); - $reflection->setAccessible(true); return $reflection->getValue($obj); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index 11e6243b8b177..53134cb844f8a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -936,11 +936,7 @@ public function process(ContainerBuilder $container) $dumper = new PhpDumper($container); - if (80100 <= \PHP_VERSION_ID) { - $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_subscriber_php81.php', $dumper->dump()); - } else { - $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_subscriber.php', $dumper->dump()); - } + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_subscriber.php', $dumper->dump()); } public function testPrivateWithIgnoreOnInvalidReference() @@ -1209,9 +1205,6 @@ public function testDumpHandlesObjectClassNames() $this->assertInstanceOf(\stdClass::class, $container->get('bar')); } - /** - * @requires PHP 8.1 - */ public function testNewInInitializer() { $container = new ContainerBuilder(); @@ -1227,9 +1220,6 @@ public function testNewInInitializer() $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_new_in_initializer.php', $dumper->dump()); } - /** - * @requires PHP 8.1 - */ public function testDumpHandlesEnumeration() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PreloaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PreloaderTest.php index 04a8faf69a940..da022df92498b 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PreloaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PreloaderTest.php @@ -30,7 +30,6 @@ class PreloaderTest extends TestCase public function testPreload() { $r = new \ReflectionMethod(Preloader::class, 'doPreload'); - $r->setAccessible(true); $preloaded = []; @@ -45,7 +44,6 @@ public function testPreload() public function testPreloadSkipsNonExistingInterface() { $r = new \ReflectionMethod(Preloader::class, 'doPreload'); - $r->setAccessible(true); $preloaded = []; @@ -56,7 +54,6 @@ public function testPreloadSkipsNonExistingInterface() public function testPreloadUnion() { $r = new \ReflectionMethod(Preloader::class, 'doPreload'); - $r->setAccessible(true); $preloaded = []; @@ -67,9 +64,6 @@ public function testPreloadUnion() self::assertTrue(class_exists(E::class, false)); } - /** - * @requires PHP 8.1 - */ public function testPreloadIntersection() { $r = new \ReflectionMethod(Preloader::class, 'doPreload'); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php index deca0a196d303..78bb529499290 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php @@ -237,9 +237,6 @@ public function testDumpAbstractServices() $this->assertEquals(file_get_contents(self::$fixturesPath.'/xml/services_abstract.xml'), $dumper->dump()); } - /** - * @requires PHP 8.1 - */ public function testDumpHandlesEnumeration() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php index 1bfd222ed1ac1..a49b3c5e5b22d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php @@ -133,9 +133,6 @@ public function testServiceClosure() $this->assertStringEqualsFile(self::$fixturesPath.'/yaml/services_with_service_closure.yml', $dumper->dump()); } - /** - * @requires PHP 8.1 - */ public function testDumpHandlesEnumeration() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php b/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php index 4441fe5422bc3..d13865bfab62c 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php @@ -580,7 +580,7 @@ public function testGetEnvResolveNestedEnv() $container->compile(); $processor = new EnvVarProcessor($container); - $getEnv = \Closure::fromCallable([$processor, 'getEnv']); + $getEnv = $processor->getEnv(...); $result = $processor->getEnv('resolve', 'foo', function ($name) use ($getEnv) { return 'foo' === $name ? '%env(BAR)%' : $getEnv('string', $name, function () {}); @@ -598,7 +598,7 @@ public function testGetEnvResolveNestedRealEnv() $container->compile(); $processor = new EnvVarProcessor($container); - $getEnv = \Closure::fromCallable([$processor, 'getEnv']); + $getEnv = $processor->getEnv(...); $result = $processor->getEnv('resolve', 'foo', function ($name) use ($getEnv) { return 'foo' === $name ? '%env(BAR)%' : $getEnv('string', $name, function () {}); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/autowiring_classes.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/autowiring_classes.php index 035014533e81d..c66c157942b13 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/autowiring_classes.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/autowiring_classes.php @@ -6,9 +6,7 @@ require __DIR__.'/uniontype_classes.php'; require __DIR__.'/autowiring_classes_80.php'; -if (\PHP_VERSION_ID >= 80100) { - require __DIR__.'/intersectiontype_classes.php'; -} +require __DIR__.'/intersectiontype_classes.php'; class Foo { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_duplicates.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_duplicates.php index 8ee15edeb4608..9371da69c56f0 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_duplicates.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_duplicates.php @@ -15,11 +15,11 @@ class ProjectServiceContainer extends Container { protected $parameters = []; - protected $getService; + protected \Closure $getService; public function __construct() { - $this->getService = \Closure::fromCallable([$this, 'getService']); + $this->getService = $this->getService(...); $this->services = $this->privates = []; $this->methodMap = [ 'bar' => 'getBarService', diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_lazy.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_lazy.php index e60c8f0223ab2..b36fcc8e136a9 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_lazy.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_lazy.php @@ -65,7 +65,7 @@ protected function getBarService() */ protected function getFooService($lazyLoad = true) { - $this->factories['service_container']['foo'] = $this->factories['service_container']['foo'] ?? \Closure::fromCallable([$this, 'getFooService']); + $this->factories['service_container']['foo'] = $this->factories['service_container']['foo'] ?? $this->getFooService(...); // lazy factory for stdClass diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php index 51db550bd7cfe..598a82458fdac 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php @@ -15,11 +15,11 @@ class Symfony_DI_PhpDumper_Test_Rot13Parameters extends Container { protected $parameters = []; - protected $getService; + protected \Closure $getService; public function __construct() { - $this->getService = \Closure::fromCallable([$this, 'getService']); + $this->getService = $this->getService(...); $this->parameters = $this->getDefaultParameters(); $this->services = $this->privates = []; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_service_locator_argument.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_service_locator_argument.php index 3d716d4a5c927..b371470d0ca76 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_service_locator_argument.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_service_locator_argument.php @@ -15,11 +15,11 @@ class Symfony_DI_PhpDumper_Service_Locator_Argument extends Container { protected $parameters = []; - protected $getService; + protected \Closure $getService; public function __construct() { - $this->getService = \Closure::fromCallable([$this, 'getService']); + $this->getService = $this->getService(...); $this->services = $this->privates = []; $this->syntheticIds = [ 'foo5' => true, diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php index dc2e3dcc09068..797625804a7e7 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php @@ -15,11 +15,11 @@ class ProjectServiceContainer extends Container { protected $parameters = []; - protected $getService; + protected \Closure $getService; public function __construct() { - $this->getService = \Closure::fromCallable([$this, 'getService']); + $this->getService = $this->getService(...); $this->services = $this->privates = []; $this->methodMap = [ 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => 'getTestServiceSubscriberService', @@ -44,10 +44,10 @@ public function isCompiled(): bool public function getRemovedIds(): array { return [ - '.service_locator.DlIAmAe' => true, - '.service_locator.t5IGRMW' => true, - '.service_locator.zFfA7ng' => true, - '.service_locator.zFfA7ng.foo_service' => true, + '.service_locator.JmEob1b' => true, + '.service_locator.KIgkoLM' => true, + '.service_locator.qUb.lJI' => true, + '.service_locator.qUb.lJI.foo_service' => true, 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => true, ]; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber_php81.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber_php81.php deleted file mode 100644 index 35d2f4b6e592e..0000000000000 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber_php81.php +++ /dev/null @@ -1,106 +0,0 @@ -getService = \Closure::fromCallable([$this, 'getService']); - $this->services = $this->privates = []; - $this->methodMap = [ - 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => 'getTestServiceSubscriberService', - 'foo_service' => 'getFooServiceService', - 'late_alias' => 'getLateAliasService', - ]; - $this->aliases = [ - 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestDefinition1' => 'late_alias', - ]; - } - - public function compile(): void - { - throw new LogicException('You cannot compile a dumped container that was already compiled.'); - } - - public function isCompiled(): bool - { - return true; - } - - public function getRemovedIds(): array - { - return [ - '.service_locator.JmEob1b' => true, - '.service_locator.KIgkoLM' => true, - '.service_locator.qUb.lJI' => true, - '.service_locator.qUb.lJI.foo_service' => true, - 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => true, - ]; - } - - /** - * Gets the public 'Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber' shared service. - * - * @return \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber - */ - protected function getTestServiceSubscriberService() - { - return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber(); - } - - /** - * Gets the public 'foo_service' shared autowired service. - * - * @return \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber - */ - protected function getFooServiceService() - { - return $this->services['foo_service'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber((new \Symfony\Component\DependencyInjection\Argument\ServiceLocator($this->getService, [ - 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => ['privates', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', 'getCustomDefinitionService', false], - 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => ['services', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber', 'getTestServiceSubscriberService', false], - 'bar' => ['services', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber', 'getTestServiceSubscriberService', false], - 'baz' => ['privates', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', 'getCustomDefinitionService', false], - 'late_alias' => ['services', 'late_alias', 'getLateAliasService', false], - ], [ - 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', - 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber', - 'bar' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', - 'baz' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', - 'late_alias' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestDefinition1', - ]))->withContext('foo_service', $this)); - } - - /** - * Gets the public 'late_alias' shared service. - * - * @return \Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1 - */ - protected function getLateAliasService() - { - return $this->services['late_alias'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1(); - } - - /** - * Gets the private 'Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition' shared service. - * - * @return \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition - */ - protected function getCustomDefinitionService() - { - return $this->privates['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition(); - } -} diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index e2e7d660881ae..9f6759d26875a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -75,7 +75,6 @@ public function testParseFile() $loader = new XmlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/ini')); $r = new \ReflectionObject($loader); $m = $r->getMethod('parseFileToDOM'); - $m->setAccessible(true); try { $m->invoke($loader, self::$fixturesPath.'/ini/parameters.ini'); @@ -860,9 +859,6 @@ public function testInstanceof() $this->assertSame(['foo' => [[]], 'bar' => [[]]], $definition->getTags()); } - /** - * @requires PHP 8.1 - */ public function testEnumeration() { $container = new ContainerBuilder(); @@ -874,9 +870,6 @@ public function testEnumeration() $this->assertSame([FooUnitEnum::BAR], $definition->getArguments()); } - /** - * @requires PHP 8.1 - */ public function testInvalidEnumeration() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index 8ab4964613e1b..8f510ae792b6d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -61,7 +61,6 @@ public function testLoadUnExistFile() $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/ini')); $r = new \ReflectionObject($loader); $m = $r->getMethod('loadFile'); - $m->setAccessible(true); $m->invoke($loader, 'foo.yml'); } @@ -74,7 +73,6 @@ public function testLoadInvalidYamlFile() $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator($path)); $r = new \ReflectionObject($loader); $m = $r->getMethod('loadFile'); - $m->setAccessible(true); $m->invoke($loader, $path.'/parameters.ini'); } @@ -946,9 +944,6 @@ public function testDefaultValueOfTagged() $this->assertNull($iteratorArgument->getIndexAttribute()); } - /** - * @requires PHP 8.1 - */ public function testEnumeration() { $container = new ContainerBuilder(); @@ -960,9 +955,6 @@ public function testEnumeration() $this->assertSame([FooUnitEnum::BAR], $definition->getArguments()); } - /** - * @requires PHP 8.1 - */ public function testInvalidEnumeration() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/composer.json b/src/Symfony/Component/DependencyInjection/composer.json index e819daa14f650..1b2e7850c8c92 100644 --- a/src/Symfony/Component/DependencyInjection/composer.json +++ b/src/Symfony/Component/DependencyInjection/composer.json @@ -16,10 +16,9 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/container": "^1.1|^2.0", "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php81": "^1.22", "symfony/service-contracts": "^1.1.6|^2.0|^3.0" }, "require-dev": { diff --git a/src/Symfony/Component/DomCrawler/composer.json b/src/Symfony/Component/DomCrawler/composer.json index 6d113dcb1f551..460837eeb27a8 100644 --- a/src/Symfony/Component/DomCrawler/composer.json +++ b/src/Symfony/Component/DomCrawler/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.0" }, diff --git a/src/Symfony/Component/Dotenv/composer.json b/src/Symfony/Component/Dotenv/composer.json index d5e7aed8dd499..77ea7ec8fe189 100644 --- a/src/Symfony/Component/Dotenv/composer.json +++ b/src/Symfony/Component/Dotenv/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "require-dev": { "symfony/console": "^5.4|^6.0", diff --git a/src/Symfony/Component/ErrorHandler/Error/ClassNotFoundError.php b/src/Symfony/Component/ErrorHandler/Error/ClassNotFoundError.php index 443fba2c3bee6..3406ad0be957d 100644 --- a/src/Symfony/Component/ErrorHandler/Error/ClassNotFoundError.php +++ b/src/Symfony/Component/ErrorHandler/Error/ClassNotFoundError.php @@ -26,7 +26,6 @@ public function __construct(string $message, \Throwable $previous) 'trace' => $previous->getTrace(), ] as $property => $value) { $refl = new \ReflectionProperty(\Error::class, $property); - $refl->setAccessible(true); $refl->setValue($this, $value); } } diff --git a/src/Symfony/Component/ErrorHandler/Error/FatalError.php b/src/Symfony/Component/ErrorHandler/Error/FatalError.php index 27fd3ffe676c9..e7d3845cdda47 100644 --- a/src/Symfony/Component/ErrorHandler/Error/FatalError.php +++ b/src/Symfony/Component/ErrorHandler/Error/FatalError.php @@ -73,7 +73,6 @@ public function __construct(string $message, int $code, array $error, int $trace ] as $property => $value) { if (null !== $value) { $refl = new \ReflectionProperty(\Error::class, $property); - $refl->setAccessible(true); $refl->setValue($this, $value); } } diff --git a/src/Symfony/Component/ErrorHandler/Error/UndefinedFunctionError.php b/src/Symfony/Component/ErrorHandler/Error/UndefinedFunctionError.php index b57dd1579dee6..0ed2b7c2f7c19 100644 --- a/src/Symfony/Component/ErrorHandler/Error/UndefinedFunctionError.php +++ b/src/Symfony/Component/ErrorHandler/Error/UndefinedFunctionError.php @@ -26,7 +26,6 @@ public function __construct(string $message, \Throwable $previous) 'trace' => $previous->getTrace(), ] as $property => $value) { $refl = new \ReflectionProperty(\Error::class, $property); - $refl->setAccessible(true); $refl->setValue($this, $value); } } diff --git a/src/Symfony/Component/ErrorHandler/Error/UndefinedMethodError.php b/src/Symfony/Component/ErrorHandler/Error/UndefinedMethodError.php index adc8731f36c48..f492a42bede56 100644 --- a/src/Symfony/Component/ErrorHandler/Error/UndefinedMethodError.php +++ b/src/Symfony/Component/ErrorHandler/Error/UndefinedMethodError.php @@ -26,7 +26,6 @@ public function __construct(string $message, \Throwable $previous) 'trace' => $previous->getTrace(), ] as $property => $value) { $refl = new \ReflectionProperty(\Error::class, $property); - $refl->setAccessible(true); $refl->setValue($this, $value); } } diff --git a/src/Symfony/Component/ErrorHandler/ErrorHandler.php b/src/Symfony/Component/ErrorHandler/ErrorHandler.php index d08ac0b1b8acf..6d6c4adad21b0 100644 --- a/src/Symfony/Component/ErrorHandler/ErrorHandler.php +++ b/src/Symfony/Component/ErrorHandler/ErrorHandler.php @@ -185,7 +185,6 @@ public function __construct(BufferingLogger $bootstrappingLogger = null, bool $d $this->setDefaultLogger($bootstrappingLogger); } $traceReflector = new \ReflectionProperty(\Exception::class, 'trace'); - $traceReflector->setAccessible(true); $this->configureException = \Closure::bind(static function ($e, $trace, $file = null, $line = null) use ($traceReflector) { $traceReflector->setValue($e, $trace); $e->file = $file ?? $e->file; diff --git a/src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php b/src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php index ab0e39414e626..b87b54ea4dd7c 100644 --- a/src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php +++ b/src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php @@ -48,11 +48,11 @@ class HtmlErrorRenderer implements ErrorRendererInterface */ public function __construct(bool|callable $debug = false, string $charset = null, string|FileLinkFormatter $fileLinkFormat = null, string $projectDir = null, string|callable $outputBuffer = '', LoggerInterface $logger = null) { - $this->debug = \is_bool($debug) || $debug instanceof \Closure ? $debug : \Closure::fromCallable($debug); + $this->debug = \is_bool($debug) ? $debug : $debug(...); $this->charset = $charset ?: (ini_get('default_charset') ?: 'UTF-8'); $this->fileLinkFormat = $fileLinkFormat ?: (ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format')); $this->projectDir = $projectDir; - $this->outputBuffer = \is_string($outputBuffer) || $outputBuffer instanceof \Closure ? $outputBuffer : \Closure::fromCallable($outputBuffer); + $this->outputBuffer = \is_string($outputBuffer) ? $outputBuffer : $outputBuffer(...); $this->logger = $logger; } diff --git a/src/Symfony/Component/ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php b/src/Symfony/Component/ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php index 771deca8e47f8..c427b9e2d5ebc 100644 --- a/src/Symfony/Component/ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php +++ b/src/Symfony/Component/ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php @@ -37,9 +37,9 @@ class SerializerErrorRenderer implements ErrorRendererInterface public function __construct(SerializerInterface $serializer, string|callable $format, ErrorRendererInterface $fallbackErrorRenderer = null, bool|callable $debug = false) { $this->serializer = $serializer; - $this->format = \is_string($format) || $format instanceof \Closure ? $format : \Closure::fromCallable($format); + $this->format = \is_string($format) ? $format : $format(...); $this->fallbackErrorRenderer = $fallbackErrorRenderer ?? new HtmlErrorRenderer(); - $this->debug = \is_bool($debug) || $debug instanceof \Closure ? $debug : \Closure::fromCallable($debug); + $this->debug = \is_bool($debug) ? $debug : $debug(...); } /** diff --git a/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php b/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php index d1223c529f2cb..fbfcdf90bd8f1 100644 --- a/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php +++ b/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php @@ -50,7 +50,6 @@ public function testIdempotence() if (\is_array($function) && $function[0] instanceof DebugClassLoader) { $reflClass = new \ReflectionClass($function[0]); $reflProp = $reflClass->getProperty('classLoader'); - $reflProp->setAccessible(true); $this->assertNotInstanceOf(DebugClassLoader::class, $reflProp->getValue($function[0])); @@ -439,9 +438,6 @@ class_exists(Fixtures\FinalConstant\OverrideFinalConstant::class, true); ], $deprecations); } - /** - * @requires PHP 8.1 - */ public function testOverrideFinalConstant81() { $deprecations = []; diff --git a/src/Symfony/Component/ErrorHandler/Tests/phpt/fatal_with_nested_handlers.phpt b/src/Symfony/Component/ErrorHandler/Tests/phpt/fatal_with_nested_handlers.phpt index 92f7e12fde227..cfb10d03dafdd 100644 --- a/src/Symfony/Component/ErrorHandler/Tests/phpt/fatal_with_nested_handlers.phpt +++ b/src/Symfony/Component/ErrorHandler/Tests/phpt/fatal_with_nested_handlers.phpt @@ -1,7 +1,5 @@ --TEST-- Test catching fatal errors when handlers are nested ---SKIPIF-- - --FILE-- = 80100) echo 'skip' ?> ---FILE-- -setExceptionHandler('print_r'); - -if (true) { - class Broken implements \JsonSerializable - { - } -} - -?> ---EXPECTF-- -array(1) { - [0]=> - string(37) "Error and exception handlers do match" -} -object(Symfony\Component\ErrorHandler\Error\FatalError)#%d (%d) { - ["error":"Symfony\Component\ErrorHandler\Error\FatalError":private]=> - array(4) { - ["type"]=> - int(1) - ["message"]=> - string(179) "Class Symfony\Component\ErrorHandler\Broken contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (JsonSerializable::jsonSerialize)" - ["file"]=> - string(%d) "%s" - ["line"]=> - int(%d) - } - ["message":protected]=> - string(186) "Error: Class Symfony\Component\ErrorHandler\Broken contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (JsonSerializable::jsonSerialize)" -%a -} diff --git a/src/Symfony/Component/ErrorHandler/composer.json b/src/Symfony/Component/ErrorHandler/composer.json index d3cb8035f075b..5331dd88366c6 100644 --- a/src/Symfony/Component/ErrorHandler/composer.json +++ b/src/Symfony/Component/ErrorHandler/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/log": "^1|^2|^3", "symfony/var-dumper": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php b/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php index 27401835581d4..e1ce3ef996cd0 100644 --- a/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php +++ b/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php @@ -222,7 +222,7 @@ public function getNotCalledListeners(Request $request = null): array } } - uasort($notCalled, [$this, 'sortNotCalledListeners']); + uasort($notCalled, $this->sortNotCalledListeners(...)); return $notCalled; } diff --git a/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php b/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php index 346924e74dfda..88329e2ae5309 100644 --- a/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php +++ b/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php @@ -37,7 +37,7 @@ final class WrappedListener public function __construct(callable|array $listener, ?string $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null, int $priority = null) { $this->listener = $listener; - $this->optimizedListener = $listener instanceof \Closure ? $listener : (\is_callable($listener) ? \Closure::fromCallable($listener) : null); + $this->optimizedListener = $listener instanceof \Closure ? $listener : (\is_callable($listener) ? $listener(...) : null); $this->stopwatch = $stopwatch; $this->dispatcher = $dispatcher; $this->priority = $priority; diff --git a/src/Symfony/Component/EventDispatcher/EventDispatcher.php b/src/Symfony/Component/EventDispatcher/EventDispatcher.php index ed5ecd67c8179..c0badda636882 100644 --- a/src/Symfony/Component/EventDispatcher/EventDispatcher.php +++ b/src/Symfony/Component/EventDispatcher/EventDispatcher.php @@ -267,10 +267,10 @@ private function optimizeListeners(string $eventName): array $listener[0] = $listener[0](); $listener[1] ??= '__invoke'; } - ($closure = \Closure::fromCallable($listener))(...$args); + ($closure = $listener(...))(...$args); }; } else { - $closure = $listener instanceof \Closure || $listener instanceof WrappedListener ? $listener : \Closure::fromCallable($listener); + $closure = $listener instanceof WrappedListener ? $listener : $listener(...); } } } diff --git a/src/Symfony/Component/EventDispatcher/composer.json b/src/Symfony/Component/EventDispatcher/composer.json index 53a86ee9df7b9..c05373f331c1a 100644 --- a/src/Symfony/Component/EventDispatcher/composer.json +++ b/src/Symfony/Component/EventDispatcher/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/event-dispatcher-contracts": "^2|^3" }, "require-dev": { diff --git a/src/Symfony/Component/ExpressionLanguage/ExpressionFunction.php b/src/Symfony/Component/ExpressionLanguage/ExpressionFunction.php index 6cf14a0b48ce1..e1f8ebc0919f1 100644 --- a/src/Symfony/Component/ExpressionLanguage/ExpressionFunction.php +++ b/src/Symfony/Component/ExpressionLanguage/ExpressionFunction.php @@ -42,8 +42,8 @@ class ExpressionFunction public function __construct(string $name, callable $compiler, callable $evaluator) { $this->name = $name; - $this->compiler = $compiler instanceof \Closure ? $compiler : \Closure::fromCallable($compiler); - $this->evaluator = $evaluator instanceof \Closure ? $evaluator : \Closure::fromCallable($evaluator); + $this->compiler = $compiler(...); + $this->evaluator = $evaluator(...); } public function getName(): string diff --git a/src/Symfony/Component/ExpressionLanguage/composer.json b/src/Symfony/Component/ExpressionLanguage/composer.json index 473f5666de9f3..3c8811b0e3a99 100644 --- a/src/Symfony/Component/ExpressionLanguage/composer.json +++ b/src/Symfony/Component/ExpressionLanguage/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/cache": "^5.4|^6.0", "symfony/service-contracts": "^1.1|^2|^3" }, diff --git a/src/Symfony/Component/Filesystem/composer.json b/src/Symfony/Component/Filesystem/composer.json index 607dde3f981ca..10a7a531c0046 100644 --- a/src/Symfony/Component/Filesystem/composer.json +++ b/src/Symfony/Component/Filesystem/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.8" }, diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php index e5772c459f88f..4636f05ce99c7 100644 --- a/src/Symfony/Component/Finder/Finder.php +++ b/src/Symfony/Component/Finder/Finder.php @@ -585,7 +585,7 @@ public function in(string|array $dirs): static $resolvedDirs[] = [$this->normalizeDir($dir)]; } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? \GLOB_BRACE : 0) | \GLOB_ONLYDIR | \GLOB_NOSORT)) { sort($glob); - $resolvedDirs[] = array_map([$this, 'normalizeDir'], $glob); + $resolvedDirs[] = array_map($this->normalizeDir(...), $glob); } else { throw new DirectoryNotFoundException(sprintf('The "%s" directory does not exist.', $dir)); } diff --git a/src/Symfony/Component/Finder/Iterator/LazyIterator.php b/src/Symfony/Component/Finder/Iterator/LazyIterator.php index 71c4be8c50f17..5b5806be95385 100644 --- a/src/Symfony/Component/Finder/Iterator/LazyIterator.php +++ b/src/Symfony/Component/Finder/Iterator/LazyIterator.php @@ -22,7 +22,7 @@ class LazyIterator implements \IteratorAggregate public function __construct(callable $iteratorFactory) { - $this->iteratorFactory = $iteratorFactory instanceof \Closure ? $iteratorFactory : \Closure::fromCallable($iteratorFactory); + $this->iteratorFactory = $iteratorFactory(...); } public function getIterator(): \Traversable diff --git a/src/Symfony/Component/Finder/Iterator/SortableIterator.php b/src/Symfony/Component/Finder/Iterator/SortableIterator.php index b6c34b67c1de0..ab41c8d10793c 100644 --- a/src/Symfony/Component/Finder/Iterator/SortableIterator.php +++ b/src/Symfony/Component/Finder/Iterator/SortableIterator.php @@ -75,7 +75,7 @@ public function __construct(\Traversable $iterator, int|callable $sort, bool $re } elseif (self::SORT_BY_NONE === $sort) { $this->sort = $order; } elseif (\is_callable($sort)) { - $this->sort = $reverseOrder ? static function (\SplFileInfo $a, \SplFileInfo $b) use ($sort) { return -$sort($a, $b); } : \Closure::fromCallable($sort); + $this->sort = $reverseOrder ? static function (\SplFileInfo $a, \SplFileInfo $b) use ($sort) { return -$sort($a, $b); } : $sort(...); } else { throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.'); } diff --git a/src/Symfony/Component/Finder/composer.json b/src/Symfony/Component/Finder/composer.json index 2e4b324544517..5cd110e172ce7 100644 --- a/src/Symfony/Component/Finder/composer.json +++ b/src/Symfony/Component/Finder/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "autoload": { "psr-4": { "Symfony\\Component\\Finder\\": "" }, diff --git a/src/Symfony/Component/Form/CallbackTransformer.php b/src/Symfony/Component/Form/CallbackTransformer.php index c5ec2a10505c8..8870526b8f332 100644 --- a/src/Symfony/Component/Form/CallbackTransformer.php +++ b/src/Symfony/Component/Form/CallbackTransformer.php @@ -18,8 +18,8 @@ class CallbackTransformer implements DataTransformerInterface public function __construct(callable $transform, callable $reverseTransform) { - $this->transform = $transform instanceof \Closure ? $transform : \Closure::fromCallable($transform); - $this->reverseTransform = $reverseTransform instanceof \Closure ? $reverseTransform : \Closure::fromCallable($reverseTransform); + $this->transform = $transform(...); + $this->reverseTransform = $reverseTransform(...); } /** diff --git a/src/Symfony/Component/Form/ChoiceList/Factory/Cache/AbstractStaticOption.php b/src/Symfony/Component/Form/ChoiceList/Factory/Cache/AbstractStaticOption.php index 5ccdbdb22ec1e..2686017c91a96 100644 --- a/src/Symfony/Component/Form/ChoiceList/Factory/Cache/AbstractStaticOption.php +++ b/src/Symfony/Component/Form/ChoiceList/Factory/Cache/AbstractStaticOption.php @@ -40,7 +40,7 @@ final public function __construct(FormTypeInterface|FormTypeExtensionInterface $ { $hash = CachingFactoryDecorator::generateHash([static::class, $formType, $vary]); - $this->option = self::$options[$hash] ??= $option instanceof \Closure || !\is_callable($option) ? $option : \Closure::fromCallable($option); + $this->option = self::$options[$hash] ??= $option instanceof \Closure || \is_string($option) || \is_bool($option) || $option instanceof ChoiceLoaderInterface || !\is_callable($option) ? $option : $option(...); } final public function getOption(): mixed diff --git a/src/Symfony/Component/Form/ChoiceList/LazyChoiceList.php b/src/Symfony/Component/Form/ChoiceList/LazyChoiceList.php index e339bcd249f6b..dd545430cf233 100644 --- a/src/Symfony/Component/Form/ChoiceList/LazyChoiceList.php +++ b/src/Symfony/Component/Form/ChoiceList/LazyChoiceList.php @@ -48,7 +48,7 @@ class LazyChoiceList implements ChoiceListInterface public function __construct(ChoiceLoaderInterface $loader, callable $value = null) { $this->loader = $loader; - $this->value = null === $value || $value instanceof \Closure ? $value : \Closure::fromCallable($value); + $this->value = null === $value ? null : $value(...); } /** diff --git a/src/Symfony/Component/Form/ChoiceList/Loader/CallbackChoiceLoader.php b/src/Symfony/Component/Form/ChoiceList/Loader/CallbackChoiceLoader.php index 991b13407ebdc..088f91dae209d 100644 --- a/src/Symfony/Component/Form/ChoiceList/Loader/CallbackChoiceLoader.php +++ b/src/Symfony/Component/Form/ChoiceList/Loader/CallbackChoiceLoader.php @@ -25,7 +25,7 @@ class CallbackChoiceLoader extends AbstractChoiceLoader */ public function __construct(callable $callback) { - $this->callback = $callback instanceof \Closure ? $callback : \Closure::fromCallable($callback); + $this->callback = $callback(...); } protected function loadChoices(): iterable diff --git a/src/Symfony/Component/Form/ChoiceList/Loader/FilterChoiceLoaderDecorator.php b/src/Symfony/Component/Form/ChoiceList/Loader/FilterChoiceLoaderDecorator.php index 12e6d0e2a12c4..277aba0cf2931 100644 --- a/src/Symfony/Component/Form/ChoiceList/Loader/FilterChoiceLoaderDecorator.php +++ b/src/Symfony/Component/Form/ChoiceList/Loader/FilterChoiceLoaderDecorator.php @@ -24,7 +24,7 @@ class FilterChoiceLoaderDecorator extends AbstractChoiceLoader public function __construct(ChoiceLoaderInterface $loader, callable $filter) { $this->decoratedLoader = $loader; - $this->filter = $filter instanceof \Closure ? $filter : \Closure::fromCallable($filter); + $this->filter = $filter(...); } protected function loadChoices(): iterable diff --git a/src/Symfony/Component/Form/Command/DebugCommand.php b/src/Symfony/Component/Form/Command/DebugCommand.php index c58dc2217d339..d30a547ce84fd 100644 --- a/src/Symfony/Component/Form/Command/DebugCommand.php +++ b/src/Symfony/Component/Form/Command/DebugCommand.php @@ -209,7 +209,6 @@ private function getCoreTypes(): array { $coreExtension = new CoreExtension(); $loadTypesRefMethod = (new \ReflectionObject($coreExtension))->getMethod('loadTypes'); - $loadTypesRefMethod->setAccessible(true); $coreTypes = $loadTypesRefMethod->invoke($coreExtension); $coreTypes = array_map(function (FormTypeInterface $type) { return \get_class($type); }, $coreTypes); sort($coreTypes); diff --git a/src/Symfony/Component/Form/Console/Descriptor/TextDescriptor.php b/src/Symfony/Component/Form/Console/Descriptor/TextDescriptor.php index ba79d806adcb9..c1991e3aed7bc 100644 --- a/src/Symfony/Component/Form/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Component/Form/Console/Descriptor/TextDescriptor.php @@ -45,18 +45,18 @@ protected function describeDefaults(array $options) if ($options['service_types']) { $this->output->section('Service form types'); - $this->output->listing(array_map([$this, 'formatClassLink'], $options['service_types'])); + $this->output->listing(array_map($this->formatClassLink(...), $options['service_types'])); } if (!$options['show_deprecated']) { if ($options['extensions']) { $this->output->section('Type extensions'); - $this->output->listing(array_map([$this, 'formatClassLink'], $options['extensions'])); + $this->output->listing(array_map($this->formatClassLink(...), $options['extensions'])); } if ($options['guessers']) { $this->output->section('Type guessers'); - $this->output->listing(array_map([$this, 'formatClassLink'], $options['guessers'])); + $this->output->listing(array_map($this->formatClassLink(...), $options['guessers'])); } } } @@ -92,12 +92,12 @@ protected function describeResolvedFormType(ResolvedFormTypeInterface $resolvedF if ($this->parents) { $this->output->section('Parent types'); - $this->output->listing(array_map([$this, 'formatClassLink'], $this->parents)); + $this->output->listing(array_map($this->formatClassLink(...), $this->parents)); } if ($this->extensions) { $this->output->section('Type extensions'); - $this->output->listing(array_map([$this, 'formatClassLink'], $this->extensions)); + $this->output->listing(array_map($this->formatClassLink(...), $this->extensions)); } } diff --git a/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php b/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php index 8cbfa8b36b7b1..c5258469c3579 100644 --- a/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php +++ b/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php @@ -37,7 +37,7 @@ public function __construct(string $type, array $options = [], bool $allowAdd = $this->allowAdd = $allowAdd; $this->allowDelete = $allowDelete; $this->options = $options; - $this->deleteEmpty = $deleteEmpty instanceof \Closure || !\is_callable($deleteEmpty) ? $deleteEmpty : \Closure::fromCallable($deleteEmpty); + $this->deleteEmpty = \is_bool($deleteEmpty) ? $deleteEmpty : $deleteEmpty(...); } public static function getSubscribedEvents(): array diff --git a/src/Symfony/Component/Form/Extension/Core/Type/EnumType.php b/src/Symfony/Component/Form/Extension/Core/Type/EnumType.php index c251cdbd000bb..33944c2aec7c4 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/EnumType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/EnumType.php @@ -27,7 +27,7 @@ public function configureOptions(OptionsResolver $resolver): void $resolver ->setRequired(['class']) ->setAllowedTypes('class', 'string') - ->setAllowedValues('class', \Closure::fromCallable('enum_exists')) + ->setAllowedValues('class', enum_exists(...)) ->setDefault('choices', static function (Options $options): array { return $options['class']::cases(); }) diff --git a/src/Symfony/Component/Form/FormConfigBuilder.php b/src/Symfony/Component/Form/FormConfigBuilder.php index 9bbe7abcc48c6..4a03594e0dd90 100644 --- a/src/Symfony/Component/Form/FormConfigBuilder.php +++ b/src/Symfony/Component/Form/FormConfigBuilder.php @@ -729,7 +729,7 @@ public function getFormConfig(): FormConfigInterface */ public function setIsEmptyCallback(?callable $isEmptyCallback): static { - $this->isEmptyCallback = null === $isEmptyCallback || $isEmptyCallback instanceof \Closure ? $isEmptyCallback : \Closure::fromCallable($isEmptyCallback); + $this->isEmptyCallback = null === $isEmptyCallback ? null : $isEmptyCallback(...); return $this; } diff --git a/src/Symfony/Component/Form/Tests/AbstractFormTest.php b/src/Symfony/Component/Form/Tests/AbstractFormTest.php index 193bb31b15edb..5408416191ab2 100644 --- a/src/Symfony/Component/Form/Tests/AbstractFormTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractFormTest.php @@ -59,18 +59,12 @@ protected function getBuilder(?string $name = 'name', EventDispatcherInterface $ return new FormBuilder($name, $dataClass, $dispatcher ?: $this->dispatcher, $this->factory, $options); } - /** - * @return MockObject&DataMapperInterface - */ - protected function getDataMapper(): DataMapperInterface + protected function getDataMapper(): MockObject&DataMapperInterface { return $this->createMock(DataMapperInterface::class); } - /** - * @return MockObject&DataTransformerInterface - */ - protected function getDataTransformer(): DataTransformerInterface + protected function getDataTransformer(): MockObject&DataTransformerInterface { return $this->createMock(DataTransformerInterface::class); } diff --git a/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php b/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php index 5e18de686cef0..be54d2350d8ab 100644 --- a/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php +++ b/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php @@ -266,7 +266,6 @@ private function getCoreTypes(): array { $coreExtension = new CoreExtension(); $loadTypesRefMethod = (new \ReflectionObject($coreExtension))->getMethod('loadTypes'); - $loadTypesRefMethod->setAccessible(true); $coreTypes = $loadTypesRefMethod->invoke($coreExtension); $coreTypes = array_map(function (FormTypeInterface $type) { return \get_class($type); }, $coreTypes); sort($coreTypes); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/EnumTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/EnumTypeTest.php index 083952a3326a3..f571d631b4a39 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/EnumTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/EnumTypeTest.php @@ -19,10 +19,7 @@ use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; use Symfony\Component\OptionsResolver\Exception\MissingOptionsException; -/** - * @requires PHP 8.1 - */ -final class EnumTypeTest extends BaseTypeTest +class EnumTypeTest extends BaseTypeTest { public const TESTED_TYPE = EnumType::class; diff --git a/src/Symfony/Component/Form/Tests/FormBuilderTest.php b/src/Symfony/Component/Form/Tests/FormBuilderTest.php index e68d3c7b1a714..2213e078742a5 100644 --- a/src/Symfony/Component/Form/Tests/FormBuilderTest.php +++ b/src/Symfony/Component/Form/Tests/FormBuilderTest.php @@ -204,9 +204,6 @@ public function testGetFormConfigErasesReferences() $children = $reflClass->getProperty('children'); $unresolvedChildren = $reflClass->getProperty('unresolvedChildren'); - $children->setAccessible(true); - $unresolvedChildren->setAccessible(true); - $this->assertEmpty($children->getValue($config)); $this->assertEmpty($unresolvedChildren->getValue($config)); } diff --git a/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php b/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php index 9f4825e3fcdf7..c53badd9b93f3 100644 --- a/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php +++ b/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php @@ -27,7 +27,6 @@ protected function setUp(): void { $factory = new \ReflectionClass(FormFactory::class); $this->registry = $factory->getProperty('registry'); - $this->registry->setAccessible(true); $this->guesser = $this->createMock(FormTypeGuesserInterface::class); $this->type = new FooType(); diff --git a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php index b0a7617847659..e6e5ee87f8bb0 100644 --- a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php +++ b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php @@ -373,26 +373,17 @@ public function provideTypeClassBlockPrefixTuples() ]; } - /** - * @return MockObject&FormTypeInterface - */ - private function getMockFormType($typeClass = AbstractType::class): FormTypeInterface + private function getMockFormType($typeClass = AbstractType::class): MockObject&FormTypeInterface { return $this->getMockBuilder($typeClass)->setMethods(['getBlockPrefix', 'configureOptions', 'finishView', 'buildView', 'buildForm'])->getMock(); } - /** - * @return MockObject&FormTypeExtensionInterface - */ - private function getMockFormTypeExtension(): FormTypeExtensionInterface + private function getMockFormTypeExtension(): MockObject&FormTypeExtensionInterface { return $this->getMockBuilder(AbstractTypeExtension::class)->setMethods(['getExtendedTypes', 'configureOptions', 'finishView', 'buildView', 'buildForm'])->getMock(); } - /** - * @return MockObject&FormFactoryInterface - */ - private function getMockFormFactory(): FormFactoryInterface + private function getMockFormFactory(): MockObject&FormFactoryInterface { return $this->createMock(FormFactoryInterface::class); } diff --git a/src/Symfony/Component/Form/composer.json b/src/Symfony/Component/Form/composer.json index 9bdf5a8778c91..6fb2b50866543 100644 --- a/src/Symfony/Component/Form/composer.json +++ b/src/Symfony/Component/Form/composer.json @@ -16,14 +16,13 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/deprecation-contracts": "^2.1|^3", "symfony/event-dispatcher": "^5.4|^6.0", "symfony/options-resolver": "^5.4|^6.0", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-icu": "^1.21", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php81": "^1.23", "symfony/property-access": "^5.4|^6.0", "symfony/service-contracts": "^1.1|^2|^3" }, diff --git a/src/Symfony/Component/HtmlSanitizer/composer.json b/src/Symfony/Component/HtmlSanitizer/composer.json index 052b480fd1ced..bdb15b0a158f7 100644 --- a/src/Symfony/Component/HtmlSanitizer/composer.json +++ b/src/Symfony/Component/HtmlSanitizer/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "ext-dom": "*", "league/uri": "^6.5", "masterminds/html5": "^2.4" diff --git a/src/Symfony/Component/HttpClient/AmpHttpClient.php b/src/Symfony/Component/HttpClient/AmpHttpClient.php index 7fe06f58a15f9..b2a8654f2e2d7 100644 --- a/src/Symfony/Component/HttpClient/AmpHttpClient.php +++ b/src/Symfony/Component/HttpClient/AmpHttpClient.php @@ -56,7 +56,7 @@ final class AmpHttpClient implements HttpClientInterface, LoggerAwareInterface, */ public function __construct(array $defaultOptions = [], callable $clientConfigurator = null, int $maxHostConnections = 6, int $maxPendingPushes = 50) { - $this->defaultOptions['buffer'] = $this->defaultOptions['buffer'] ?? \Closure::fromCallable([__CLASS__, 'shouldBuffer']); + $this->defaultOptions['buffer'] ??= self::shouldBuffer(...); if ($defaultOptions) { [, $this->defaultOptions] = self::prepareRequest(null, null, $defaultOptions, $this->defaultOptions); diff --git a/src/Symfony/Component/HttpClient/CurlHttpClient.php b/src/Symfony/Component/HttpClient/CurlHttpClient.php index b540d53f8f9a0..7348b550bd7cf 100644 --- a/src/Symfony/Component/HttpClient/CurlHttpClient.php +++ b/src/Symfony/Component/HttpClient/CurlHttpClient.php @@ -64,7 +64,7 @@ public function __construct(array $defaultOptions = [], int $maxHostConnections throw new \LogicException('You cannot use the "Symfony\Component\HttpClient\CurlHttpClient" as the "curl" extension is not installed.'); } - $this->defaultOptions['buffer'] = $this->defaultOptions['buffer'] ?? \Closure::fromCallable([__CLASS__, 'shouldBuffer']); + $this->defaultOptions['buffer'] ??= self::shouldBuffer(...); if ($defaultOptions) { [, $this->defaultOptions] = self::prepareRequest(null, null, $defaultOptions, $this->defaultOptions); diff --git a/src/Symfony/Component/HttpClient/Internal/AmpClientState.php b/src/Symfony/Component/HttpClient/Internal/AmpClientState.php index 82b0368650993..18a1722c38115 100644 --- a/src/Symfony/Component/HttpClient/Internal/AmpClientState.php +++ b/src/Symfony/Component/HttpClient/Internal/AmpClientState.php @@ -54,7 +54,7 @@ final class AmpClientState extends ClientState public function __construct(?callable $clientConfigurator, int $maxHostConnections, int $maxPendingPushes, ?LoggerInterface &$logger) { $clientConfigurator ??= static fn (PooledHttpClient $client) => new InterceptedHttpClient($client, new RetryRequests(2)); - $this->clientConfigurator = $clientConfigurator instanceof \Closure ? $clientConfigurator : \Closure::fromCallable($clientConfigurator); + $this->clientConfigurator = $clientConfigurator(...); $this->maxHostConnections = $maxHostConnections; $this->maxPendingPushes = $maxPendingPushes; diff --git a/src/Symfony/Component/HttpClient/MockHttpClient.php b/src/Symfony/Component/HttpClient/MockHttpClient.php index 85500412dd522..bce20971fdbb4 100644 --- a/src/Symfony/Component/HttpClient/MockHttpClient.php +++ b/src/Symfony/Component/HttpClient/MockHttpClient.php @@ -56,7 +56,7 @@ public function setResponseFactory($responseFactory): void })(); } - $this->responseFactory = !\is_callable($responseFactory) || $responseFactory instanceof \Closure ? $responseFactory : \Closure::fromCallable($responseFactory); + $this->responseFactory = !\is_callable($responseFactory) ? $responseFactory : $responseFactory(...); } /** diff --git a/src/Symfony/Component/HttpClient/NativeHttpClient.php b/src/Symfony/Component/HttpClient/NativeHttpClient.php index c2c995ba98eb3..e5762de8b1b38 100644 --- a/src/Symfony/Component/HttpClient/NativeHttpClient.php +++ b/src/Symfony/Component/HttpClient/NativeHttpClient.php @@ -47,7 +47,7 @@ final class NativeHttpClient implements HttpClientInterface, LoggerAwareInterfac */ public function __construct(array $defaultOptions = [], int $maxHostConnections = 6) { - $this->defaultOptions['buffer'] = $this->defaultOptions['buffer'] ?? \Closure::fromCallable([__CLASS__, 'shouldBuffer']); + $this->defaultOptions['buffer'] ??= self::shouldBuffer(...); if ($defaultOptions) { [, $this->defaultOptions] = self::prepareRequest(null, null, $defaultOptions, $this->defaultOptions); diff --git a/src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php b/src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php index ed87ea5b9fe32..266b539ef6b59 100644 --- a/src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php +++ b/src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php @@ -38,7 +38,6 @@ public function testBindToPort() $response->getStatusCode(); $r = new \ReflectionProperty($response, 'handle'); - $r->setAccessible(true); $curlInfo = curl_getinfo($r->getValue($response)); @@ -60,7 +59,6 @@ public function testHandleIsReinitOnReset() $httpClient = $this->getHttpClient(__FUNCTION__); $r = new \ReflectionProperty($httpClient, 'multi'); - $r->setAccessible(true); $clientState = $r->getValue($httpClient); $initialShareId = $clientState->share; $httpClient->reset(); diff --git a/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php b/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php index 8118e653f9991..0843bedd6593a 100644 --- a/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php +++ b/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php @@ -321,7 +321,7 @@ private static function startVulcain(HttpClientInterface $client) ]); $process->start(); - register_shutdown_function([$process, 'stop']); + register_shutdown_function($process->stop(...)); sleep('\\' === \DIRECTORY_SEPARATOR ? 10 : 1); if (!$process->isRunning()) { @@ -353,7 +353,6 @@ public function testHandleIsRemovedOnException() unset($e); $r = new \ReflectionProperty($client, 'multi'); - $r->setAccessible(true); /** @var ClientState $clientState */ $clientState = $r->getValue($client); diff --git a/src/Symfony/Component/HttpClient/composer.json b/src/Symfony/Component/HttpClient/composer.json index 02a7653b52902..fe9e0f4c98254 100644 --- a/src/Symfony/Component/HttpClient/composer.json +++ b/src/Symfony/Component/HttpClient/composer.json @@ -21,7 +21,7 @@ "symfony/http-client-implementation": "3.0" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/log": "^1|^2|^3", "symfony/http-client-contracts": "^3", "symfony/service-contracts": "^1.0|^2|^3" diff --git a/src/Symfony/Component/HttpFoundation/Session/Session.php b/src/Symfony/Component/HttpFoundation/Session/Session.php index 6c1d3a23baa21..4e17e7efc90ff 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Session.php +++ b/src/Symfony/Component/HttpFoundation/Session/Session.php @@ -43,7 +43,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable public function __construct(SessionStorageInterface $storage = null, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null, callable $usageReporter = null) { $this->storage = $storage ?? new NativeSessionStorage(); - $this->usageReporter = $usageReporter instanceof \Closure || !\is_callable($usageReporter) ? $usageReporter : \Closure::fromCallable($usageReporter); + $this->usageReporter = null === $usageReporter ? null : $usageReporter(...); $attributes ??= new AttributeBag(); $this->attributeName = $attributes->getName(); diff --git a/src/Symfony/Component/HttpFoundation/Session/SessionBagProxy.php b/src/Symfony/Component/HttpFoundation/Session/SessionBagProxy.php index a5bdc92c987ef..76dfed724cee5 100644 --- a/src/Symfony/Component/HttpFoundation/Session/SessionBagProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/SessionBagProxy.php @@ -28,7 +28,7 @@ public function __construct(SessionBagInterface $bag, array &$data, ?int &$usage $this->bag = $bag; $this->data = &$data; $this->usageIndex = &$usageIndex; - $this->usageReporter = $usageReporter instanceof \Closure || !\is_callable($usageReporter) ? $usageReporter : \Closure::fromCallable($usageReporter); + $this->usageReporter = null === $usageReporter ? null : $usageReporter(...); } public function getBag(): SessionBagInterface diff --git a/src/Symfony/Component/HttpFoundation/Session/SessionFactory.php b/src/Symfony/Component/HttpFoundation/Session/SessionFactory.php index 098bc1ce01196..cdb6af51e7e16 100644 --- a/src/Symfony/Component/HttpFoundation/Session/SessionFactory.php +++ b/src/Symfony/Component/HttpFoundation/Session/SessionFactory.php @@ -30,7 +30,7 @@ public function __construct(RequestStack $requestStack, SessionStorageFactoryInt { $this->requestStack = $requestStack; $this->storageFactory = $storageFactory; - $this->usageReporter = $usageReporter instanceof \Closure || !\is_callable($usageReporter) ? $usageReporter : \Closure::fromCallable($usageReporter); + $this->usageReporter = null === $usageReporter ? null : $usageReporter(...); } public function createSession(): SessionInterface diff --git a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php index 45d5afad82368..a9999c988cebb 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php @@ -310,7 +310,6 @@ public function testXAccelMapping($realpath, $mapping, $virtual) $response = new BinaryFileResponse($file, 200, ['Content-Type' => 'application/octet-stream']); $reflection = new \ReflectionObject($response); $property = $reflection->getProperty('file'); - $property->setAccessible(true); $property->setValue($response, $file); $response->prepare($request); diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 6151377ac0452..32e19ee527607 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -1838,7 +1838,6 @@ public function testUrlencodedStringPrefix($string, $prefix, $expect) $request = new Request(); $me = new \ReflectionMethod($request, 'getUrlencodedPrefix'); - $me->setAccessible(true); $this->assertSame($expect, $me->invoke($request, $string, $prefix)); } @@ -1861,7 +1860,6 @@ private function disableHttpMethodParameterOverride() { $class = new \ReflectionClass(Request::class); $property = $class->getProperty('httpMethodParameterOverride'); - $property->setAccessible(true); $property->setValue(false); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index dc4a395c1690c..8822dd2614010 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -832,7 +832,6 @@ public function testSetStatusCode($code, $text, $expectedText) $response->setStatusCode($code, $text); $statusText = new \ReflectionProperty($response, 'statusText'); - $statusText->setAccessible(true); $this->assertEquals($expectedText, $statusText->getValue($response)); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php index d404b74c6a5f4..d535989e6477c 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php @@ -142,7 +142,6 @@ public function getOptionFixtures() public function testGetConnection() { $method = new \ReflectionMethod($this->storage, 'getMemcached'); - $method->setAccessible(true); $this->assertInstanceOf(\Memcached::class, $method->invoke($this->storage)); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index a96fcc42ade1d..2aa3e4007c9a0 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -198,7 +198,6 @@ public function testGc() public function testGetConnection() { $method = new \ReflectionMethod($this->storage, 'getMongo'); - $method->setAccessible(true); $this->assertInstanceOf(Client::class, $method->invoke($this->storage)); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index d067bf862ef2f..f9b42c7cccffb 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -296,7 +296,6 @@ public function testGetConnection() $storage = new PdoSessionHandler($this->getMemorySqlitePdo()); $method = new \ReflectionMethod($storage, 'getConnection'); - $method->setAccessible(true); $this->assertInstanceOf(\PDO::class, $method->invoke($storage)); } @@ -306,7 +305,6 @@ public function testGetConnectionConnectsIfNeeded() $storage = new PdoSessionHandler('sqlite::memory:'); $method = new \ReflectionMethod($storage, 'getConnection'); - $method->setAccessible(true); $this->assertInstanceOf(\PDO::class, $method->invoke($storage)); } @@ -324,7 +322,6 @@ public function testUrlDsn($url, $expectedDsn, $expectedUser = null, $expectedPa continue; } $property = $reflection->getProperty($property); - $property->setAccessible(true); $this->assertSame($expectedValue, $property->getValue($storage)); } } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/SessionHandlerFactoryTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/SessionHandlerFactoryTest.php index 8ec2be4b14b30..74f7ebb8d00f2 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/SessionHandlerFactoryTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/SessionHandlerFactoryTest.php @@ -67,11 +67,9 @@ public function testCreateRedisHandlerFromDsn() $reflection = new \ReflectionObject($handler); $prefixProperty = $reflection->getProperty('prefix'); - $prefixProperty->setAccessible(true); $this->assertSame('foo', $prefixProperty->getValue($handler)); $ttlProperty = $reflection->getProperty('ttl'); - $ttlProperty->setAccessible(true); $this->assertSame(3600, $ttlProperty->getValue($handler)); } } diff --git a/src/Symfony/Component/HttpFoundation/composer.json b/src/Symfony/Component/HttpFoundation/composer.json index 9f5cccc65a8a2..8df36aa4d26e4 100644 --- a/src/Symfony/Component/HttpFoundation/composer.json +++ b/src/Symfony/Component/HttpFoundation/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.1" }, diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/ServiceValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/ServiceValueResolver.php index a8e940f880a34..7122a6204581f 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/ServiceValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/ServiceValueResolver.php @@ -84,7 +84,6 @@ public function resolve(Request $request, ArgumentMetadata $argument): iterable } $r = new \ReflectionProperty($e, 'message'); - $r->setAccessible(true); $r->setValue($e, $message); throw $e; diff --git a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php index 2bfd139b8421b..943e73acaaf9d 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php @@ -55,7 +55,7 @@ public function __construct(callable $exceptionHandler = null, LoggerInterface $ $this->earlyHandler = \is_array($handler) ? $handler[0] : null; restore_exception_handler(); - $this->exceptionHandler = null === $exceptionHandler || $exceptionHandler instanceof \Closure ? $exceptionHandler : \Closure::fromCallable($exceptionHandler); + $this->exceptionHandler = null === $exceptionHandler ? null : $exceptionHandler(...); $this->logger = $logger; $this->levels = $levels ?? \E_ALL; $this->throwAt = \is_int($throwAt) ? $throwAt : (null === $throwAt ? null : ($throwAt ? \E_ALL : null)); diff --git a/src/Symfony/Component/HttpKernel/EventListener/ErrorListener.php b/src/Symfony/Component/HttpKernel/EventListener/ErrorListener.php index 8bac8afe268e9..770773712906b 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/ErrorListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/ErrorListener.php @@ -96,7 +96,6 @@ public function onKernelException(ExceptionEvent $event) } while ($prev = $wrapper->getPrevious()); $prev = new \ReflectionProperty($wrapper instanceof \Exception ? \Exception::class : \Error::class, 'previous'); - $prev->setAccessible(true); $prev->setValue($wrapper, $throwable); throw $e; @@ -124,7 +123,7 @@ public function onControllerArguments(ControllerArgumentsEvent $event) return; } - $r = new \ReflectionFunction(\Closure::fromCallable($event->getController())); + $r = new \ReflectionFunction($event->getController()(...)); $r = $r->getParameters()[$k] ?? null; if ($r && (!($r = $r->getType()) instanceof \ReflectionNamedType || \in_array($r->getName(), [FlattenException::class, LegacyFlattenException::class], true))) { diff --git a/src/Symfony/Component/HttpKernel/Exception/ControllerDoesNotReturnResponseException.php b/src/Symfony/Component/HttpKernel/Exception/ControllerDoesNotReturnResponseException.php index 54c80be90fa50..ca28c9f603f7a 100644 --- a/src/Symfony/Component/HttpKernel/Exception/ControllerDoesNotReturnResponseException.php +++ b/src/Symfony/Component/HttpKernel/Exception/ControllerDoesNotReturnResponseException.php @@ -27,7 +27,6 @@ public function __construct(string $message, callable $controller, string $file, $this->file = $controllerDefinition['file']; $this->line = $controllerDefinition['line']; $r = new \ReflectionProperty(\Exception::class, 'trace'); - $r->setAccessible(true); $r->setValue($this, array_merge([ [ 'line' => $line, diff --git a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php index cf0e243c6bc5e..dc3eeac35aaf2 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php @@ -86,7 +86,7 @@ public function __construct(HttpKernelInterface $kernel, StoreInterface $store, $this->surrogate = $surrogate; // needed in case there is a fatal error because the backend is too slow to respond - register_shutdown_function([$this->store, 'cleanup']); + register_shutdown_function($this->store->cleanup(...)); $this->options = array_merge([ 'debug' => false, diff --git a/src/Symfony/Component/HttpKernel/Log/Logger.php b/src/Symfony/Component/HttpKernel/Log/Logger.php index 0ce18cd6e1c69..8b3ea91f760d6 100644 --- a/src/Symfony/Component/HttpKernel/Log/Logger.php +++ b/src/Symfony/Component/HttpKernel/Log/Logger.php @@ -62,7 +62,7 @@ public function __construct(string $minLevel = null, $output = null, callable $f } $this->minLevelIndex = self::LEVELS[$minLevel]; - $this->formatter = $formatter instanceof \Closure ? $formatter : \Closure::fromCallable($formatter ?? [$this, 'format']); + $this->formatter = null !== $formatter ? $formatter(...) : $this->format(...); if ($output && false === $this->handle = \is_resource($output) ? $output : @fopen($output, 'a')) { throw new InvalidArgumentException(sprintf('Unable to open "%s".', $output)); } diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/BackedEnumValueResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/BackedEnumValueResolverTest.php index 900d4b2db24dd..41505179f1bf3 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/BackedEnumValueResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/BackedEnumValueResolverTest.php @@ -18,9 +18,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Tests\Fixtures\Suit; -/** - * @requires PHP 8.1 - */ class BackedEnumValueResolverTest extends TestCase { /** diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php index 42daae237848a..1f8b0d68076b5 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php @@ -186,7 +186,7 @@ public function testGetArgumentWithoutArray() $request = Request::create('/'); $request->attributes->set('foo', 'foo'); $request->attributes->set('bar', 'foo'); - $controller = [$this, 'controllerWithFooAndDefaultBar']; + $controller = $this->controllerWithFooAndDefaultBar(...); $resolver->getArguments($request, $controller); } @@ -194,7 +194,7 @@ public function testIfExceptionIsThrownWhenMissingAnArgument() { $this->expectException(\RuntimeException::class); $request = Request::create('/'); - $controller = [$this, 'controllerWithFoo']; + $controller = $this->controllerWithFoo(...); self::$resolver->getArguments($request, $controller); } @@ -224,7 +224,7 @@ public function testGetSessionArguments() $session = new Session(new MockArraySessionStorage()); $request = Request::create('/'); $request->setSession($session); - $controller = [$this, 'controllerWithSession']; + $controller = $this->controllerWithSession(...); $this->assertEquals([$session], self::$resolver->getArguments($request, $controller)); } @@ -234,7 +234,7 @@ public function testGetSessionArgumentsWithExtendedSession() $session = new ExtendingSession(new MockArraySessionStorage()); $request = Request::create('/'); $request->setSession($session); - $controller = [$this, 'controllerWithExtendingSession']; + $controller = $this->controllerWithExtendingSession(...); $this->assertEquals([$session], self::$resolver->getArguments($request, $controller)); } @@ -244,7 +244,7 @@ public function testGetSessionArgumentsWithInterface() $session = $this->createMock(SessionInterface::class); $request = Request::create('/'); $request->setSession($session); - $controller = [$this, 'controllerWithSessionInterface']; + $controller = $this->controllerWithSessionInterface(...); $this->assertEquals([$session], self::$resolver->getArguments($request, $controller)); } @@ -255,7 +255,7 @@ public function testGetSessionMissMatchWithInterface() $session = $this->createMock(SessionInterface::class); $request = Request::create('/'); $request->setSession($session); - $controller = [$this, 'controllerWithExtendingSession']; + $controller = $this->controllerWithExtendingSession(...); self::$resolver->getArguments($request, $controller); } @@ -266,7 +266,7 @@ public function testGetSessionMissMatchWithImplementation() $session = new Session(new MockArraySessionStorage()); $request = Request::create('/'); $request->setSession($session); - $controller = [$this, 'controllerWithExtendingSession']; + $controller = $this->controllerWithExtendingSession(...); self::$resolver->getArguments($request, $controller); } @@ -275,7 +275,7 @@ public function testGetSessionMissMatchOnNull() { $this->expectException(\RuntimeException::class); $request = Request::create('/'); - $controller = [$this, 'controllerWithExtendingSession']; + $controller = $this->controllerWithExtendingSession(...); self::$resolver->getArguments($request, $controller); } diff --git a/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php b/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php index ebe1d7c2391ce..7ec66e9df61f5 100644 --- a/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php @@ -109,7 +109,7 @@ public function testBasicTypesSignature() public function testNamedClosure() { - $arguments = $this->factory->createArgumentMetadata(\Closure::fromCallable([$this, 'signature1'])); + $arguments = $this->factory->createArgumentMetadata($this->signature1(...)); $this->assertEquals([ new ArgumentMetadata('foo', self::class, false, false, null), diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/MemoryDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/MemoryDataCollectorTest.php index 63dd62ce70392..7ee2f6695fa91 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/MemoryDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/MemoryDataCollectorTest.php @@ -33,7 +33,6 @@ public function testBytesConversion($limit, $bytes) { $collector = new MemoryDataCollector(); $method = new \ReflectionMethod($collector, 'convertToBytes'); - $method->setAccessible(true); $this->assertEquals($bytes, $method->invoke($collector, $limit)); } diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/AddAnnotatedClassesToCachePassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/AddAnnotatedClassesToCachePassTest.php index 914b1dd8d68e0..ad8904902a426 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/AddAnnotatedClassesToCachePassTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/AddAnnotatedClassesToCachePassTest.php @@ -21,7 +21,6 @@ public function testExpandClasses() $r = new \ReflectionClass(AddAnnotatedClassesToCachePass::class); $pass = $r->newInstanceWithoutConstructor(); $r = new \ReflectionMethod(AddAnnotatedClassesToCachePass::class, 'expandClasses'); - $r->setAccessible(true); $expand = $r->getClosure($pass); $this->assertSame('Foo', $expand(['Foo'], [])[0]); diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php index 5694f4f0f442c..0432b0653c1a0 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php @@ -401,9 +401,6 @@ public function testAlias() $this->assertEqualsCanonicalizing([RegisterTestController::class.'::fooAction', 'foo::fooAction'], array_keys($locator)); } - /** - * @requires PHP 8.1 - */ public function testEnumArgumentIsIgnored() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ErrorListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ErrorListenerTest.php index 00a6bde9004ce..dc2ef3055eb39 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ErrorListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ErrorListenerTest.php @@ -41,9 +41,7 @@ public function testConstruct() $l = new ErrorListener('foo', $logger); $_logger = new \ReflectionProperty(\get_class($l), 'logger'); - $_logger->setAccessible(true); $_controller = new \ReflectionProperty(\get_class($l), 'controller'); - $_controller->setAccessible(true); $this->assertSame($logger, $_logger->getValue($l)); $this->assertSame('foo', $_controller->getValue($l)); diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php index 1d4da8445149b..024e6cf7e0e99 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php @@ -76,13 +76,11 @@ public function testSessionCookieOptions(array $phpSessionOptions, array $sessio public function provideSessionOptions(): \Generator { - if (\PHP_VERSION_ID > 70300) { - yield 'set_samesite_by_php' => [ - 'phpSessionOptions' => ['samesite' => Cookie::SAMESITE_STRICT], - 'sessionOptions' => ['cookie_path' => '/test/', 'cookie_domain' => '', 'cookie_secure' => true, 'cookie_httponly' => true], - 'expectedSessionOptions' => ['cookie_path' => '/test/', 'cookie_domain' => '', 'cookie_secure' => true, 'cookie_httponly' => true, 'cookie_samesite' => Cookie::SAMESITE_STRICT], - ]; - } + yield 'set_samesite_by_php' => [ + 'phpSessionOptions' => ['samesite' => Cookie::SAMESITE_STRICT], + 'sessionOptions' => ['cookie_path' => '/test/', 'cookie_domain' => '', 'cookie_secure' => true, 'cookie_httponly' => true], + 'expectedSessionOptions' => ['cookie_path' => '/test/', 'cookie_domain' => '', 'cookie_secure' => true, 'cookie_httponly' => true, 'cookie_samesite' => Cookie::SAMESITE_STRICT], + ]; yield 'set_cookie_path_by_php' => [ 'phpSessionOptions' => ['path' => '/prod/'], @@ -678,7 +676,7 @@ public function testSessionUsageCallbackWhenDebugAndStateless() $container = new Container(); $container->set('request_stack', $requestStack); - $container->set('session_collector', \Closure::fromCallable([$collector, 'collectSessionUsage'])); + $container->set('session_collector', $collector->collectSessionUsage(...)); $this->expectException(UnexpectedSessionUsageException::class); (new SessionListener($container, true))->onSessionUsage(); diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php index d17643c18675d..5adafee592f71 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php @@ -78,7 +78,6 @@ private function callGenerateFragmentUriMethod(ControllerReference $reference, R $renderer = $this->getMockForAbstractClass(RoutableFragmentRenderer::class); $r = new \ReflectionObject($renderer); $m = $r->getMethod('generateFragmentUri'); - $m->setAccessible(true); return $m->invoke($renderer, $reference, $request, $absolute); } diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php index cef30fad05ed6..42b009fc005ec 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php @@ -696,7 +696,6 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft $tmp[0][1]['date'] = $time->format(\DATE_RFC2822); $r = new \ReflectionObject($this->store); $m = $r->getMethod('save'); - $m->setAccessible(true); $m->invoke($this->store, 'md'.hash('sha256', 'http://localhost/'), serialize($tmp)); $this->request('GET', '/'); @@ -746,7 +745,6 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft $tmp[0][1]['date'] = $time->format(\DATE_RFC2822); $r = new \ReflectionObject($this->store); $m = $r->getMethod('save'); - $m->setAccessible(true); $m->invoke($this->store, 'md'.hash('sha256', 'http://localhost/'), serialize($tmp)); $this->request('GET', '/'); @@ -806,7 +804,6 @@ public function testFetchesFullResponseWhenCacheStaleAndNoValidatorsPresent() $tmp[0][1]['expires'] = $time->format(\DATE_RFC2822); $r = new \ReflectionObject($this->store); $m = $r->getMethod('save'); - $m->setAccessible(true); $m->invoke($this->store, 'md'.hash('sha256', 'http://localhost/'), serialize($tmp)); // build subsequent request; should be found but miss due to freshness diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php index da1f649127405..151b32bdd0deb 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php @@ -333,11 +333,9 @@ protected function getStoreMetadata($key) { $r = new \ReflectionObject($this->store); $m = $r->getMethod('getMetadata'); - $m->setAccessible(true); if ($key instanceof Request) { $m1 = $r->getMethod('getCacheKey'); - $m1->setAccessible(true); $key = $m1->invoke($this->store, $key); } @@ -348,7 +346,6 @@ protected function getStorePath($key) { $r = new \ReflectionObject($this->store); $m = $r->getMethod('getPath'); - $m->setAccessible(true); return $m->invoke($this->store, $key); } diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestHttpKernel.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestHttpKernel.php index 21c815838d5c4..4d35bf049431e 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestHttpKernel.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestHttpKernel.php @@ -69,7 +69,7 @@ public function isCatchingExceptions() public function getController(Request $request): callable|false { - return [$this, 'callController']; + return $this->callController(...); } public function getArguments(Request $request, callable $controller): array diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php index ae095fb9f630e..415a44ad61132 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php @@ -52,7 +52,7 @@ public function handle(Request $request, $type = HttpKernelInterface::MAIN_REQUE public function getController(Request $request): callable|false { - return [$this, 'callController']; + return $this->callController(...); } public function getArguments(Request $request, callable $controller): array diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpKernelBrowserTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpKernelBrowserTest.php index b6e391625c038..e30c70aa00982 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpKernelBrowserTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpKernelBrowserTest.php @@ -59,7 +59,6 @@ public function testFilterResponseConvertsCookies() $r = new \ReflectionObject($client); $m = $r->getMethod('filterResponse'); - $m->setAccessible(true); $response = new Response(); $response->headers->setCookie($cookie1 = new Cookie('foo', 'bar', \DateTime::createFromFormat('j-M-Y H:i:s T', '15-Feb-2009 20:00:00 GMT')->format('U'), '/foo', 'http://example.com', true, true, false, null)); @@ -80,7 +79,6 @@ public function testFilterResponseSupportsStreamedResponses() $r = new \ReflectionObject($client); $m = $r->getMethod('filterResponse'); - $m->setAccessible(true); $response = new StreamedResponse(function () { echo 'foo'; diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php index 7f567b99b6c82..8fcabdacc54c4 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php @@ -348,8 +348,6 @@ public function testReadLineFromFile() { $r = new \ReflectionMethod($this->storage, 'readLineFromFile'); - $r->setAccessible(true); - $h = tmpfile(); fwrite($h, "line1\n\n\nline2\n"); diff --git a/src/Symfony/Component/HttpKernel/Tests/TestHttpKernel.php b/src/Symfony/Component/HttpKernel/Tests/TestHttpKernel.php index e248f83fddfea..0510144b65d16 100644 --- a/src/Symfony/Component/HttpKernel/Tests/TestHttpKernel.php +++ b/src/Symfony/Component/HttpKernel/Tests/TestHttpKernel.php @@ -27,7 +27,7 @@ public function __construct() public function getController(Request $request): callable|false { - return [$this, 'callController']; + return $this->callController(...); } public function getArguments(Request $request, callable $controller): array diff --git a/src/Symfony/Component/HttpKernel/composer.json b/src/Symfony/Component/HttpKernel/composer.json index 4c7e77f39e16d..bb160034e4ad0 100644 --- a/src/Symfony/Component/HttpKernel/composer.json +++ b/src/Symfony/Component/HttpKernel/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/error-handler": "^5.4|^6.0", "symfony/event-dispatcher": "^5.4|^6.0", "symfony/http-foundation": "^5.4|^6.0", diff --git a/src/Symfony/Component/Intl/composer.json b/src/Symfony/Component/Intl/composer.json index 28dd17c0d0720..5711774b5aec8 100644 --- a/src/Symfony/Component/Intl/composer.json +++ b/src/Symfony/Component/Intl/composer.json @@ -24,8 +24,7 @@ } ], "require": { - "php": ">=8.0.2", - "symfony/polyfill-php81": "^1.22" + "php": ">=8.1" }, "require-dev": { "symfony/filesystem": "^5.4|^6.0" diff --git a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/EntryManagerTest.php b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/EntryManagerTest.php index d3ba6d1a99ac5..5e864e1914b24 100644 --- a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/EntryManagerTest.php +++ b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/EntryManagerTest.php @@ -60,7 +60,6 @@ public function testMoveWithRFC4514DistinguishedName(string $dn, string $expecte $entryManager = new EntryManager($connection); $method = (new \ReflectionClass(EntryManager::class))->getMethod('parseRdnFromEntry'); - $method->setAccessible(true); $cn = $method->invokeArgs($entryManager, [$entry, 'a']); diff --git a/src/Symfony/Component/Ldap/composer.json b/src/Symfony/Component/Ldap/composer.json index 51b2570a1870c..970dfabf38558 100644 --- a/src/Symfony/Component/Ldap/composer.json +++ b/src/Symfony/Component/Ldap/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "ext-ldap": "*", "symfony/options-resolver": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Lock/Tests/Store/MongoDbStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/MongoDbStoreTest.php index 49227783742e2..6ccdb70f480a5 100644 --- a/src/Symfony/Component/Lock/Tests/Store/MongoDbStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/MongoDbStoreTest.php @@ -121,7 +121,6 @@ public function testUriPrecedence() $storeReflection = new \ReflectionObject($store); $optionsProperty = $storeReflection->getProperty('options'); - $optionsProperty->setAccessible(true); $options = $optionsProperty->getValue($store); $this->assertSame('test_uri', $options['database']); @@ -160,7 +159,6 @@ public function testUriCollectionStrip(string $uri, array $options, string $driv $storeReflection = new \ReflectionObject($store); $uriProperty = $storeReflection->getProperty('uri'); - $uriProperty->setAccessible(true); $uri = $uriProperty->getValue($store); $this->assertSame($driverUri, $uri); } diff --git a/src/Symfony/Component/Lock/composer.json b/src/Symfony/Component/Lock/composer.json index c76806b41650a..21661bbde496c 100644 --- a/src/Symfony/Component/Lock/composer.json +++ b/src/Symfony/Component/Lock/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/log": "^1|^2|^3" }, "require-dev": { diff --git a/src/Symfony/Component/Mailer/Bridge/Amazon/Tests/Transport/SesSmtpTransportTest.php b/src/Symfony/Component/Mailer/Bridge/Amazon/Tests/Transport/SesSmtpTransportTest.php index 7287bc9a3f73f..29d34f892a0f7 100644 --- a/src/Symfony/Component/Mailer/Bridge/Amazon/Tests/Transport/SesSmtpTransportTest.php +++ b/src/Symfony/Component/Mailer/Bridge/Amazon/Tests/Transport/SesSmtpTransportTest.php @@ -26,7 +26,6 @@ public function testTagAndMetadataAndMessageStreamHeaders() $transport = new SesSmtpTransport('user', 'pass'); $method = new \ReflectionMethod(SesSmtpTransport::class, 'addSesHeaders'); - $method->setAccessible(true); $method->invoke($transport, $email); $this->assertCount(1, $email->getHeaders()->toArray()); diff --git a/src/Symfony/Component/Mailer/Bridge/Amazon/composer.json b/src/Symfony/Component/Mailer/Bridge/Amazon/composer.json index 9adf90c0e32a3..1e99c0fb35a4a 100644 --- a/src/Symfony/Component/Mailer/Bridge/Amazon/composer.json +++ b/src/Symfony/Component/Mailer/Bridge/Amazon/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "async-aws/ses": "^1.0", "symfony/mailer": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Mailer/Bridge/Google/composer.json b/src/Symfony/Component/Mailer/Bridge/Google/composer.json index 6ff31d950ff8c..4f9d177b3871c 100644 --- a/src/Symfony/Component/Mailer/Bridge/Google/composer.json +++ b/src/Symfony/Component/Mailer/Bridge/Google/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/mailer": "^5.4|^6.0" }, "autoload": { diff --git a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillApiTransportTest.php b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillApiTransportTest.php index 152e198309dc3..d8508d217e5ce 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillApiTransportTest.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillApiTransportTest.php @@ -59,7 +59,6 @@ public function testCustomHeader() $transport = new MandrillApiTransport('ACCESS_KEY'); $method = new \ReflectionMethod(MandrillApiTransport::class, 'getPayload'); - $method->setAccessible(true); $payload = $method->invoke($transport, $email, $envelope); $this->assertArrayHasKey('message', $payload); @@ -133,7 +132,6 @@ public function testTagAndMetadataHeaders() $transport = new MandrillApiTransport('ACCESS_KEY'); $method = new \ReflectionMethod(MandrillApiTransport::class, 'getPayload'); - $method->setAccessible(true); $payload = $method->invoke($transport, $email, $envelope); $this->assertArrayHasKey('message', $payload); @@ -153,7 +151,6 @@ public function testCanHaveMultipleTags() $transport = new MandrillApiTransport('ACCESS_KEY'); $method = new \ReflectionMethod(MandrillApiTransport::class, 'getPayload'); - $method->setAccessible(true); $payload = $method->invoke($transport, $email, $envelope); $this->assertArrayHasKey('message', $payload); diff --git a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillHttpTransportTest.php b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillHttpTransportTest.php index 8f5eeb1f02012..ff582d5e9451f 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillHttpTransportTest.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillHttpTransportTest.php @@ -118,7 +118,6 @@ public function testTagAndMetadataHeaders() $transport = new MandrillHttpTransport('key'); $method = new \ReflectionMethod(MandrillHttpTransport::class, 'addMandrillHeaders'); - $method->setAccessible(true); $method->invoke($transport, $email); $this->assertCount(3, $email->getHeaders()->toArray()); diff --git a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillSmtpTransportTest.php b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillSmtpTransportTest.php index e2b0e7ff38c7a..a49ef7f9d754b 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillSmtpTransportTest.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillSmtpTransportTest.php @@ -30,7 +30,6 @@ public function testTagAndMetadataHeaders() $transport = new MandrillSmtpTransport('user', 'password'); $method = new \ReflectionMethod(MandrillSmtpTransport::class, 'addMandrillHeaders'); - $method->setAccessible(true); $method->invoke($transport, $email); $this->assertCount(3, $email->getHeaders()->toArray()); diff --git a/src/Symfony/Component/Mailer/Bridge/Mailchimp/composer.json b/src/Symfony/Component/Mailer/Bridge/Mailchimp/composer.json index fd45076377e67..dcd2cb175a054 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailchimp/composer.json +++ b/src/Symfony/Component/Mailer/Bridge/Mailchimp/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/mailer": "^5.4|^6.0" }, "require-dev": { diff --git a/src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Transport/MailgunApiTransportTest.php b/src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Transport/MailgunApiTransportTest.php index e9e27e3605359..24f3d21d35fc0 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Transport/MailgunApiTransportTest.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Transport/MailgunApiTransportTest.php @@ -73,7 +73,6 @@ public function testCustomHeader() $transport = new MailgunApiTransport('ACCESS_KEY', 'DOMAIN'); $method = new \ReflectionMethod(MailgunApiTransport::class, 'getPayload'); - $method->setAccessible(true); $payload = $method->invoke($transport, $email, $envelope); $this->assertArrayHasKey('h:x-mailgun-variables', $payload); @@ -110,7 +109,6 @@ public function testPrefixHeaderWithH() $transport = new MailgunApiTransport('ACCESS_KEY', 'DOMAIN'); $method = new \ReflectionMethod(MailgunApiTransport::class, 'getPayload'); - $method->setAccessible(true); $payload = $method->invoke($transport, $email, $envelope); $this->assertArrayHasKey('h:bar', $payload, 'We should prefix headers with "h:" to keep BC'); @@ -255,7 +253,6 @@ public function testTagAndMetadataHeaders() $transport = new MailgunApiTransport('ACCESS_KEY', 'DOMAIN'); $method = new \ReflectionMethod(MailgunApiTransport::class, 'getPayload'); - $method->setAccessible(true); $payload = $method->invoke($transport, $email, $envelope); $this->assertArrayHasKey('h:x-mailgun-variables', $payload); $this->assertEquals($json, $payload['h:x-mailgun-variables']); diff --git a/src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Transport/MailgunHttpTransportTest.php b/src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Transport/MailgunHttpTransportTest.php index 320d6d10d228f..b16cfdbd0a84c 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Transport/MailgunHttpTransportTest.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Transport/MailgunHttpTransportTest.php @@ -128,7 +128,6 @@ public function testTagAndMetadataHeaders() $transport = new MailgunHttpTransport('key', 'domain'); $method = new \ReflectionMethod(MailgunHttpTransport::class, 'addMailgunHeaders'); - $method->setAccessible(true); $method->invoke($transport, $email); $this->assertCount(4, $email->getHeaders()->toArray()); diff --git a/src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Transport/MailgunSmtpTransportTest.php b/src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Transport/MailgunSmtpTransportTest.php index 89712064b3e49..aaf356ad6a44c 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Transport/MailgunSmtpTransportTest.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Transport/MailgunSmtpTransportTest.php @@ -32,7 +32,6 @@ public function testTagAndMetadataHeaders() $transport = new MailgunSmtpTransport('user', 'password'); $method = new \ReflectionMethod(MailgunSmtpTransport::class, 'addMailgunHeaders'); - $method->setAccessible(true); $method->invoke($transport, $email); $this->assertCount(3, $email->getHeaders()->toArray()); diff --git a/src/Symfony/Component/Mailer/Bridge/Mailgun/Transport/MailgunApiTransport.php b/src/Symfony/Component/Mailer/Bridge/Mailgun/Transport/MailgunApiTransport.php index 224443cc0f5e3..b81f56d25a02c 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailgun/Transport/MailgunApiTransport.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailgun/Transport/MailgunApiTransport.php @@ -160,7 +160,6 @@ private function prepareAttachments(Email $email, ?string $html): array $new = basename($filename); $html = str_replace('cid:'.$filename, 'cid:'.$new, $html); $p = new \ReflectionProperty($attachment, 'filename'); - $p->setAccessible(true); $p->setValue($attachment, $new); } $inlines[] = $attachment; diff --git a/src/Symfony/Component/Mailer/Bridge/Mailgun/composer.json b/src/Symfony/Component/Mailer/Bridge/Mailgun/composer.json index e15442323bc33..a7832bd5500f1 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailgun/composer.json +++ b/src/Symfony/Component/Mailer/Bridge/Mailgun/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/mailer": "^5.4|^6.0" }, "require-dev": { diff --git a/src/Symfony/Component/Mailer/Bridge/Mailjet/Tests/Transport/MailjetApiTransportTest.php b/src/Symfony/Component/Mailer/Bridge/Mailjet/Tests/Transport/MailjetApiTransportTest.php index 35bc75e0a52ad..b1370886318e2 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailjet/Tests/Transport/MailjetApiTransportTest.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailjet/Tests/Transport/MailjetApiTransportTest.php @@ -47,7 +47,6 @@ public function testPayloadFormat() $transport = new MailjetApiTransport(self::USER, self::PASSWORD); $method = new \ReflectionMethod(MailjetApiTransport::class, 'getPayload'); - $method->setAccessible(true); $payload = $method->invoke($transport, $email, $envelope); $this->assertArrayHasKey('Messages', $payload); @@ -98,7 +97,6 @@ public function testReplyTo() $transport = new MailjetApiTransport(self::USER, self::PASSWORD); $method = new \ReflectionMethod(MailjetApiTransport::class, 'getPayload'); - $method->setAccessible(true); $this->expectExceptionMessage('Mailjet\'s API only supports one Reply-To email, 2 given.'); diff --git a/src/Symfony/Component/Mailer/Bridge/Mailjet/Transport/MailjetApiTransport.php b/src/Symfony/Component/Mailer/Bridge/Mailjet/Transport/MailjetApiTransport.php index e97a71891ae4e..e21d488684994 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailjet/Transport/MailjetApiTransport.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailjet/Transport/MailjetApiTransport.php @@ -156,7 +156,7 @@ private function getPayload(Email $email, Envelope $envelope): array private function formatAddresses(array $addresses): array { - return array_map([$this, 'formatAddress'], $addresses); + return array_map($this->formatAddress(...), $addresses); } private function formatAddress(Address $address): array diff --git a/src/Symfony/Component/Mailer/Bridge/Mailjet/composer.json b/src/Symfony/Component/Mailer/Bridge/Mailjet/composer.json index 553657fd7019e..e57cd453e2116 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailjet/composer.json +++ b/src/Symfony/Component/Mailer/Bridge/Mailjet/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/mailer": "^5.4|^6.0" }, "require-dev": { diff --git a/src/Symfony/Component/Mailer/Bridge/OhMySmtp/Tests/Transport/OhMySmtpApiTransportTest.php b/src/Symfony/Component/Mailer/Bridge/OhMySmtp/Tests/Transport/OhMySmtpApiTransportTest.php index 7f64a8c997fdb..7b2eef63ef30c 100644 --- a/src/Symfony/Component/Mailer/Bridge/OhMySmtp/Tests/Transport/OhMySmtpApiTransportTest.php +++ b/src/Symfony/Component/Mailer/Bridge/OhMySmtp/Tests/Transport/OhMySmtpApiTransportTest.php @@ -58,7 +58,6 @@ public function testCustomHeader() $transport = new OhMySmtpApiTransport('ACCESS_KEY'); $method = new \ReflectionMethod(OhMySmtpApiTransport::class, 'getPayload'); - $method->setAccessible(true); $payload = $method->invoke($transport, $email, $envelope); $this->assertArrayHasKey('Headers', $payload); @@ -132,7 +131,6 @@ public function testTagAndMetadataHeaders() $transport = new OhMySmtpApiTransport('ACCESS_KEY'); $method = new \ReflectionMethod(OhMySmtpApiTransport::class, 'getPayload'); - $method->setAccessible(true); $payload = $method->invoke($transport, $email, $envelope); $this->assertArrayNotHasKey('Headers', $payload); diff --git a/src/Symfony/Component/Mailer/Bridge/OhMySmtp/Tests/Transport/OhMySmtpSmtpTransportTest.php b/src/Symfony/Component/Mailer/Bridge/OhMySmtp/Tests/Transport/OhMySmtpSmtpTransportTest.php index 20f3e48a20d5c..e740d56882871 100644 --- a/src/Symfony/Component/Mailer/Bridge/OhMySmtp/Tests/Transport/OhMySmtpSmtpTransportTest.php +++ b/src/Symfony/Component/Mailer/Bridge/OhMySmtp/Tests/Transport/OhMySmtpSmtpTransportTest.php @@ -25,7 +25,6 @@ public function testCustomHeader() $transport = new OhMySmtpSmtpTransport('ACCESS_KEY'); $method = new \ReflectionMethod(OhMySmtpSmtpTransport::class, 'addOhMySmtpHeaders'); - $method->setAccessible(true); $method->invoke($transport, $email); $this->assertCount(1, $email->getHeaders()->toArray()); @@ -41,7 +40,6 @@ public function testTagAndMetadataHeaders() $transport = new OhMySmtpSmtpTransport('ACCESS_KEY'); $method = new \ReflectionMethod(OhMySmtpSmtpTransport::class, 'addOhMySmtpHeaders'); - $method->setAccessible(true); $method->invoke($transport, $email); $this->assertCount(2, $email->getHeaders()->toArray()); diff --git a/src/Symfony/Component/Mailer/Bridge/OhMySmtp/composer.json b/src/Symfony/Component/Mailer/Bridge/OhMySmtp/composer.json index 6d1a1ae33526e..7b9090af125ed 100644 --- a/src/Symfony/Component/Mailer/Bridge/OhMySmtp/composer.json +++ b/src/Symfony/Component/Mailer/Bridge/OhMySmtp/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/event-dispatcher": "^1", "symfony/mailer": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Mailer/Bridge/Postmark/Tests/Transport/PostmarkApiTransportTest.php b/src/Symfony/Component/Mailer/Bridge/Postmark/Tests/Transport/PostmarkApiTransportTest.php index 4f89cc2fe94e8..058407becd6ef 100644 --- a/src/Symfony/Component/Mailer/Bridge/Postmark/Tests/Transport/PostmarkApiTransportTest.php +++ b/src/Symfony/Component/Mailer/Bridge/Postmark/Tests/Transport/PostmarkApiTransportTest.php @@ -61,7 +61,6 @@ public function testCustomHeader() $transport = new PostmarkApiTransport('ACCESS_KEY'); $method = new \ReflectionMethod(PostmarkApiTransport::class, 'getPayload'); - $method->setAccessible(true); $payload = $method->invoke($transport, $email, $envelope); $this->assertArrayHasKey('Headers', $payload); @@ -136,7 +135,6 @@ public function testTagAndMetadataAndMessageStreamHeaders() $transport = new PostmarkApiTransport('ACCESS_KEY'); $method = new \ReflectionMethod(PostmarkApiTransport::class, 'getPayload'); - $method->setAccessible(true); $payload = $method->invoke($transport, $email, $envelope); $this->assertArrayNotHasKey('Headers', $payload); @@ -158,7 +156,6 @@ public function testMultipleTagsAreNotAllowed() $transport = new PostmarkApiTransport('ACCESS_KEY'); $method = new \ReflectionMethod(PostmarkApiTransport::class, 'getPayload'); - $method->setAccessible(true); $this->expectException(TransportException::class); diff --git a/src/Symfony/Component/Mailer/Bridge/Postmark/Tests/Transport/PostmarkSmtpTransportTest.php b/src/Symfony/Component/Mailer/Bridge/Postmark/Tests/Transport/PostmarkSmtpTransportTest.php index b9f9a690bc976..55527243eb99a 100644 --- a/src/Symfony/Component/Mailer/Bridge/Postmark/Tests/Transport/PostmarkSmtpTransportTest.php +++ b/src/Symfony/Component/Mailer/Bridge/Postmark/Tests/Transport/PostmarkSmtpTransportTest.php @@ -28,7 +28,6 @@ public function testCustomHeader() $transport = new PostmarkSmtpTransport('ACCESS_KEY'); $method = new \ReflectionMethod(PostmarkSmtpTransport::class, 'addPostmarkHeaders'); - $method->setAccessible(true); $method->invoke($transport, $email); $this->assertCount(2, $email->getHeaders()->toArray()); @@ -47,7 +46,6 @@ public function testTagAndMetadataAndMessageStreamHeaders() $transport = new PostmarkSmtpTransport('ACCESS_KEY'); $method = new \ReflectionMethod(PostmarkSmtpTransport::class, 'addPostmarkHeaders'); - $method->setAccessible(true); $method->invoke($transport, $email); $this->assertCount(6, $email->getHeaders()->toArray()); @@ -67,7 +65,6 @@ public function testMultipleTagsAreNotAllowed() $transport = new PostmarkSmtpTransport('ACCESS_KEY'); $method = new \ReflectionMethod(PostmarkSmtpTransport::class, 'addPostmarkHeaders'); - $method->setAccessible(true); $this->expectException(TransportException::class); diff --git a/src/Symfony/Component/Mailer/Bridge/Postmark/composer.json b/src/Symfony/Component/Mailer/Bridge/Postmark/composer.json index 0b385f668d6ff..b33c1bdb9a664 100644 --- a/src/Symfony/Component/Mailer/Bridge/Postmark/composer.json +++ b/src/Symfony/Component/Mailer/Bridge/Postmark/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/mailer": "^5.4|^6.0" }, "require-dev": { diff --git a/src/Symfony/Component/Mailer/Bridge/Sendgrid/Tests/Transport/SendgridApiTransportTest.php b/src/Symfony/Component/Mailer/Bridge/Sendgrid/Tests/Transport/SendgridApiTransportTest.php index 6c4a48be3574d..f2740d6e35459 100644 --- a/src/Symfony/Component/Mailer/Bridge/Sendgrid/Tests/Transport/SendgridApiTransportTest.php +++ b/src/Symfony/Component/Mailer/Bridge/Sendgrid/Tests/Transport/SendgridApiTransportTest.php @@ -161,7 +161,6 @@ public function testCustomHeader() $transport = new SendgridApiTransport('ACCESS_KEY'); $method = new \ReflectionMethod(SendgridApiTransport::class, 'getPayload'); - $method->setAccessible(true); $payload = $method->invoke($transport, $email, $envelope); $this->assertArrayHasKey('headers', $payload); @@ -183,7 +182,6 @@ public function testReplyTo() $transport = new SendgridApiTransport('ACCESS_KEY'); $method = new \ReflectionMethod(SendgridApiTransport::class, 'getPayload'); - $method->setAccessible(true); $payload = $method->invoke($transport, $email, $envelope); $this->assertArrayHasKey('from', $payload); @@ -211,7 +209,6 @@ public function testEnvelopeSenderAndRecipients() $transport = new SendgridApiTransport('ACCESS_KEY'); $method = new \ReflectionMethod(SendgridApiTransport::class, 'getPayload'); - $method->setAccessible(true); $payload = $method->invoke($transport, $email, $envelope); $this->assertArrayHasKey('from', $payload); @@ -239,7 +236,6 @@ public function testTagAndMetadataHeaders() $transport = new SendgridApiTransport('ACCESS_KEY'); $method = new \ReflectionMethod(SendgridApiTransport::class, 'getPayload'); - $method->setAccessible(true); $payload = $method->invoke($transport, $email, $envelope); $this->assertArrayHasKey('categories', $payload); diff --git a/src/Symfony/Component/Mailer/Bridge/Sendgrid/composer.json b/src/Symfony/Component/Mailer/Bridge/Sendgrid/composer.json index 10a5cb40f13f8..f30b4ddd17811 100644 --- a/src/Symfony/Component/Mailer/Bridge/Sendgrid/composer.json +++ b/src/Symfony/Component/Mailer/Bridge/Sendgrid/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/mailer": "^5.4|^6.0" }, "require-dev": { diff --git a/src/Symfony/Component/Mailer/Bridge/Sendinblue/Tests/Transport/SendinblueApiTransportTest.php b/src/Symfony/Component/Mailer/Bridge/Sendinblue/Tests/Transport/SendinblueApiTransportTest.php index dfb8457c96e59..125c861f2825d 100644 --- a/src/Symfony/Component/Mailer/Bridge/Sendinblue/Tests/Transport/SendinblueApiTransportTest.php +++ b/src/Symfony/Component/Mailer/Bridge/Sendinblue/Tests/Transport/SendinblueApiTransportTest.php @@ -60,7 +60,6 @@ public function testCustomHeader() $transport = new SendinblueApiTransport('ACCESS_KEY'); $method = new \ReflectionMethod(SendinblueApiTransport::class, 'getPayload'); - $method->setAccessible(true); $payload = $method->invoke($transport, $email, $envelope); $this->assertArrayHasKey('X-Mailin-Custom', $payload['headers']); diff --git a/src/Symfony/Component/Mailer/Bridge/Sendinblue/composer.json b/src/Symfony/Component/Mailer/Bridge/Sendinblue/composer.json index 07e76d73ed903..ae969ab54e466 100644 --- a/src/Symfony/Component/Mailer/Bridge/Sendinblue/composer.json +++ b/src/Symfony/Component/Mailer/Bridge/Sendinblue/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/mailer": "^5.4|^6.0" }, "require-dev": { diff --git a/src/Symfony/Component/Mailer/Tests/Transport/FailoverTransportTest.php b/src/Symfony/Component/Mailer/Tests/Transport/FailoverTransportTest.php index 119c1131abad7..a2d849775745c 100644 --- a/src/Symfony/Component/Mailer/Tests/Transport/FailoverTransportTest.php +++ b/src/Symfony/Component/Mailer/Tests/Transport/FailoverTransportTest.php @@ -157,11 +157,9 @@ public function testSendOneDeadButRecover() private function assertTransports(RoundRobinTransport $transport, int $cursor, array $deadTransports) { $p = new \ReflectionProperty(RoundRobinTransport::class, 'cursor'); - $p->setAccessible(true); $this->assertSame($cursor, $p->getValue($transport)); $p = new \ReflectionProperty(RoundRobinTransport::class, 'deadTransports'); - $p->setAccessible(true); $this->assertSame($deadTransports, iterator_to_array($p->getValue($transport))); } } diff --git a/src/Symfony/Component/Mailer/Tests/Transport/RoundRobinTransportTest.php b/src/Symfony/Component/Mailer/Tests/Transport/RoundRobinTransportTest.php index fff75af64b457..b6828bbaac76d 100644 --- a/src/Symfony/Component/Mailer/Tests/Transport/RoundRobinTransportTest.php +++ b/src/Symfony/Component/Mailer/Tests/Transport/RoundRobinTransportTest.php @@ -74,7 +74,6 @@ public function testSendOneDead() $t2->expects($this->exactly(3))->method('send'); $t = new RoundRobinTransport([$t1, $t2]); $p = new \ReflectionProperty($t, 'cursor'); - $p->setAccessible(true); $p->setValue($t, 0); $t->send(new RawMessage('')); $this->assertTransports($t, 0, [$t1]); @@ -92,7 +91,6 @@ public function testSendOneDeadAndRecoveryNotWithinRetryPeriod() $t2->expects($this->once())->method('send')->will($this->throwException(new TransportException())); $t = new RoundRobinTransport([$t1, $t2], 60); $p = new \ReflectionProperty($t, 'cursor'); - $p->setAccessible(true); $p->setValue($t, 0); $t->send(new RawMessage('')); $this->assertTransports($t, 1, []); @@ -114,7 +112,6 @@ public function testSendOneDeadAndRecoveryWithinRetryPeriod() ->willReturnOnConsecutiveCalls($this->throwException(new TransportException())); $t = new RoundRobinTransport([$t1, $t2], 3); $p = new \ReflectionProperty($t, 'cursor'); - $p->setAccessible(true); $p->setValue($t, 0); $t->send(new RawMessage('')); $this->assertTransports($t, 1, []); @@ -130,14 +127,12 @@ public function testSendOneDeadAndRecoveryWithinRetryPeriod() private function assertTransports(RoundRobinTransport $transport, int $cursor, array $deadTransports) { $p = new \ReflectionProperty($transport, 'cursor'); - $p->setAccessible(true); if (-1 !== $cursor) { $this->assertSame($cursor, $p->getValue($transport)); } $cursor = $p->getValue($transport); $p = new \ReflectionProperty($transport, 'deadTransports'); - $p->setAccessible(true); $this->assertSame($deadTransports, iterator_to_array($p->getValue($transport))); return $cursor; diff --git a/src/Symfony/Component/Mailer/composer.json b/src/Symfony/Component/Mailer/composer.json index bd6d83ce5613a..71ddc374c7a3c 100644 --- a/src/Symfony/Component/Mailer/composer.json +++ b/src/Symfony/Component/Mailer/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "egulias/email-validator": "^2.1.10|^3", "psr/event-dispatcher": "^1", "psr/log": "^1|^2|^3", diff --git a/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Transport/ConnectionTest.php b/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Transport/ConnectionTest.php index 4606ed255d678..6e50b7d2a002c 100644 --- a/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Transport/ConnectionTest.php +++ b/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Transport/ConnectionTest.php @@ -290,7 +290,6 @@ public function testInjectQueueUrl(string $dsn, string $queueUrl) $r = new \ReflectionObject($connection); $queueProperty = $r->getProperty('queueUrl'); - $queueProperty->setAccessible(true); $this->assertSame($queueUrl, $queueProperty->getValue($connection)); } @@ -311,7 +310,6 @@ public function testNotInjectQueueUrl(string $dsn) $r = new \ReflectionObject($connection); $queueProperty = $r->getProperty('queueUrl'); - $queueProperty->setAccessible(true); $this->assertNull($queueProperty->getValue($connection)); } diff --git a/src/Symfony/Component/Messenger/Bridge/AmazonSqs/composer.json b/src/Symfony/Component/Messenger/Bridge/AmazonSqs/composer.json index d2e2f5ddf70bd..df8b9ad8df506 100644 --- a/src/Symfony/Component/Messenger/Bridge/AmazonSqs/composer.json +++ b/src/Symfony/Component/Messenger/Bridge/AmazonSqs/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "async-aws/core": "^1.5", "async-aws/sqs": "^1.0", "symfony/messenger": "^5.4|^6.0", diff --git a/src/Symfony/Component/Messenger/Bridge/Amqp/composer.json b/src/Symfony/Component/Messenger/Bridge/Amqp/composer.json index 195b9bb37b4d3..828483332bb79 100644 --- a/src/Symfony/Component/Messenger/Bridge/Amqp/composer.json +++ b/src/Symfony/Component/Messenger/Bridge/Amqp/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "ext-amqp": "*", "symfony/messenger": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Messenger/Bridge/Beanstalkd/composer.json b/src/Symfony/Component/Messenger/Bridge/Beanstalkd/composer.json index d0e1d4bbd712f..831e5fb221d8f 100644 --- a/src/Symfony/Component/Messenger/Bridge/Beanstalkd/composer.json +++ b/src/Symfony/Component/Messenger/Bridge/Beanstalkd/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "pda/pheanstalk": "^4.0", "symfony/messenger": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Messenger/Bridge/Doctrine/composer.json b/src/Symfony/Component/Messenger/Bridge/Doctrine/composer.json index 590d5a49ee43e..b9f534d16bcc1 100644 --- a/src/Symfony/Component/Messenger/Bridge/Doctrine/composer.json +++ b/src/Symfony/Component/Messenger/Bridge/Doctrine/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "doctrine/dbal": "^2.13|^3.0", "symfony/messenger": "^5.4|^6.0", "symfony/service-contracts": "^1.1|^2|^3" diff --git a/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/RedisExtIntegrationTest.php b/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/RedisExtIntegrationTest.php index 0dd5329906668..d4c1b7645b6b5 100644 --- a/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/RedisExtIntegrationTest.php +++ b/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/RedisExtIntegrationTest.php @@ -321,7 +321,6 @@ public function testGetAfterReject() private function getConnectionGroup(Connection $connection): string { $property = (new \ReflectionClass(Connection::class))->getProperty('group'); - $property->setAccessible(true); return $property->getValue($connection); } @@ -329,7 +328,6 @@ private function getConnectionGroup(Connection $connection): string private function getConnectionStream(Connection $connection): string { $property = (new \ReflectionClass(Connection::class))->getProperty('stream'); - $property->setAccessible(true); return $property->getValue($connection); } diff --git a/src/Symfony/Component/Messenger/Bridge/Redis/composer.json b/src/Symfony/Component/Messenger/Bridge/Redis/composer.json index fdc31b18b170f..b02550ba0bb58 100644 --- a/src/Symfony/Component/Messenger/Bridge/Redis/composer.json +++ b/src/Symfony/Component/Messenger/Bridge/Redis/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "ext-redis": "*", "symfony/messenger": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Messenger/EventListener/StopWorkerOnMemoryLimitListener.php b/src/Symfony/Component/Messenger/EventListener/StopWorkerOnMemoryLimitListener.php index 385bd28692024..e5f65f86bf1d5 100644 --- a/src/Symfony/Component/Messenger/EventListener/StopWorkerOnMemoryLimitListener.php +++ b/src/Symfony/Component/Messenger/EventListener/StopWorkerOnMemoryLimitListener.php @@ -30,7 +30,7 @@ public function __construct(int $memoryLimit, LoggerInterface $logger = null, ca $this->memoryLimit = $memoryLimit; $this->logger = $logger; $memoryResolver ??= static fn () => memory_get_usage(true); - $this->memoryResolver = $memoryResolver instanceof \Closure ? $memoryResolver : \Closure::fromCallable($memoryResolver); + $this->memoryResolver = $memoryResolver(...); } public function onWorkerRunning(WorkerRunningEvent $event): void diff --git a/src/Symfony/Component/Messenger/Handler/HandlerDescriptor.php b/src/Symfony/Component/Messenger/Handler/HandlerDescriptor.php index 4944c8b68a799..8b872bd94b9cb 100644 --- a/src/Symfony/Component/Messenger/Handler/HandlerDescriptor.php +++ b/src/Symfony/Component/Messenger/Handler/HandlerDescriptor.php @@ -25,9 +25,7 @@ final class HandlerDescriptor public function __construct(callable $handler, array $options = []) { - if (!$handler instanceof \Closure) { - $handler = \Closure::fromCallable($handler); - } + $handler = $handler(...); $this->handler = $handler; $this->options = $options; diff --git a/src/Symfony/Component/Messenger/Middleware/ActivationMiddleware.php b/src/Symfony/Component/Messenger/Middleware/ActivationMiddleware.php index dcad8bc2b274d..99e697f24b0ad 100644 --- a/src/Symfony/Component/Messenger/Middleware/ActivationMiddleware.php +++ b/src/Symfony/Component/Messenger/Middleware/ActivationMiddleware.php @@ -26,7 +26,7 @@ class ActivationMiddleware implements MiddlewareInterface public function __construct(MiddlewareInterface $inner, bool|callable $activated) { $this->inner = $inner; - $this->activated = $activated instanceof \Closure || \is_bool($activated) ? $activated : \Closure::fromCallable($activated); + $this->activated = \is_bool($activated) ? $activated : $activated(...); } /** diff --git a/src/Symfony/Component/Messenger/Transport/InMemoryTransport.php b/src/Symfony/Component/Messenger/Transport/InMemoryTransport.php index dc734c25d4c7d..f501d74dd29e2 100644 --- a/src/Symfony/Component/Messenger/Transport/InMemoryTransport.php +++ b/src/Symfony/Component/Messenger/Transport/InMemoryTransport.php @@ -151,9 +151,6 @@ private function decode(array $messagesEncoded): array return $messagesEncoded; } - return array_map( - [$this->serializer, 'decode'], - $messagesEncoded - ); + return array_map($this->serializer->decode(...), $messagesEncoded); } } diff --git a/src/Symfony/Component/Messenger/Transport/Serialization/Normalizer/FlattenExceptionNormalizer.php b/src/Symfony/Component/Messenger/Transport/Serialization/Normalizer/FlattenExceptionNormalizer.php index f02557897da50..ed56136b281a2 100644 --- a/src/Symfony/Component/Messenger/Transport/Serialization/Normalizer/FlattenExceptionNormalizer.php +++ b/src/Symfony/Component/Messenger/Transport/Serialization/Normalizer/FlattenExceptionNormalizer.php @@ -77,11 +77,9 @@ public function denormalize(mixed $data, string $type, string $format = null, ar } $property = new \ReflectionProperty(FlattenException::class, 'trace'); - $property->setAccessible(true); $property->setValue($object, (array) $data['trace']); $property = new \ReflectionProperty(FlattenException::class, 'traceAsString'); - $property->setAccessible(true); $property->setValue($object, $data['trace_as_string']); return $object; diff --git a/src/Symfony/Component/Messenger/composer.json b/src/Symfony/Component/Messenger/composer.json index 0b74341fe269b..10030eb879863 100644 --- a/src/Symfony/Component/Messenger/composer.json +++ b/src/Symfony/Component/Messenger/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/log": "^1|^2|^3" }, "require-dev": { diff --git a/src/Symfony/Component/Mime/Crypto/SMimeEncrypter.php b/src/Symfony/Component/Mime/Crypto/SMimeEncrypter.php index 0ccf2cd5efdf3..7d5dfecd219a7 100644 --- a/src/Symfony/Component/Mime/Crypto/SMimeEncrypter.php +++ b/src/Symfony/Component/Mime/Crypto/SMimeEncrypter.php @@ -33,7 +33,7 @@ public function __construct(string|array $certificate, int $cipher = null) } if (\is_array($certificate)) { - $this->certs = array_map([$this, 'normalizeFilePath'], $certificate); + $this->certs = array_map($this->normalizeFilePath(...), $certificate); } else { $this->certs = $this->normalizeFilePath($certificate); } diff --git a/src/Symfony/Component/Mime/Part/DataPart.php b/src/Symfony/Component/Mime/Part/DataPart.php index 3ae383528d8f8..38f4689f0df6f 100644 --- a/src/Symfony/Component/Mime/Part/DataPart.php +++ b/src/Symfony/Component/Mime/Part/DataPart.php @@ -152,7 +152,6 @@ public function __sleep(): array $this->_parent = []; foreach (['body', 'charset', 'subtype', 'disposition', 'name', 'encoding'] as $name) { $r = new \ReflectionProperty(TextPart::class, $name); - $r->setAccessible(true); $this->_parent[$name] = $r->getValue($this); } $this->_headers = $this->getHeaders(); @@ -163,7 +162,6 @@ public function __sleep(): array public function __wakeup() { $r = new \ReflectionProperty(AbstractPart::class, 'headers'); - $r->setAccessible(true); $r->setValue($this, $this->_headers); unset($this->_headers); @@ -175,7 +173,6 @@ public function __wakeup() throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); } $r = new \ReflectionProperty(TextPart::class, $name); - $r->setAccessible(true); $r->setValue($this, $this->_parent[$name]); } unset($this->_parent); diff --git a/src/Symfony/Component/Mime/Part/Multipart/FormDataPart.php b/src/Symfony/Component/Mime/Part/Multipart/FormDataPart.php index 5f473ed25b3b5..7b8656413fea6 100644 --- a/src/Symfony/Component/Mime/Part/Multipart/FormDataPart.php +++ b/src/Symfony/Component/Mime/Part/Multipart/FormDataPart.php @@ -96,10 +96,7 @@ private function configurePart(string $name, TextPart $part): TextPart { static $r; - if (null === $r) { - $r = new \ReflectionProperty(TextPart::class, 'encoding'); - $r->setAccessible(true); - } + $r ??= new \ReflectionProperty(TextPart::class, 'encoding'); $part->setDisposition('form-data'); $part->setName($name); diff --git a/src/Symfony/Component/Mime/Part/SMimePart.php b/src/Symfony/Component/Mime/Part/SMimePart.php index 29e9dd19eb25d..7021819f6fd8c 100644 --- a/src/Symfony/Component/Mime/Part/SMimePart.php +++ b/src/Symfony/Component/Mime/Part/SMimePart.php @@ -107,7 +107,6 @@ public function __sleep(): array public function __wakeup(): void { $r = new \ReflectionProperty(AbstractPart::class, 'headers'); - $r->setAccessible(true); $r->setValue($this, $this->_headers); unset($this->_headers); } diff --git a/src/Symfony/Component/Mime/Part/TextPart.php b/src/Symfony/Component/Mime/Part/TextPart.php index ca2b96067cd36..f5477c4b14dab 100644 --- a/src/Symfony/Component/Mime/Part/TextPart.php +++ b/src/Symfony/Component/Mime/Part/TextPart.php @@ -212,7 +212,6 @@ public function __sleep(): array public function __wakeup() { $r = new \ReflectionProperty(AbstractPart::class, 'headers'); - $r->setAccessible(true); $r->setValue($this, $this->_headers); unset($this->_headers); } diff --git a/src/Symfony/Component/Mime/Tests/MessageConverterTest.php b/src/Symfony/Component/Mime/Tests/MessageConverterTest.php index a0e71a08a9416..b00d87c84b7cb 100644 --- a/src/Symfony/Component/Mime/Tests/MessageConverterTest.php +++ b/src/Symfony/Component/Mime/Tests/MessageConverterTest.php @@ -67,7 +67,6 @@ public function testToEmail() private function assertConversion(Email $expected) { $r = new \ReflectionMethod($expected, 'generateBody'); - $r->setAccessible(true); $message = new Message($expected->getHeaders(), $r->invoke($expected)); $converted = MessageConverter::toEmail($message); diff --git a/src/Symfony/Component/Mime/Tests/Part/Multipart/FormDataPartTest.php b/src/Symfony/Component/Mime/Tests/Part/Multipart/FormDataPartTest.php index f6d5183cfa636..7ac3336f90666 100644 --- a/src/Symfony/Component/Mime/Tests/Part/Multipart/FormDataPartTest.php +++ b/src/Symfony/Component/Mime/Tests/Part/Multipart/FormDataPartTest.php @@ -22,7 +22,6 @@ class FormDataPartTest extends TestCase public function testConstructor() { $r = new \ReflectionProperty(TextPart::class, 'encoding'); - $r->setAccessible(true); $b = new TextPart('content'); $c = DataPart::fromPath($file = __DIR__.'/../../Fixtures/mimetypes/test.gif'); diff --git a/src/Symfony/Component/Mime/composer.json b/src/Symfony/Component/Mime/composer.json index f80f03412004b..f487df56072b1 100644 --- a/src/Symfony/Component/Mime/composer.json +++ b/src/Symfony/Component/Mime/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-intl-idn": "^1.10", "symfony/polyfill-mbstring": "^1.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/AllMySms/composer.json b/src/Symfony/Component/Notifier/Bridge/AllMySms/composer.json index 29f1db867b272..ebd5727c6172b 100644 --- a/src/Symfony/Component/Notifier/Bridge/AllMySms/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/AllMySms/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/AmazonSns/composer.json b/src/Symfony/Component/Notifier/Bridge/AmazonSns/composer.json index ec2eb1b39e289..6118121acc5aa 100644 --- a/src/Symfony/Component/Notifier/Bridge/AmazonSns/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/AmazonSns/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0", "async-aws/sns": "^1.0" diff --git a/src/Symfony/Component/Notifier/Bridge/Clickatell/composer.json b/src/Symfony/Component/Notifier/Bridge/Clickatell/composer.json index a0408e11c90c4..9727e1e5cc472 100644 --- a/src/Symfony/Component/Notifier/Bridge/Clickatell/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Clickatell/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/Discord/composer.json b/src/Symfony/Component/Notifier/Bridge/Discord/composer.json index 68083e85d68e3..ce9f0c05d7fa9 100644 --- a/src/Symfony/Component/Notifier/Bridge/Discord/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Discord/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0", "symfony/polyfill-mbstring": "^1.0" diff --git a/src/Symfony/Component/Notifier/Bridge/Esendex/composer.json b/src/Symfony/Component/Notifier/Bridge/Esendex/composer.json index db0ac5e551d3b..12b9d1ef4414a 100644 --- a/src/Symfony/Component/Notifier/Bridge/Esendex/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Esendex/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/Expo/composer.json b/src/Symfony/Component/Notifier/Bridge/Expo/composer.json index 714e91759a8e9..1292c789ff7a0 100644 --- a/src/Symfony/Component/Notifier/Bridge/Expo/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Expo/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/FakeChat/composer.json b/src/Symfony/Component/Notifier/Bridge/FakeChat/composer.json index c468fdc955301..e2343957bb4d3 100644 --- a/src/Symfony/Component/Notifier/Bridge/FakeChat/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/FakeChat/composer.json @@ -21,7 +21,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0", "symfony/event-dispatcher-contracts": "^2|^3", diff --git a/src/Symfony/Component/Notifier/Bridge/FakeSms/composer.json b/src/Symfony/Component/Notifier/Bridge/FakeSms/composer.json index ef4daeb1c0c75..29fb61b294923 100644 --- a/src/Symfony/Component/Notifier/Bridge/FakeSms/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/FakeSms/composer.json @@ -21,7 +21,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0", "symfony/event-dispatcher-contracts": "^2|^3", diff --git a/src/Symfony/Component/Notifier/Bridge/Firebase/composer.json b/src/Symfony/Component/Notifier/Bridge/Firebase/composer.json index 5e18a6521eba1..db0c2bcb228c5 100644 --- a/src/Symfony/Component/Notifier/Bridge/Firebase/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Firebase/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/FortySixElks/composer.json b/src/Symfony/Component/Notifier/Bridge/FortySixElks/composer.json index fb64293a68c25..dd8e2ca0bac57 100644 --- a/src/Symfony/Component/Notifier/Bridge/FortySixElks/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/FortySixElks/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/FreeMobile/composer.json b/src/Symfony/Component/Notifier/Bridge/FreeMobile/composer.json index 50dbc74098236..dc1a44b3b8a02 100644 --- a/src/Symfony/Component/Notifier/Bridge/FreeMobile/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/FreeMobile/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/GatewayApi/composer.json b/src/Symfony/Component/Notifier/Bridge/GatewayApi/composer.json index 3c2d8a26ab6cd..93501cbee2ed7 100644 --- a/src/Symfony/Component/Notifier/Bridge/GatewayApi/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/GatewayApi/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/Gitter/composer.json b/src/Symfony/Component/Notifier/Bridge/Gitter/composer.json index 08e3c9fec807e..0a93fc57ac147 100644 --- a/src/Symfony/Component/Notifier/Bridge/Gitter/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Gitter/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "ext-json": "*", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" diff --git a/src/Symfony/Component/Notifier/Bridge/GoogleChat/composer.json b/src/Symfony/Component/Notifier/Bridge/GoogleChat/composer.json index 1b08eb2f667c6..c4437bb50ca17 100644 --- a/src/Symfony/Component/Notifier/Bridge/GoogleChat/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/GoogleChat/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/Infobip/composer.json b/src/Symfony/Component/Notifier/Bridge/Infobip/composer.json index 0040fb137d739..45c18914058c0 100644 --- a/src/Symfony/Component/Notifier/Bridge/Infobip/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Infobip/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/Iqsms/composer.json b/src/Symfony/Component/Notifier/Bridge/Iqsms/composer.json index c2f6735f4b0f0..4863f846825dd 100644 --- a/src/Symfony/Component/Notifier/Bridge/Iqsms/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Iqsms/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/KazInfoTeh/composer.json b/src/Symfony/Component/Notifier/Bridge/KazInfoTeh/composer.json index ca169695cbc1a..518b2ab3ad434 100644 --- a/src/Symfony/Component/Notifier/Bridge/KazInfoTeh/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/KazInfoTeh/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "ext-simplexml": "*", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" diff --git a/src/Symfony/Component/Notifier/Bridge/LightSms/composer.json b/src/Symfony/Component/Notifier/Bridge/LightSms/composer.json index 0e9106a7895f9..d3c5e68d52988 100644 --- a/src/Symfony/Component/Notifier/Bridge/LightSms/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/LightSms/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/LinkedIn/composer.json b/src/Symfony/Component/Notifier/Bridge/LinkedIn/composer.json index 534617e8bd1b7..5d8abbc0a84cb 100644 --- a/src/Symfony/Component/Notifier/Bridge/LinkedIn/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/LinkedIn/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/Mailjet/composer.json b/src/Symfony/Component/Notifier/Bridge/Mailjet/composer.json index 5e1bb2271bbc8..53a8ea9fcfc0f 100644 --- a/src/Symfony/Component/Notifier/Bridge/Mailjet/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Mailjet/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/Mattermost/composer.json b/src/Symfony/Component/Notifier/Bridge/Mattermost/composer.json index 1c82cd9f62043..cb57bceb3539e 100644 --- a/src/Symfony/Component/Notifier/Bridge/Mattermost/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Mattermost/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/Mercure/composer.json b/src/Symfony/Component/Notifier/Bridge/Mercure/composer.json index 06082a225bfa3..791d1d340a47b 100644 --- a/src/Symfony/Component/Notifier/Bridge/Mercure/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Mercure/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "ext-json": "*", "symfony/mercure": "^0.5.2", "symfony/notifier": "^5.4|^6.0", diff --git a/src/Symfony/Component/Notifier/Bridge/MessageBird/composer.json b/src/Symfony/Component/Notifier/Bridge/MessageBird/composer.json index a5f7eee51da19..ae31c55173a7a 100644 --- a/src/Symfony/Component/Notifier/Bridge/MessageBird/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/MessageBird/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/MessageMedia/composer.json b/src/Symfony/Component/Notifier/Bridge/MessageMedia/composer.json index a5f70992e0bf6..90809726175c4 100644 --- a/src/Symfony/Component/Notifier/Bridge/MessageMedia/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/MessageMedia/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/MicrosoftTeams/composer.json b/src/Symfony/Component/Notifier/Bridge/MicrosoftTeams/composer.json index ef8b4a4e6cd13..6d5b8bd21e563 100644 --- a/src/Symfony/Component/Notifier/Bridge/MicrosoftTeams/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/MicrosoftTeams/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/Mobyt/composer.json b/src/Symfony/Component/Notifier/Bridge/Mobyt/composer.json index 9c8ebbaf66dc8..eb9c04dda25a5 100644 --- a/src/Symfony/Component/Notifier/Bridge/Mobyt/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Mobyt/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "ext-json": "*", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" diff --git a/src/Symfony/Component/Notifier/Bridge/Octopush/composer.json b/src/Symfony/Component/Notifier/Bridge/Octopush/composer.json index 08059195cecef..0255be0392b61 100644 --- a/src/Symfony/Component/Notifier/Bridge/Octopush/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Octopush/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/OneSignal/composer.json b/src/Symfony/Component/Notifier/Bridge/OneSignal/composer.json index 31a1f7ba4dffd..9e5c68474681a 100644 --- a/src/Symfony/Component/Notifier/Bridge/OneSignal/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/OneSignal/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/OrangeSms/composer.json b/src/Symfony/Component/Notifier/Bridge/OrangeSms/composer.json index 59b5b37879d01..49c9e07094606 100644 --- a/src/Symfony/Component/Notifier/Bridge/OrangeSms/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/OrangeSms/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/OvhCloud/composer.json b/src/Symfony/Component/Notifier/Bridge/OvhCloud/composer.json index 8f5103490de80..927b77d445376 100644 --- a/src/Symfony/Component/Notifier/Bridge/OvhCloud/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/OvhCloud/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/RocketChat/composer.json b/src/Symfony/Component/Notifier/Bridge/RocketChat/composer.json index f95315ae8f036..d605dec55a734 100644 --- a/src/Symfony/Component/Notifier/Bridge/RocketChat/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/RocketChat/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/composer.json b/src/Symfony/Component/Notifier/Bridge/Sendinblue/composer.json index f09a6a31888a8..486d650775bfc 100644 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Sendinblue/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "ext-json": "*", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" diff --git a/src/Symfony/Component/Notifier/Bridge/Sinch/composer.json b/src/Symfony/Component/Notifier/Bridge/Sinch/composer.json index 5524c2dbe75a4..ec67ad9371d8c 100644 --- a/src/Symfony/Component/Notifier/Bridge/Sinch/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Sinch/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "ext-json": "*", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" diff --git a/src/Symfony/Component/Notifier/Bridge/Slack/composer.json b/src/Symfony/Component/Notifier/Bridge/Slack/composer.json index 4fd242efb97b3..314eafa05b13b 100644 --- a/src/Symfony/Component/Notifier/Bridge/Slack/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Slack/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/Sms77/composer.json b/src/Symfony/Component/Notifier/Bridge/Sms77/composer.json index dfbabe02c6fe8..49d634c31db61 100644 --- a/src/Symfony/Component/Notifier/Bridge/Sms77/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Sms77/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/SmsBiuras/composer.json b/src/Symfony/Component/Notifier/Bridge/SmsBiuras/composer.json index bd2c38fe21052..6c42646b2d13d 100644 --- a/src/Symfony/Component/Notifier/Bridge/SmsBiuras/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/SmsBiuras/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/Smsapi/composer.json b/src/Symfony/Component/Notifier/Bridge/Smsapi/composer.json index 2d448de3fcdce..1c5ee120959c4 100644 --- a/src/Symfony/Component/Notifier/Bridge/Smsapi/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Smsapi/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/Smsc/composer.json b/src/Symfony/Component/Notifier/Bridge/Smsc/composer.json index 479a28e8e7af6..ce147146bbaeb 100644 --- a/src/Symfony/Component/Notifier/Bridge/Smsc/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Smsc/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/SpotHit/composer.json b/src/Symfony/Component/Notifier/Bridge/SpotHit/composer.json index 32663ef08e7cd..10aeec590ed00 100644 --- a/src/Symfony/Component/Notifier/Bridge/SpotHit/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/SpotHit/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/Telegram/composer.json b/src/Symfony/Component/Notifier/Bridge/Telegram/composer.json index eb6c3324a710d..c82f69ba421c5 100644 --- a/src/Symfony/Component/Notifier/Bridge/Telegram/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Telegram/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/Telnyx/composer.json b/src/Symfony/Component/Notifier/Bridge/Telnyx/composer.json index c35e9076d734a..748fce398383d 100644 --- a/src/Symfony/Component/Notifier/Bridge/Telnyx/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Telnyx/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/TurboSms/composer.json b/src/Symfony/Component/Notifier/Bridge/TurboSms/composer.json index 6f2ef44fc4200..f42e949d81419 100644 --- a/src/Symfony/Component/Notifier/Bridge/TurboSms/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/TurboSms/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "ext-json": "*", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0", diff --git a/src/Symfony/Component/Notifier/Bridge/Twilio/composer.json b/src/Symfony/Component/Notifier/Bridge/Twilio/composer.json index 0dbb5d55d7e55..15c78698d77eb 100644 --- a/src/Symfony/Component/Notifier/Bridge/Twilio/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Twilio/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/Yunpian/composer.json b/src/Symfony/Component/Notifier/Bridge/Yunpian/composer.json index 892c5062453fa..64fb38ece7a3b 100644 --- a/src/Symfony/Component/Notifier/Bridge/Yunpian/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Yunpian/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/Bridge/Zulip/composer.json b/src/Symfony/Component/Notifier/Bridge/Zulip/composer.json index 11a74734064d1..f6184e1c88038 100644 --- a/src/Symfony/Component/Notifier/Bridge/Zulip/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Zulip/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/notifier": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Notifier/composer.json b/src/Symfony/Component/Notifier/composer.json index b75a8bc5a0fa1..1178d5d1fa41d 100644 --- a/src/Symfony/Component/Notifier/composer.json +++ b/src/Symfony/Component/Notifier/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/log": "^1|^2|^3" }, "require-dev": { diff --git a/src/Symfony/Component/OptionsResolver/composer.json b/src/Symfony/Component/OptionsResolver/composer.json index 4fd80d95f6f91..3355b24efc6f3 100644 --- a/src/Symfony/Component/OptionsResolver/composer.json +++ b/src/Symfony/Component/OptionsResolver/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/deprecation-contracts": "^2.1|^3" }, "autoload": { diff --git a/src/Symfony/Component/PasswordHasher/composer.json b/src/Symfony/Component/PasswordHasher/composer.json index 62f42825be42e..1b4e8e8c722f0 100644 --- a/src/Symfony/Component/PasswordHasher/composer.json +++ b/src/Symfony/Component/PasswordHasher/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "require-dev": { "symfony/security-core": "^5.4|^6.0", diff --git a/src/Symfony/Component/Process/Pipes/UnixPipes.php b/src/Symfony/Component/Process/Pipes/UnixPipes.php index 063aa6ad6aa99..09c82f35b444b 100644 --- a/src/Symfony/Component/Process/Pipes/UnixPipes.php +++ b/src/Symfony/Component/Process/Pipes/UnixPipes.php @@ -109,7 +109,7 @@ public function readAndWrite(bool $blocking, bool $close = false): array unset($r[0]); // let's have a look if something changed in streams - set_error_handler([$this, 'handleError']); + set_error_handler($this->handleError(...)); if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) { restore_error_handler(); // if a system call has been interrupted, forget about it, let's try again diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index f26c28a69da1c..5009f88e6a8c0 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -308,7 +308,7 @@ public function start(callable $callback = null, array $env = []) $env += '\\' === \DIRECTORY_SEPARATOR ? array_diff_ukey($this->getDefaultEnv(), $env, 'strcasecmp') : $this->getDefaultEnv(); if (\is_array($commandline = $this->commandline)) { - $commandline = implode(' ', array_map([$this, 'escapeArgument'], $commandline)); + $commandline = implode(' ', array_map($this->escapeArgument(...), $commandline)); if ('\\' !== \DIRECTORY_SEPARATOR) { // exec is mandatory to deal with sending a signal to the process @@ -946,7 +946,7 @@ public function getLastOutputTime(): ?float */ public function getCommandLine(): string { - return \is_array($this->commandline) ? implode(' ', array_map([$this, 'escapeArgument'], $this->commandline)) : $this->commandline; + return \is_array($this->commandline) ? implode(' ', array_map($this->escapeArgument(...), $this->commandline)) : $this->commandline; } /** diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php index fc4de7bc5565a..25c88024f51b5 100644 --- a/src/Symfony/Component/Process/Tests/ProcessTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessTest.php @@ -176,7 +176,6 @@ public function testAllOutputIsActuallyReadOnTermination() // Don't call Process::run nor Process::wait to avoid any read of pipes $h = new \ReflectionProperty($p, 'process'); - $h->setAccessible(true); $h = $h->getValue($p); $s = @proc_get_status($h); @@ -568,7 +567,6 @@ public function testExitCodeText() $process = $this->getProcess(''); $r = new \ReflectionObject($process); $p = $r->getProperty('exitcode'); - $p->setAccessible(true); $p->setValue($process, 2); $this->assertEquals('Misuse of shell builtins', $process->getExitCodeText()); diff --git a/src/Symfony/Component/Process/composer.json b/src/Symfony/Component/Process/composer.json index 9f1aa8cf008cb..317c07e7151e3 100644 --- a/src/Symfony/Component/Process/composer.json +++ b/src/Symfony/Component/Process/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "autoload": { "psr-4": { "Symfony\\Component\\Process\\": "" }, diff --git a/src/Symfony/Component/PropertyAccess/composer.json b/src/Symfony/Component/PropertyAccess/composer.json index 33b31ddee81ae..e52c47ef91e01 100644 --- a/src/Symfony/Component/PropertyAccess/composer.json +++ b/src/Symfony/Component/PropertyAccess/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/property-info": "^5.4|^6.0" }, "require-dev": { diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index eac817f2060cf..6662584b758df 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -286,7 +286,6 @@ public function php80TypesProvider() /** * @dataProvider php81TypesProvider - * @requires PHP 8.1 */ public function testExtractPhp81Type($property, array $type = null) { diff --git a/src/Symfony/Component/PropertyInfo/composer.json b/src/Symfony/Component/PropertyInfo/composer.json index 7bc555b9bd316..07b3ecfb7c34b 100644 --- a/src/Symfony/Component/PropertyInfo/composer.json +++ b/src/Symfony/Component/PropertyInfo/composer.json @@ -23,7 +23,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/string": "^5.4|^6.0" }, "require-dev": { diff --git a/src/Symfony/Component/RateLimiter/composer.json b/src/Symfony/Component/RateLimiter/composer.json index 6944530c32b5e..660300314b1b7 100644 --- a/src/Symfony/Component/RateLimiter/composer.json +++ b/src/Symfony/Component/RateLimiter/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/lock": "^5.4|^6.0", "symfony/options-resolver": "^5.4|^6.0" }, diff --git a/src/Symfony/Component/Routing/Tests/RouterTest.php b/src/Symfony/Component/Routing/Tests/RouterTest.php index e1800975b0c39..cfc74d5a90e61 100644 --- a/src/Symfony/Component/Routing/Tests/RouterTest.php +++ b/src/Symfony/Component/Routing/Tests/RouterTest.php @@ -137,7 +137,6 @@ public function testMatchRequestWithUrlMatcherInterface() $matcher->expects($this->once())->method('match'); $p = new \ReflectionProperty($this->router, 'matcher'); - $p->setAccessible(true); $p->setValue($this->router, $matcher); $this->router->matchRequest(Request::create('/')); @@ -149,7 +148,6 @@ public function testMatchRequestWithRequestMatcherInterface() $matcher->expects($this->once())->method('matchRequest'); $p = new \ReflectionProperty($this->router, 'matcher'); - $p->setAccessible(true); $p->setValue($this->router, $matcher); $this->router->matchRequest(Request::create('/')); @@ -170,7 +168,6 @@ public function testDefaultLocaleIsPassedToGeneratorClass() $this->assertInstanceOf(UrlGeneratorInterface::class, $generator); $p = new \ReflectionProperty($generator, 'defaultLocale'); - $p->setAccessible(true); $this->assertSame('hr', $p->getValue($generator)); } @@ -190,7 +187,6 @@ public function testDefaultLocaleIsPassedToCompiledGeneratorCacheClass() $this->assertInstanceOf(UrlGeneratorInterface::class, $generator); $p = new \ReflectionProperty($generator, 'defaultLocale'); - $p->setAccessible(true); $this->assertSame('hr', $p->getValue($generator)); } diff --git a/src/Symfony/Component/Routing/composer.json b/src/Symfony/Component/Routing/composer.json index c0b13443b9e6d..5c7c9cdb8cb23 100644 --- a/src/Symfony/Component/Routing/composer.json +++ b/src/Symfony/Component/Routing/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "require-dev": { "symfony/config": "^5.4|^6.0", diff --git a/src/Symfony/Component/Runtime/GenericRuntime.php b/src/Symfony/Component/Runtime/GenericRuntime.php index 6277988a2fe4b..1d77529dfa093 100644 --- a/src/Symfony/Component/Runtime/GenericRuntime.php +++ b/src/Symfony/Component/Runtime/GenericRuntime.php @@ -88,10 +88,7 @@ public function __construct(array $options = []) */ public function getResolver(callable $callable, \ReflectionFunction $reflector = null): ResolverInterface { - if (!$callable instanceof \Closure) { - $callable = \Closure::fromCallable($callable); - } - + $callable = $callable(...); $parameters = ($reflector ?? new \ReflectionFunction($callable))->getParameters(); $arguments = function () use ($parameters) { $arguments = []; @@ -139,7 +136,7 @@ public function getRunner(?object $application): RunnerInterface throw new \LogicException(sprintf('"%s" doesn\'t know how to handle apps of type "%s".', get_debug_type($this), get_debug_type($application))); } - $application = \Closure::fromCallable($application); + $application = $application(...); } if ($_SERVER[$this->options['debug_var_name']] && ($r = new \ReflectionFunction($application)) && $r->getNumberOfRequiredParameters()) { diff --git a/src/Symfony/Component/Runtime/composer.json b/src/Symfony/Component/Runtime/composer.json index 6871b63481d0a..060b09edbcb56 100644 --- a/src/Symfony/Component/Runtime/composer.json +++ b/src/Symfony/Component/Runtime/composer.json @@ -15,7 +15,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "composer-plugin-api": "^1.0|^2.0" }, "require-dev": { diff --git a/src/Symfony/Component/Security/Core/Authentication/Token/Storage/TokenStorage.php b/src/Symfony/Component/Security/Core/Authentication/Token/Storage/TokenStorage.php index fec307d9f7faf..72450dc9d95f1 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Token/Storage/TokenStorage.php +++ b/src/Symfony/Component/Security/Core/Authentication/Token/Storage/TokenStorage.php @@ -56,7 +56,7 @@ public function setToken(TokenInterface $token = null) public function setInitializer(?callable $initializer): void { - $this->initializer = null === $initializer || $initializer instanceof \Closure ? $initializer : \Closure::fromCallable($initializer); + $this->initializer = null === $initializer ? null : $initializer(...); } public function reset() diff --git a/src/Symfony/Component/Security/Core/Authorization/TraceableAccessDecisionManager.php b/src/Symfony/Component/Security/Core/Authorization/TraceableAccessDecisionManager.php index e4acd4900b790..e1bd49a953e0f 100644 --- a/src/Symfony/Component/Security/Core/Authorization/TraceableAccessDecisionManager.php +++ b/src/Symfony/Component/Security/Core/Authorization/TraceableAccessDecisionManager.php @@ -39,10 +39,8 @@ public function __construct(AccessDecisionManagerInterface $manager) if ($this->manager instanceof AccessDecisionManager) { // The strategy and voters are stored in a private properties of the decorated service $reflection = new \ReflectionProperty(AccessDecisionManager::class, 'strategy'); - $reflection->setAccessible(true); $this->strategy = $reflection->getValue($manager); $reflection = new \ReflectionProperty(AccessDecisionManager::class, 'voters'); - $reflection->setAccessible(true); $this->voters = $reflection->getValue($manager); } } diff --git a/src/Symfony/Component/Security/Core/composer.json b/src/Symfony/Component/Security/Core/composer.json index 20c5074d6eb90..7e5f8679cd995 100644 --- a/src/Symfony/Component/Security/Core/composer.json +++ b/src/Symfony/Component/Security/Core/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/event-dispatcher-contracts": "^1.1|^2|^3", "symfony/service-contracts": "^1.1.6|^2|^3", "symfony/password-hasher": "^5.4|^6.0" diff --git a/src/Symfony/Component/Security/Csrf/CsrfTokenManager.php b/src/Symfony/Component/Security/Csrf/CsrfTokenManager.php index a20febe2bb756..410e5e1923ccc 100644 --- a/src/Symfony/Component/Security/Csrf/CsrfTokenManager.php +++ b/src/Symfony/Component/Security/Csrf/CsrfTokenManager.php @@ -59,7 +59,7 @@ public function __construct(TokenGeneratorInterface $generator = null, TokenStor } elseif ($namespace instanceof \Closure || \is_string($namespace)) { $this->namespace = $namespace; } elseif (\is_callable($namespace)) { - $this->namespace = \Closure::fromCallable($namespace); + $this->namespace = $namespace(...); } else { throw new InvalidArgumentException(sprintf('$namespace must be a string, a callable returning a string, null or an instance of "RequestStack". "%s" given.', get_debug_type($namespace))); } diff --git a/src/Symfony/Component/Security/Csrf/composer.json b/src/Symfony/Component/Security/Csrf/composer.json index 4bb9ca4d7c822..a4a595b4929bb 100644 --- a/src/Symfony/Component/Security/Csrf/composer.json +++ b/src/Symfony/Component/Security/Csrf/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/security-core": "^5.4|^6.0" }, "require-dev": { diff --git a/src/Symfony/Component/Security/Http/Authenticator/AbstractPreAuthenticatedAuthenticator.php b/src/Symfony/Component/Security/Http/Authenticator/AbstractPreAuthenticatedAuthenticator.php index 6e0493cb85cc2..9eeebd2481b66 100644 --- a/src/Symfony/Component/Security/Http/Authenticator/AbstractPreAuthenticatedAuthenticator.php +++ b/src/Symfony/Component/Security/Http/Authenticator/AbstractPreAuthenticatedAuthenticator.php @@ -92,7 +92,7 @@ public function supports(Request $request): ?bool public function authenticate(Request $request): Passport { return new SelfValidatingPassport( - new UserBadge($request->attributes->get('_pre_authenticated_username'), [$this->userProvider, 'loadUserByIdentifier']), + new UserBadge($request->attributes->get('_pre_authenticated_username'), $this->userProvider->loadUserByIdentifier(...)), [new PreAuthenticatedUserBadge()] ); } diff --git a/src/Symfony/Component/Security/Http/Authenticator/FormLoginAuthenticator.php b/src/Symfony/Component/Security/Http/Authenticator/FormLoginAuthenticator.php index a92f055cfb2ba..9af51b3e6dda7 100644 --- a/src/Symfony/Component/Security/Http/Authenticator/FormLoginAuthenticator.php +++ b/src/Symfony/Component/Security/Http/Authenticator/FormLoginAuthenticator.php @@ -83,7 +83,7 @@ public function authenticate(Request $request): Passport $credentials = $this->getCredentials($request); $passport = new Passport( - new UserBadge($credentials['username'], [$this->userProvider, 'loadUserByIdentifier']), + new UserBadge($credentials['username'], $this->userProvider->loadUserByIdentifier(...)), new PasswordCredentials($credentials['password']), [new RememberMeBadge()] ); diff --git a/src/Symfony/Component/Security/Http/Authenticator/HttpBasicAuthenticator.php b/src/Symfony/Component/Security/Http/Authenticator/HttpBasicAuthenticator.php index eb4dfdd553749..d4d1cef4d788f 100644 --- a/src/Symfony/Component/Security/Http/Authenticator/HttpBasicAuthenticator.php +++ b/src/Symfony/Component/Security/Http/Authenticator/HttpBasicAuthenticator.php @@ -64,7 +64,7 @@ public function authenticate(Request $request): Passport $password = $request->headers->get('PHP_AUTH_PW', ''); $passport = new Passport( - new UserBadge($username, [$this->userProvider, 'loadUserByIdentifier']), + new UserBadge($username, $this->userProvider->loadUserByIdentifier(...)), new PasswordCredentials($password) ); if ($this->userProvider instanceof PasswordUpgraderInterface) { diff --git a/src/Symfony/Component/Security/Http/Authenticator/JsonLoginAuthenticator.php b/src/Symfony/Component/Security/Http/Authenticator/JsonLoginAuthenticator.php index 3e6c227926ccd..97f38a69e7b99 100644 --- a/src/Symfony/Component/Security/Http/Authenticator/JsonLoginAuthenticator.php +++ b/src/Symfony/Component/Security/Http/Authenticator/JsonLoginAuthenticator.php @@ -87,7 +87,7 @@ public function authenticate(Request $request): Passport } $passport = new Passport( - new UserBadge($credentials['username'], [$this->userProvider, 'loadUserByIdentifier']), + new UserBadge($credentials['username'], $this->userProvider->loadUserByIdentifier(...)), new PasswordCredentials($credentials['password']) ); if ($this->userProvider instanceof PasswordUpgraderInterface) { diff --git a/src/Symfony/Component/Security/Http/Authenticator/Passport/Credentials/CustomCredentials.php b/src/Symfony/Component/Security/Http/Authenticator/Passport/Credentials/CustomCredentials.php index 65f6f65c83b8a..8ec0bb8e92159 100644 --- a/src/Symfony/Component/Security/Http/Authenticator/Passport/Credentials/CustomCredentials.php +++ b/src/Symfony/Component/Security/Http/Authenticator/Passport/Credentials/CustomCredentials.php @@ -34,7 +34,7 @@ class CustomCredentials implements CredentialsInterface */ public function __construct(callable $customCredentialsChecker, mixed $credentials) { - $this->customCredentialsChecker = $customCredentialsChecker instanceof \Closure ? $customCredentialsChecker : \Closure::fromCallable($customCredentialsChecker); + $this->customCredentialsChecker = $customCredentialsChecker(...); $this->credentials = $credentials; } diff --git a/src/Symfony/Component/Security/Http/EventListener/UserProviderListener.php b/src/Symfony/Component/Security/Http/EventListener/UserProviderListener.php index eb2c3d05ab139..c122fe3b8a561 100644 --- a/src/Symfony/Component/Security/Http/EventListener/UserProviderListener.php +++ b/src/Symfony/Component/Security/Http/EventListener/UserProviderListener.php @@ -45,6 +45,6 @@ public function checkPassport(CheckPassportEvent $event): void return; } - $badge->setUserLoader([$this->userProvider, 'loadUserByIdentifier']); + $badge->setUserLoader($this->userProvider->loadUserByIdentifier(...)); } } diff --git a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php index 8e0a700bc3493..5ec75f5e1242a 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php @@ -68,7 +68,7 @@ public function __construct(TokenStorageInterface $tokenStorage, iterable $userP $this->dispatcher = $dispatcher; $this->trustResolver = $trustResolver ?? new AuthenticationTrustResolver(); - $this->sessionTrackerEnabler = null === $sessionTrackerEnabler || $sessionTrackerEnabler instanceof \Closure ? $sessionTrackerEnabler : \Closure::fromCallable($sessionTrackerEnabler); + $this->sessionTrackerEnabler = null === $sessionTrackerEnabler ? null : $sessionTrackerEnabler(...); } /** @@ -85,7 +85,7 @@ public function supports(Request $request): ?bool public function authenticate(RequestEvent $event) { if (!$this->registered && null !== $this->dispatcher && $event->isMainRequest()) { - $this->dispatcher->addListener(KernelEvents::RESPONSE, [$this, 'onKernelResponse']); + $this->dispatcher->addListener(KernelEvents::RESPONSE, $this->onKernelResponse(...)); $this->registered = true; } @@ -162,7 +162,7 @@ public function onKernelResponse(ResponseEvent $event) return; } - $this->dispatcher?->removeListener(KernelEvents::RESPONSE, [$this, 'onKernelResponse']); + $this->dispatcher?->removeListener(KernelEvents::RESPONSE, $this->onKernelResponse(...)); $this->registered = false; $session = $request->getSession(); $sessionId = $session->getId(); diff --git a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php index 0703ec6ff5fd8..6ded72fa08b43 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php @@ -75,7 +75,7 @@ public function __construct(TokenStorageInterface $tokenStorage, AuthenticationT */ public function register(EventDispatcherInterface $dispatcher) { - $dispatcher->addListener(KernelEvents::EXCEPTION, [$this, 'onKernelException'], 1); + $dispatcher->addListener(KernelEvents::EXCEPTION, $this->onKernelException(...), 1); } /** @@ -83,7 +83,7 @@ public function register(EventDispatcherInterface $dispatcher) */ public function unregister(EventDispatcherInterface $dispatcher) { - $dispatcher->removeListener(KernelEvents::EXCEPTION, [$this, 'onKernelException']); + $dispatcher->removeListener(KernelEvents::EXCEPTION, $this->onKernelException(...)); } /** diff --git a/src/Symfony/Component/Security/Http/Tests/EventListener/PasswordMigratingListenerTest.php b/src/Symfony/Component/Security/Http/Tests/EventListener/PasswordMigratingListenerTest.php index 7d6ffa7aef33b..e66b9bb641813 100644 --- a/src/Symfony/Component/Security/Http/Tests/EventListener/PasswordMigratingListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/EventListener/PasswordMigratingListenerTest.php @@ -91,7 +91,7 @@ public function testUpgradeWithoutUpgrader() $event = $this->createEvent(new SelfValidatingPassport(new UserBadge('test', [$userLoader, 'loadUserByIdentifier']), [new PasswordUpgradeBadge('pa$$word')])); $this->listener->onLoginSuccess($event); - $event = $this->createEvent(new SelfValidatingPassport(new UserBadge('test', \Closure::fromCallable([$userLoader, 'loadUserByIdentifier'])), [new PasswordUpgradeBadge('pa$$word')])); + $event = $this->createEvent(new SelfValidatingPassport(new UserBadge('test', $userLoader->loadUserByIdentifier(...)), [new PasswordUpgradeBadge('pa$$word')])); $this->listener->onLoginSuccess($event); } diff --git a/src/Symfony/Component/Security/Http/Tests/EventListener/UserProviderListenerTest.php b/src/Symfony/Component/Security/Http/Tests/EventListener/UserProviderListenerTest.php index 4dc692f2619e5..85c2d22c69ac2 100644 --- a/src/Symfony/Component/Security/Http/Tests/EventListener/UserProviderListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/EventListener/UserProviderListenerTest.php @@ -37,9 +37,6 @@ public function testSetUserProvider() $this->listener->checkPassport(new CheckPassportEvent($this->createMock(AuthenticatorInterface::class), $passport)); - $badge = $passport->getBadge(UserBadge::class); - $this->assertEquals([$this->userProvider, 'loadUserByIdentifier'], $badge->getUserLoader()); - $user = new InMemoryUser('wouter', null); $this->userProvider->createUser($user); $this->assertTrue($user->isEqualTo($passport->getUser())); diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php index a70d7f65c9f4b..61c64a54bf648 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php @@ -175,7 +175,7 @@ public function testHandleAddsKernelResponseListener() $dispatcher->expects($this->once()) ->method('addListener') - ->with(KernelEvents::RESPONSE, [$listener, 'onKernelResponse']); + ->with(KernelEvents::RESPONSE, $listener->onKernelResponse(...)); $listener(new RequestEvent($this->createMock(HttpKernelInterface::class), new Request(), HttpKernelInterface::MAIN_REQUEST)); } @@ -197,7 +197,7 @@ public function testOnKernelResponseListenerRemovesItself() $dispatcher->expects($this->once()) ->method('removeListener') - ->with(KernelEvents::RESPONSE, [$listener, 'onKernelResponse']); + ->with(KernelEvents::RESPONSE, $listener->onKernelResponse(...)); $listener->onKernelResponse($event); } @@ -299,7 +299,7 @@ public function testWithPreviousNotStartedSession() $usageIndex = $session->getUsageIndex(); $tokenStorage = new TokenStorage(); - $listener = new ContextListener($tokenStorage, [], 'context_key', null, null, null, [$tokenStorage, 'getToken']); + $listener = new ContextListener($tokenStorage, [], 'context_key', null, null, null, $tokenStorage->getToken(...)); $listener(new RequestEvent($this->createMock(HttpKernelInterface::class), $request, HttpKernelInterface::MAIN_REQUEST)); $this->assertSame($usageIndex, $session->getUsageIndex()); @@ -318,7 +318,7 @@ public function testSessionIsNotReported() $tokenStorage = new TokenStorage(); - $listener = new ContextListener($tokenStorage, [], 'context_key', null, null, null, [$tokenStorage, 'getToken']); + $listener = new ContextListener($tokenStorage, [], 'context_key', null, null, null, $tokenStorage->getToken(...)); $listener(new RequestEvent($this->createMock(HttpKernelInterface::class), $request, HttpKernelInterface::MAIN_REQUEST)); } @@ -354,7 +354,7 @@ protected function runSessionOnKernelResponse($newToken, $original = null) new Response() ); - $listener = new ContextListener($tokenStorage, [], 'session', null, new EventDispatcher(), null, [$tokenStorage, 'enableUsageTracking']); + $listener = new ContextListener($tokenStorage, [], 'session', null, new EventDispatcher(), null, $tokenStorage->enableUsageTracking(...)); $listener->onKernelResponse($event); if ($session->getId() === $sessionId) { @@ -385,7 +385,7 @@ private function handleEventWithPreviousSession($userProviders, UserInterface $u $tokenStorage = new UsageTrackingTokenStorage($tokenStorage, new class($factories) implements ContainerInterface { use ServiceLocatorTrait; }); - $sessionTrackerEnabler = [$tokenStorage, 'enableUsageTracking']; + $sessionTrackerEnabler = $tokenStorage->enableUsageTracking(...); $listener = new ContextListener($tokenStorage, $userProviders, 'context_key', null, null, null, $sessionTrackerEnabler); diff --git a/src/Symfony/Component/Security/Http/composer.json b/src/Symfony/Component/Security/Http/composer.json index 0a0c43d849f07..a3d8963c94e6f 100644 --- a/src/Symfony/Component/Security/Http/composer.json +++ b/src/Symfony/Component/Security/Http/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/security-core": "^5.4|^6.0", "symfony/http-foundation": "^5.4|^6.0", "symfony/http-kernel": "^5.4|^6.0", diff --git a/src/Symfony/Component/Semaphore/composer.json b/src/Symfony/Component/Semaphore/composer.json index 14215f842f953..b21edccb6b276 100644 --- a/src/Symfony/Component/Semaphore/composer.json +++ b/src/Symfony/Component/Semaphore/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/log": "^1|^2|^3" }, "require-dev": { diff --git a/src/Symfony/Component/Serializer/Normalizer/MimeMessageNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/MimeMessageNormalizer.php index 7c195bf3021c9..fea86e8634e72 100644 --- a/src/Symfony/Component/Serializer/Normalizer/MimeMessageNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/MimeMessageNormalizer.php @@ -40,7 +40,6 @@ public function __construct(PropertyNormalizer $normalizer) $this->normalizer = $normalizer; $this->headerClassMap = (new \ReflectionClassConstant(Headers::class, 'HEADER_CLASS_MAP'))->getValue(); $this->headersProperty = new \ReflectionProperty(Headers::class, 'headers'); - $this->headersProperty->setAccessible(true); } public function setSerializer(SerializerInterface $serializer) diff --git a/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php index dda4246b01eb8..5856b28e43010 100644 --- a/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php @@ -132,11 +132,6 @@ protected function getAttributeValue(object $object, string $attribute, string $ return null; } - // Override visibility - if (!$reflectionProperty->isPublic()) { - $reflectionProperty->setAccessible(true); - } - if ($reflectionProperty->hasType()) { return $reflectionProperty->getValue($object); } @@ -170,11 +165,6 @@ protected function setAttributeValue(object $object, string $attribute, mixed $v return; } - // Override visibility - if (!$reflectionProperty->isPublic()) { - $reflectionProperty->setAccessible(true); - } - $reflectionProperty->setValue($object, $value); } diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php index adf4a1c9fc1c0..f99b3b3339477 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php @@ -922,10 +922,7 @@ private function createXmlEncoderWithDateTimeNormalizer(): XmlEncoder return $encoder; } - /** - * @return MockObject&NormalizerInterface - */ - private function createMockDateTimeNormalizer(): NormalizerInterface + private function createMockDateTimeNormalizer(): MockObject&NormalizerInterface { $mock = $this->createMock(CustomNormalizer::class); diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/BackedEnumNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/BackedEnumNormalizerTest.php index f36120465da5a..8ea2ac2b0f935 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/BackedEnumNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/BackedEnumNormalizerTest.php @@ -34,9 +34,6 @@ protected function setUp(): void $this->normalizer = new BackedEnumNormalizer(); } - /** - * @requires PHP 8.1 - */ public function testSupportsNormalization() { $this->assertTrue($this->normalizer->supportsNormalization(StringBackedEnumDummy::GET)); @@ -45,27 +42,18 @@ public function testSupportsNormalization() $this->assertFalse($this->normalizer->supportsNormalization(new \stdClass())); } - /** - * @requires PHP 8.1 - */ public function testNormalize() { $this->assertSame('GET', $this->normalizer->normalize(StringBackedEnumDummy::GET)); $this->assertSame(200, $this->normalizer->normalize(IntegerBackedEnumDummy::SUCCESS)); } - /** - * @requires PHP 8.1 - */ public function testNormalizeBadObjectTypeThrowsException() { $this->expectException(InvalidArgumentException::class); $this->normalizer->normalize(new \stdClass()); } - /** - * @requires PHP 8.1 - */ public function testSupportsDenormalization() { $this->assertTrue($this->normalizer->supportsDenormalization(null, StringBackedEnumDummy::class)); @@ -74,45 +62,30 @@ public function testSupportsDenormalization() $this->assertFalse($this->normalizer->supportsDenormalization(null, \stdClass::class)); } - /** - * @requires PHP 8.1 - */ public function testDenormalize() { $this->assertSame(StringBackedEnumDummy::GET, $this->normalizer->denormalize('GET', StringBackedEnumDummy::class)); $this->assertSame(IntegerBackedEnumDummy::SUCCESS, $this->normalizer->denormalize(200, IntegerBackedEnumDummy::class)); } - /** - * @requires PHP 8.1 - */ public function testDenormalizeNullValueThrowsException() { $this->expectException(NotNormalizableValueException::class); $this->normalizer->denormalize(null, StringBackedEnumDummy::class); } - /** - * @requires PHP 8.1 - */ public function testDenormalizeBooleanValueThrowsException() { $this->expectException(NotNormalizableValueException::class); $this->normalizer->denormalize(true, StringBackedEnumDummy::class); } - /** - * @requires PHP 8.1 - */ public function testDenormalizeObjectThrowsException() { $this->expectException(NotNormalizableValueException::class); $this->normalizer->denormalize(new \stdClass(), StringBackedEnumDummy::class); } - /** - * @requires PHP 8.1 - */ public function testDenormalizeBadBackingValueThrowsException() { $this->expectException(NotNormalizableValueException::class); diff --git a/src/Symfony/Component/Serializer/composer.json b/src/Symfony/Component/Serializer/composer.json index 159c5fe0f6019..5888e662d22d7 100644 --- a/src/Symfony/Component/Serializer/composer.json +++ b/src/Symfony/Component/Serializer/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8" }, "require-dev": { diff --git a/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php index d0bc1b0a7cd1f..6be89b80efa41 100644 --- a/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php +++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php @@ -65,11 +65,9 @@ public function testIsNotStartedEvent() $stopwatch = new Stopwatch(); $sections = new \ReflectionProperty(Stopwatch::class, 'sections'); - $sections->setAccessible(true); $section = $sections->getValue($stopwatch); $events = new \ReflectionProperty(Section::class, 'events'); - $events->setAccessible(true); $events->setValue(end($section), ['foo' => new StopwatchEvent(microtime(true) * 1000)]); diff --git a/src/Symfony/Component/Stopwatch/composer.json b/src/Symfony/Component/Stopwatch/composer.json index bb68c24de3f0b..da4c3d2e32f17 100644 --- a/src/Symfony/Component/Stopwatch/composer.json +++ b/src/Symfony/Component/Stopwatch/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/service-contracts": "^1|^2|^3" }, "autoload": { diff --git a/src/Symfony/Component/String/composer.json b/src/Symfony/Component/String/composer.json index 187323f8cc399..5e4febb5c9aa6 100644 --- a/src/Symfony/Component/String/composer.json +++ b/src/Symfony/Component/String/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", diff --git a/src/Symfony/Component/Templating/composer.json b/src/Symfony/Component/Templating/composer.json index 63c7edd134c02..8e7984cd05e98 100644 --- a/src/Symfony/Component/Templating/composer.json +++ b/src/Symfony/Component/Templating/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8" }, "require-dev": { diff --git a/src/Symfony/Component/Translation/Bridge/Crowdin/composer.json b/src/Symfony/Component/Translation/Bridge/Crowdin/composer.json index e798742f30f47..a798490194329 100644 --- a/src/Symfony/Component/Translation/Bridge/Crowdin/composer.json +++ b/src/Symfony/Component/Translation/Bridge/Crowdin/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/config": "^5.4|^6.0", "symfony/http-client": "^5.4|^6.0", "symfony/translation": "^5.4|^6.0" diff --git a/src/Symfony/Component/Translation/Bridge/Loco/composer.json b/src/Symfony/Component/Translation/Bridge/Loco/composer.json index 9152cbce391dc..c7a5f255db4d5 100644 --- a/src/Symfony/Component/Translation/Bridge/Loco/composer.json +++ b/src/Symfony/Component/Translation/Bridge/Loco/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/http-client": "^5.4|^6.0", "symfony/config": "^5.4|^6.0", "symfony/translation": "^6.1" diff --git a/src/Symfony/Component/Translation/Bridge/Lokalise/LokaliseProvider.php b/src/Symfony/Component/Translation/Bridge/Lokalise/LokaliseProvider.php index c965852481c6e..167430f1848d8 100644 --- a/src/Symfony/Component/Translation/Bridge/Lokalise/LokaliseProvider.php +++ b/src/Symfony/Component/Translation/Bridge/Lokalise/LokaliseProvider.php @@ -147,7 +147,7 @@ private function exportFiles(array $locales, array $domains): array 'original_filenames' => true, 'directory_prefix' => '%LANG_ISO%', 'filter_langs' => array_values($locales), - 'filter_filenames' => array_map([$this, 'getLokaliseFilenameFromDomain'], $domains), + 'filter_filenames' => array_map($this->getLokaliseFilenameFromDomain(...), $domains), 'export_empty_as' => 'skip', ], ]); diff --git a/src/Symfony/Component/Translation/Bridge/Lokalise/composer.json b/src/Symfony/Component/Translation/Bridge/Lokalise/composer.json index 6ef313406d7cc..86849ee8b43dd 100644 --- a/src/Symfony/Component/Translation/Bridge/Lokalise/composer.json +++ b/src/Symfony/Component/Translation/Bridge/Lokalise/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/config": "^5.4|^6.0", "symfony/http-client": "^5.4|^6.0", "symfony/translation": "^5.4|^6.0" diff --git a/src/Symfony/Component/Translation/Command/XliffLintCommand.php b/src/Symfony/Component/Translation/Command/XliffLintCommand.php index e03dc53b858ed..88057db42e0bb 100644 --- a/src/Symfony/Component/Translation/Command/XliffLintCommand.php +++ b/src/Symfony/Component/Translation/Command/XliffLintCommand.php @@ -45,8 +45,8 @@ public function __construct(string $name = null, callable $directoryIteratorProv { parent::__construct($name); - $this->directoryIteratorProvider = null === $directoryIteratorProvider || $directoryIteratorProvider instanceof \Closure ? $directoryIteratorProvider : \Closure::fromCallable($directoryIteratorProvider); - $this->isReadableProvider = null === $isReadableProvider || $isReadableProvider instanceof \Closure ? $isReadableProvider : \Closure::fromCallable($isReadableProvider); + $this->directoryIteratorProvider = null === $directoryIteratorProvider ? null : $directoryIteratorProvider(...); + $this->isReadableProvider = null === $isReadableProvider ? null : $isReadableProvider(...); $this->requireStrictFileNames = $requireStrictFileNames; } diff --git a/src/Symfony/Component/Translation/Dumper/MoFileDumper.php b/src/Symfony/Component/Translation/Dumper/MoFileDumper.php index 08c8f899747ba..88f967c415553 100644 --- a/src/Symfony/Component/Translation/Dumper/MoFileDumper.php +++ b/src/Symfony/Component/Translation/Dumper/MoFileDumper.php @@ -57,7 +57,7 @@ public function formatCatalogue(MessageCatalogue $messages, string $domain, arra .$this->writeLong($offset[2] + $sourcesStart + $sourcesSize); } - $output = implode('', array_map([$this, 'writeLong'], $header)) + $output = implode('', array_map($this->writeLong(...), $header)) .$sourceOffsets .$targetOffsets .$sources diff --git a/src/Symfony/Component/Translation/Test/ProviderFactoryTestCase.php b/src/Symfony/Component/Translation/Test/ProviderFactoryTestCase.php index 8cf4be03b02f9..d1259c7e94042 100644 --- a/src/Symfony/Component/Translation/Test/ProviderFactoryTestCase.php +++ b/src/Symfony/Component/Translation/Test/ProviderFactoryTestCase.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Translation\Test; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Symfony\Component\HttpClient\MockHttpClient; @@ -33,11 +34,11 @@ abstract class ProviderFactoryTestCase extends TestCase { protected HttpClientInterface $client; - protected LoggerInterface $logger; + protected LoggerInterface|MockObject $logger; protected string $defaultLocale; - protected LoaderInterface $loader; - protected XliffFileDumper $xliffFileDumper; - protected TranslatorBagInterface $translatorBag; + protected LoaderInterface|MockObject $loader; + protected XliffFileDumper|MockObject $xliffFileDumper; + protected TranslatorBagInterface|MockObject $translatorBag; abstract public function createFactory(): ProviderFactoryInterface; diff --git a/src/Symfony/Component/Translation/Test/ProviderTestCase.php b/src/Symfony/Component/Translation/Test/ProviderTestCase.php index 6087c61e3f8d4..6de24ac311a1a 100644 --- a/src/Symfony/Component/Translation/Test/ProviderTestCase.php +++ b/src/Symfony/Component/Translation/Test/ProviderTestCase.php @@ -77,9 +77,6 @@ protected function getXliffFileDumper(): XliffFileDumper return $this->xliffFileDumper ??= $this->createMock(XliffFileDumper::class); } - /** - * @return TranslatorBagInterface|TranslatorBagInterface&MockObject - */ protected function getTranslatorBag(): TranslatorBagInterface { return $this->translatorBag ??= $this->createMock(TranslatorBagInterface::class); diff --git a/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php b/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php index 3c98c2055a4d7..6ffb5c1219f6e 100644 --- a/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php +++ b/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php @@ -172,7 +172,7 @@ public function testLintAutodetectsGithubActionEnvironment() public function testPassingClosureAndCallableToConstructor() { $command = new XliffLintCommand('translation:xliff:lint', - \Closure::fromCallable([$this, 'testPassingClosureAndCallableToConstructor']), + $this->testPassingClosureAndCallableToConstructor(...), [$this, 'testPassingClosureAndCallableToConstructor'] ); diff --git a/src/Symfony/Component/Translation/composer.json b/src/Symfony/Component/Translation/composer.json index abe8b972c13d4..98e00de5c9a86 100644 --- a/src/Symfony/Component/Translation/composer.json +++ b/src/Symfony/Component/Translation/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-mbstring": "~1.0", "symfony/translation-contracts": "^2.3|^3.0" }, diff --git a/src/Symfony/Component/Uid/Command/GenerateUuidCommand.php b/src/Symfony/Component/Uid/Command/GenerateUuidCommand.php index fd77b439d6f1d..0183acaa55650 100644 --- a/src/Symfony/Component/Uid/Command/GenerateUuidCommand.php +++ b/src/Symfony/Component/Uid/Command/GenerateUuidCommand.php @@ -166,11 +166,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int break; case $random: - $create = [$this->factory->randomBased(), 'create']; + $create = $this->factory->randomBased()->create(...); break; default: - $create = [$this->factory, 'create']; + $create = $this->factory->create(...); break; } diff --git a/src/Symfony/Component/Uid/composer.json b/src/Symfony/Component/Uid/composer.json index efa945cc6defe..d316800631b58 100644 --- a/src/Symfony/Component/Uid/composer.json +++ b/src/Symfony/Component/Uid/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-uuid": "^1.15" }, "require-dev": { diff --git a/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php b/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php index 7e6ed7b056a8b..25bde0d990f29 100644 --- a/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php +++ b/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php @@ -85,9 +85,6 @@ protected function newReflectionMember(object|string $objectOrClassName): \Refle } } - $member = new \ReflectionProperty($objectOrClassName, $this->getName()); - $member->setAccessible(true); - - return $member; + return new \ReflectionProperty($objectOrClassName, $this->getName()); } } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php index 0e4a521908dfd..634ea7f09944a 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php @@ -498,7 +498,6 @@ public function uploadedFileErrorProvider() // access FileValidator::factorizeSizes() private method to format max file size $reflection = new \ReflectionClass(\get_class(new FileValidator())); $method = $reflection->getMethod('factorizeSizes'); - $method->setAccessible(true); [, $limit, $suffix] = $method->invokeArgs(new FileValidator(), [0, UploadedFile::getMaxFilesize(), false]); // it correctly parses the maxSize option and not only uses simple string comparison diff --git a/src/Symfony/Component/Validator/Tests/Constraints/NotCompromisedPasswordValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/NotCompromisedPasswordValidatorTest.php index f9c9828c2fd80..dc2eafa930ced 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/NotCompromisedPasswordValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/NotCompromisedPasswordValidatorTest.php @@ -65,7 +65,6 @@ public function testEmptyStringIsValid() public function testInvalidPasswordButDisabled() { $r = new \ReflectionProperty($this->validator, 'enabled'); - $r->setAccessible(true); $r->setValue($this->validator, false); $this->validator->validate(self::PASSWORD_LEAKED, new NotCompromisedPassword()); diff --git a/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php index ad211ed7acf52..3128fbb6b1ab1 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php @@ -29,9 +29,6 @@ public function testInvalidPropertyName() public function testGetPropertyValueFromPublicGetter() { - // private getters don't work yet because ReflectionMethod::setAccessible() - // does not exist yet in a stable PHP release - $entity = new Entity('foobar'); $metadata = new GetterMetadata(self::CLASSNAME, 'internal'); diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/AnnotationLoaderTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/AnnotationLoaderTest.php index 10736de1b2f20..2a93287f90455 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/AnnotationLoaderTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/AnnotationLoaderTest.php @@ -215,9 +215,6 @@ public function provideNamespaces(): iterable { yield 'annotations' => ['Symfony\Component\Validator\Tests\Fixtures\Annotation']; yield 'attributes' => ['Symfony\Component\Validator\Tests\Fixtures\Attribute']; - - if (\PHP_VERSION_ID >= 80100) { - yield 'nested_attributes' => ['Symfony\Component\Validator\Tests\Fixtures\NestedAttribute']; - } + yield 'nested_attributes' => ['Symfony\Component\Validator\Tests\Fixtures\NestedAttribute']; } } diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php index 1813019b43a67..d99810a44becc 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php @@ -36,7 +36,6 @@ public function testLoadClassMetadataReturnsFalseIfEmpty() $this->assertFalse($loader->loadClassMetadata($metadata)); $r = new \ReflectionProperty($loader, 'classes'); - $r->setAccessible(true); $this->assertSame([], $r->getValue($loader)); } diff --git a/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php b/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php index 2a94022b5f24b..5ac368119a7fd 100644 --- a/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php +++ b/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php @@ -91,7 +91,6 @@ public function testEnableAnnotationMappingWithDefaultDoctrineAnnotationReader() $this->assertInstanceOf(AnnotationLoader::class, $loaders[0]); $r = new \ReflectionProperty(AnnotationLoader::class, 'reader'); - $r->setAccessible(true); $this->assertInstanceOf(PsrCachedReader::class, $r->getValue($loaders[0])); } @@ -108,7 +107,6 @@ public function testEnableAnnotationMappingWithCustomDoctrineAnnotationReader() $this->assertInstanceOf(AnnotationLoader::class, $loaders[0]); $r = new \ReflectionProperty(AnnotationLoader::class, 'reader'); - $r->setAccessible(true); $this->assertSame($reader, $r->getValue($loaders[0])); } diff --git a/src/Symfony/Component/Validator/composer.json b/src/Symfony/Component/Validator/composer.json index 9ae5623300fc4..63cb9e3a9745e 100644 --- a/src/Symfony/Component/Validator/composer.json +++ b/src/Symfony/Component/Validator/composer.json @@ -16,11 +16,10 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php81": "^1.22", "symfony/translation-contracts": "^1.1|^2|^3" }, "require-dev": { diff --git a/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php b/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php index 86d439f2bd874..26d36d80d8bc6 100644 --- a/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php @@ -144,7 +144,7 @@ public static function castReflectionGenerator(\ReflectionGenerator $c, array $a array_unshift($trace, [ 'function' => 'yield', 'file' => $function->getExecutingFile(), - 'line' => $function->getExecutingLine() - (int) (\PHP_VERSION_ID < 80100), + 'line' => $function->getExecutingLine(), ]); $trace[] = $frame; $a[$prefix.'trace'] = new TraceStub($trace, false, 0, -1, -1); diff --git a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php index 9afcc348a08bb..2f5283877a10f 100644 --- a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php +++ b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php @@ -121,46 +121,8 @@ protected function doClone(mixed $var): array } $stub = $arrayStub; - if (\PHP_VERSION_ID >= 80100) { - $stub->class = array_is_list($v) ? Stub::ARRAY_INDEXED : Stub::ARRAY_ASSOC; - $a = $v; - break; - } - - $stub->class = Stub::ARRAY_INDEXED; - - $j = -1; - foreach ($v as $gk => $gv) { - if ($gk !== ++$j) { - $stub->class = Stub::ARRAY_ASSOC; - $a = $v; - $a[$gid] = true; - break; - } - } - - // Copies of $GLOBALS have very strange behavior, - // let's detect them with some black magic - if (isset($v[$gid])) { - unset($v[$gid]); - $a = []; - foreach ($v as $gk => &$gv) { - if ($v === $gv && !isset($hardRefs[\ReflectionReference::fromArrayElement($v, $gk)->getId()])) { - unset($v); - $v = new Stub(); - $v->value = [$v->cut = \count($gv), Stub::TYPE_ARRAY => 0]; - $v->handle = -1; - $gv = &$a[$gk]; - $hardRefs[\ReflectionReference::fromArrayElement($a, $gk)->getId()] = &$gv; - $gv = $v; - } - - $a[$gk] = &$gv; - } - unset($gv); - } else { - $a = $v; - } + $stub->class = array_is_list($v) ? Stub::ARRAY_INDEXED : Stub::ARRAY_ASSOC; + $a = $v; break; case \is_object($v): diff --git a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php index 6ac3808367d14..ccc819cdecec6 100644 --- a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php @@ -73,7 +73,7 @@ public function setOutput($output) $output = fopen($output, 'w'); } $this->outputStream = $output; - $this->lineDumper = [$this, 'echoLine']; + $this->lineDumper = $this->echoLine(...); } return $prev; diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php index 19b250992cd0c..2d0bab03edae3 100644 --- a/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php @@ -153,7 +153,7 @@ public function testReflectionParameter() public function testReflectionParameterScalar() { - $f = eval('return function (int $a) {};'); + $f = function (int $a) {}; $var = new \ReflectionParameter($f, 0); $this->assertDumpMatchesFormat( @@ -170,7 +170,7 @@ public function testReflectionParameterScalar() public function testReflectionParameterMixed() { - $f = eval('return function (mixed $a) {};'); + $f = function (mixed $a) {}; $var = new \ReflectionParameter($f, 0); $this->assertDumpMatchesFormat( @@ -188,7 +188,7 @@ public function testReflectionParameterMixed() public function testReflectionParameterUnion() { - $f = eval('return function (int|float $a) {};'); + $f = function (int|float $a) {}; $var = new \ReflectionParameter($f, 0); $this->assertDumpMatchesFormat( @@ -205,7 +205,7 @@ public function testReflectionParameterUnion() public function testReflectionParameterNullableUnion() { - $f = eval('return function (int|float|null $a) {};'); + $f = function (int|float|null $a) {}; $var = new \ReflectionParameter($f, 0); $this->assertDumpMatchesFormat( @@ -221,12 +221,9 @@ public function testReflectionParameterNullableUnion() ); } - /** - * @requires PHP 8.1 - */ public function testReflectionParameterIntersection() { - $f = eval('return function (Traversable&Countable $a) {};'); + $f = function (\Traversable&\Countable $a) {}; $var = new \ReflectionParameter($f, 0); $this->assertDumpMatchesFormat( @@ -296,9 +293,6 @@ public function testReflectionUnionType() ); } - /** - * @requires PHP 8.1 - */ public function testReflectionIntersectionType() { $var = (new \ReflectionProperty(ReflectionIntersectionTypeFixture::class, 'a'))->getType(); @@ -339,8 +333,7 @@ public function testExtendsReflectionType() public function testReturnType() { - $f = eval('return function ():int {};'); - $line = __LINE__ - 1; + $f = function ():int {}; $this->assertDumpMatchesFormat( <<assertDumpMatchesFormat( <<assertDumpMatchesFormat( <<assertDumpMatchesFormat( <<assertDumpMatchesFormat($expectedDump, $generator); } - /** - * @requires PHP 8.1 - */ public function testNewInInitializer() { - $f = eval('return function ($a = new stdClass()) {};'); - $line = __LINE__ - 1; + $f = function ($a = new \stdClass()) {}; $this->assertDumpMatchesFormat( <<assertStringMatchesFormat($expected, print_r($clone, true)); } - /** - * @requires PHP 8.1 - */ public function testPhp81Enums() { $data = new Php81Enums(); diff --git a/src/Symfony/Component/VarDumper/Tests/Dumper/CliDumperTest.php b/src/Symfony/Component/VarDumper/Tests/Dumper/CliDumperTest.php index b2f4733081c29..74dbbe72a6f36 100644 --- a/src/Symfony/Component/VarDumper/Tests/Dumper/CliDumperTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Dumper/CliDumperTest.php @@ -380,75 +380,6 @@ public function testRefsInProperties() +"bar": &1 "foo" } -EOTXT - , - $out - ); - } - - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * @requires PHP < 8.1 - */ - public function testSpecialVars56() - { - $var = $this->getSpecialVars(); - - $this->assertDumpEquals( - <<<'EOTXT' -array:3 [ - 0 => array:1 [ - 0 => &1 array:1 [ - 0 => &1 array:1 [&1] - ] - ] - 1 => array:1 [ - "GLOBALS" => & array:1 [ …1] - ] - 2 => &3 array:1 [ - "GLOBALS" => &3 array:1 [&3] - ] -] -EOTXT - , - $var - ); - } - - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * @requires PHP < 8.1 - */ - public function testGlobals() - { - $var = $this->getSpecialVars(); - unset($var[0]); - $out = ''; - - $dumper = new CliDumper(function ($line, $depth) use (&$out) { - if ($depth >= 0) { - $out .= str_repeat(' ', $depth).$line."\n"; - } - }); - $dumper->setColors(false); - $cloner = new VarCloner(); - - $data = $cloner->cloneVar($var); - $dumper->dump($data); - - $this->assertSame( - <<<'EOTXT' -array:2 [ - 1 => array:1 [ - "GLOBALS" => & array:1 [ …1] - ] - 2 => &2 array:1 [ - "GLOBALS" => &2 array:1 [&2] - ] -] - EOTXT , $out diff --git a/src/Symfony/Component/VarDumper/composer.json b/src/Symfony/Component/VarDumper/composer.json index db04f58843606..71ec64c0de917 100644 --- a/src/Symfony/Component/VarDumper/composer.json +++ b/src/Symfony/Component/VarDumper/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { diff --git a/src/Symfony/Component/VarExporter/Internal/Hydrator.php b/src/Symfony/Component/VarExporter/Internal/Hydrator.php index 364d292d916e7..e280f70caeb3b 100644 --- a/src/Symfony/Component/VarExporter/Internal/Hydrator.php +++ b/src/Symfony/Component/VarExporter/Internal/Hydrator.php @@ -81,7 +81,7 @@ public static function getHydrator($class) switch ($class) { case 'ArrayIterator': case 'ArrayObject': - $constructor = \Closure::fromCallable([$classReflector->getConstructor(), 'invokeArgs']); + $constructor = $classReflector->getConstructor()->invokeArgs(...); return self::$hydrators[$class] = static function ($properties, $objects) use ($constructor) { foreach ($properties as $name => $values) { @@ -125,8 +125,7 @@ public static function getHydrator($class) $propertySetters = []; foreach ($classReflector->getProperties() as $propertyReflector) { if (!$propertyReflector->isStatic()) { - $propertyReflector->setAccessible(true); - $propertySetters[$propertyReflector->name] = \Closure::fromCallable([$propertyReflector, 'setValue']); + $propertySetters[$propertyReflector->name] = $propertyReflector->setValue(...); } } diff --git a/src/Symfony/Component/VarExporter/Internal/Registry.php b/src/Symfony/Component/VarExporter/Internal/Registry.php index a9fb0614654cc..1afebecd4a590 100644 --- a/src/Symfony/Component/VarExporter/Internal/Registry.php +++ b/src/Symfony/Component/VarExporter/Internal/Registry.php @@ -60,7 +60,7 @@ public static function f($class) { $reflector = self::$reflectors[$class] ?? self::getClassReflector($class, true, false); - return self::$factories[$class] = \Closure::fromCallable([$reflector, 'newInstanceWithoutConstructor']); + return self::$factories[$class] = $reflector->newInstanceWithoutConstructor(...); } public static function getClassReflector($class, $instantiableWithoutConstructor = false, $cloneable = null) @@ -132,10 +132,8 @@ public static function getClassReflector($class, $instantiableWithoutConstructor new \ReflectionProperty(\Error::class, 'trace'), new \ReflectionProperty(\Exception::class, 'trace'), ]; - $setTrace[0]->setAccessible(true); - $setTrace[1]->setAccessible(true); - $setTrace[0] = \Closure::fromCallable([$setTrace[0], 'setValue']); - $setTrace[1] = \Closure::fromCallable([$setTrace[1], 'setValue']); + $setTrace[0] = $setTrace[0]->setValue(...); + $setTrace[1] = $setTrace[1]->setValue(...); } $setTrace[$proto instanceof \Exception]($proto, []); diff --git a/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php b/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php index 3ded211f1c9df..9b036d5ec232d 100644 --- a/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php +++ b/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php @@ -192,11 +192,9 @@ public function provideExport() $value = new \Error(); $rt = new \ReflectionProperty(\Error::class, 'trace'); - $rt->setAccessible(true); $rt->setValue($value, ['file' => __FILE__, 'line' => 123]); $rl = new \ReflectionProperty(\Error::class, 'line'); - $rl->setAccessible(true); $rl->setValue($value, 234); yield ['error', $value]; @@ -224,9 +222,7 @@ public function provideExport() yield ['php74-serializable', new Php74Serializable()]; - if (\PHP_VERSION_ID >= 80100) { - yield ['unit-enum', [FooUnitEnum::Bar], true]; - } + yield ['unit-enum', [FooUnitEnum::Bar], true]; } public function testUnicodeDirectionality() diff --git a/src/Symfony/Component/VarExporter/composer.json b/src/Symfony/Component/VarExporter/composer.json index 3bf21a64e3b04..3aac3aff326e7 100644 --- a/src/Symfony/Component/VarExporter/composer.json +++ b/src/Symfony/Component/VarExporter/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "require-dev": { "symfony/var-dumper": "^5.4|^6.0" diff --git a/src/Symfony/Component/WebLink/composer.json b/src/Symfony/Component/WebLink/composer.json index beffefec230d1..34a2a35559718 100644 --- a/src/Symfony/Component/WebLink/composer.json +++ b/src/Symfony/Component/WebLink/composer.json @@ -19,7 +19,7 @@ "psr/link-implementation": "1.0|2.0" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/link": "^1.1|^2.0" }, "suggest": { diff --git a/src/Symfony/Component/Workflow/composer.json b/src/Symfony/Component/Workflow/composer.json index 63bb40eba481d..eaa9b4607b3f4 100644 --- a/src/Symfony/Component/Workflow/composer.json +++ b/src/Symfony/Component/Workflow/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "require-dev": { "psr/log": "^1|^2|^3", diff --git a/src/Symfony/Component/Yaml/Command/LintCommand.php b/src/Symfony/Component/Yaml/Command/LintCommand.php index a7d831a286eb3..66eb25021a8ae 100644 --- a/src/Symfony/Component/Yaml/Command/LintCommand.php +++ b/src/Symfony/Component/Yaml/Command/LintCommand.php @@ -46,8 +46,8 @@ public function __construct(string $name = null, callable $directoryIteratorProv { parent::__construct($name); - $this->directoryIteratorProvider = null === $directoryIteratorProvider || $directoryIteratorProvider instanceof \Closure ? $directoryIteratorProvider : \Closure::fromCallable($directoryIteratorProvider); - $this->isReadableProvider = null === $isReadableProvider || $isReadableProvider instanceof \Closure ? $isReadableProvider : \Closure::fromCallable($isReadableProvider); + $this->directoryIteratorProvider = null === $directoryIteratorProvider ? null : $directoryIteratorProvider(...); + $this->isReadableProvider = null === $isReadableProvider ? null : $isReadableProvider(...); } /** diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php index a312965448977..1749e2d49a307 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -584,9 +584,6 @@ public function testDumpDateTime($dateTime, $expected) $this->assertSame($expected, Inline::dump($dateTime)); } - /** - * @requires PHP 8.1 - */ public function testDumpUnitEnum() { $this->assertSame("!php/const Symfony\Component\Yaml\Tests\Fixtures\FooUnitEnum::BAR", Inline::dump(FooUnitEnum::BAR)); diff --git a/src/Symfony/Component/Yaml/composer.json b/src/Symfony/Component/Yaml/composer.json index 356b9ac79aaab..839314bf51395 100644 --- a/src/Symfony/Component/Yaml/composer.json +++ b/src/Symfony/Component/Yaml/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-ctype": "^1.8" }, "require-dev": { diff --git a/src/Symfony/Contracts/Cache/composer.json b/src/Symfony/Contracts/Cache/composer.json index 55769fe504bcc..2582e5af834df 100644 --- a/src/Symfony/Contracts/Cache/composer.json +++ b/src/Symfony/Contracts/Cache/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/cache": "^3.0" }, "suggest": { diff --git a/src/Symfony/Contracts/Deprecation/composer.json b/src/Symfony/Contracts/Deprecation/composer.json index e85ed6fc5850e..f5de4eb401a2a 100644 --- a/src/Symfony/Contracts/Deprecation/composer.json +++ b/src/Symfony/Contracts/Deprecation/composer.json @@ -15,7 +15,7 @@ } ], "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "autoload": { "files": [ diff --git a/src/Symfony/Contracts/EventDispatcher/composer.json b/src/Symfony/Contracts/EventDispatcher/composer.json index 436bb5ac2be75..03ce8e45b98ba 100644 --- a/src/Symfony/Contracts/EventDispatcher/composer.json +++ b/src/Symfony/Contracts/EventDispatcher/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/event-dispatcher": "^1" }, "suggest": { diff --git a/src/Symfony/Contracts/HttpClient/composer.json b/src/Symfony/Contracts/HttpClient/composer.json index 5cea33690316d..4e877e5264f73 100644 --- a/src/Symfony/Contracts/HttpClient/composer.json +++ b/src/Symfony/Contracts/HttpClient/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "suggest": { "symfony/http-client-implementation": "" diff --git a/src/Symfony/Contracts/Service/composer.json b/src/Symfony/Contracts/Service/composer.json index fd940fd99feeb..a4ff0861d5473 100644 --- a/src/Symfony/Contracts/Service/composer.json +++ b/src/Symfony/Contracts/Service/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/container": "^2.0" }, "conflict": { diff --git a/src/Symfony/Contracts/Translation/composer.json b/src/Symfony/Contracts/Translation/composer.json index 579dcd79454ba..d078be8cf7f5b 100644 --- a/src/Symfony/Contracts/Translation/composer.json +++ b/src/Symfony/Contracts/Translation/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "suggest": { "symfony/translation-implementation": "" diff --git a/src/Symfony/Contracts/composer.json b/src/Symfony/Contracts/composer.json index ac7fe739c12e1..cba12a3cc6fa9 100644 --- a/src/Symfony/Contracts/composer.json +++ b/src/Symfony/Contracts/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/cache": "^3.0", "psr/container": "^2.0", "psr/event-dispatcher": "^1.0"