Problem/Motivation
In July 2018, PHP-FIG accepted PSR-17, providing a standard interface to http message factories. The interface for this standard requires PHP 7.0, and most implementations require PHP 7.1. The symfony/psr-http-message-bridge provides a wrapper interface around the message factory, and can be used with our current DiactorosFactory or with PSR-17 compliant factories. Beginning with psr-http-message-bridge v1.2, the non-PSR-17 Diactoros factory is deprecated, in favor of the PsrHttpFactory, which uses PSR-17 factories under the hood.
Proposed resolution
zend-framework/zend-diactoros provides a set of PSR-17 standard factories beginning with version 2.0, which can be plugged into the symfony PsrHttpFactory wrapper, however version 2.0 requires PHP 7.1. We should consider switching when we also support a PHP minimum version of 7.1. Because the symfony wrappers have the same interface, there are no BC concerns, and we could do this in Drupal 8.9 if we choose to support a minimum PHP version of 7.1 in Drupal 8.9. Alternatively this could be targeted for Drupal 9.0
A test of this swapout was done in #3039584: The "Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory" class is deprecated since symfony/psr-http-message-bridge 1.2, use PsrHttpFactory instead. and it was found that a direct swap resulted in passed tests with minimal code adjustments
Remaining tasks
Update the vender versions,
Add services for the individual factories
Replace the current factory service with the new service, and pass in the individual factory service
Remove deprecation suppression messages regarding DiactorosFactory being deprecated in symfony/psr-http-message-bridge v1.2
User interface changes
none
API changes
Our message factory would use PSR-17 factories under the hood to build our PSR-7 messages
Data model changes
none
Release notes snippet
Drupal now uses PSR-17 compliant message factories to create PSR-7 Requests and Responses.