In PHP 8, but not in PHP 7.4, every class with a __toString() function implicitly implements the Stringable interface. Therefore, the behavior of checks like "instanceof Stringable" differs between these PHP versions when such classes are involved. Make every such class implement the interface so that the behavior will be consistent. The PHP 7.4 fallback for the Stringable interface is provided by symfony/polyfill-php80. Change-Id: I3f0330c2555c7d3bf99b654ed3c0b0303e257ea1
26 lines
414 B
PHP
26 lines
414 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Settings\Source;
|
|
|
|
use Stringable;
|
|
|
|
/**
|
|
* Settings loaded from an array.
|
|
*
|
|
* @since 1.38
|
|
*/
|
|
class ArraySource implements Stringable, SettingsSource {
|
|
private $settings;
|
|
|
|
public function __construct( array $settings ) {
|
|
$this->settings = $settings;
|
|
}
|
|
|
|
public function load(): array {
|
|
return $this->settings;
|
|
}
|
|
|
|
public function __toString(): string {
|
|
return '<array>';
|
|
}
|
|
}
|