Problem/Motivation
\Drupal\Core\StreamWrapper\StreamWrapperManager
is a service that loads and manages stream wrapper schemes like 'public://' and 'temporary://', along with any custom stream wrappers that the user might define. It implements StreamWrapperManagerInterface.
Two routines should return strings, but instead return TranslatableMarkup objects, violating the interfaces:
/**
* Returns registered stream wrapper names.
*
* @param int $filter
* (Optional) Filters out all types except those with an on bit for each on
* bit in $filter. For example, if $filter is
* StreamWrapperInterface::WRITE_VISIBLE, which is equal to
* (StreamWrapperInterface::READ | StreamWrapperInterface::WRITE |
* StreamWrapperInterface::VISIBLE), then only stream wrappers with all
* three of these bits set are returned. Defaults to
* StreamWrapperInterface::ALL, which returns all registered stream
* wrappers.
*
* @return array
* Stream wrapper names, keyed by scheme.
*/
public function getNames($filter = StreamWrapperInterface::ALL);
/**
* Returns registered stream wrapper descriptions.
*
* @param int $filter
* (Optional) Filters out all types except those with an on bit for each on
* bit in $filter. For example, if $filter is
* StreamWrapperInterface::WRITE_VISIBLE, which is equal to
* (StreamWrapperInterface::READ | StreamWrapperInterface::WRITE |
* StreamWrapperInterface::VISIBLE), then only stream wrappers with all
* three of these bits set are returned. Defaults to
* StreamWrapperInterface::ALL, which returns all registered stream
* wrappers.
*
* @return array
* Stream wrapper descriptions, keyed by scheme.
*/
public function getDescriptions($filter = StreamWrapperInterface::ALL);
Don't do that.
Proposed resolution
Since TranslatableMarkup casts to string, simply cast them to string.
Remaining tasks
I've made the change and added a test to make sure the routines return array of string, so this needs review.
User interface changes
None.
API changes
None.
Data model changes
None.