diff --git a/classes/admin_settings_aws_region.php b/classes/admin_settings_aws_region.php index 2bb474418..5e0442efc 100644 --- a/classes/admin_settings_aws_region.php +++ b/classes/admin_settings_aws_region.php @@ -37,7 +37,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class admin_settings_aws_region extends \admin_setting_configtext { - /** * Return part of form with setting. * @@ -45,7 +44,7 @@ class admin_settings_aws_region extends \admin_setting_configtext { * @param string $query * @return string */ - public function output_html($data, $query='') { + public function output_html($data, $query = '') { global $CFG; $default = $this->get_defaultsetting(); @@ -63,7 +62,7 @@ public function output_html($data, $query='') { } } - $inputparams = array( + $inputparams = [ 'type' => 'text', 'list' => $this->get_full_name(), 'name' => $this->get_full_name(), @@ -71,13 +70,13 @@ public function output_html($data, $query='') { 'size' => $this->size, 'id' => $this->get_id(), 'class' => 'form-control text-ltr', - ); + ]; - $element = \html_writer::start_tag('div', array('class' => 'form-text defaultsnext')); + $element = \html_writer::start_tag('div', ['class' => 'form-text defaultsnext']); $element .= \html_writer::empty_tag('input', $inputparams); - $element .= \html_writer::start_tag('datalist', array('id' => $this->get_full_name())); + $element .= \html_writer::start_tag('datalist', ['id' => $this->get_full_name()]); foreach ($options as $option) { - $element .= \html_writer::tag('option', $option['label'], array('value' => $option['value'])); + $element .= \html_writer::tag('option', $option['label'], ['value' => $option['value']]); } $element .= \html_writer::end_tag('datalist'); $element .= \html_writer::end_tag('div'); diff --git a/classes/local/aws_helper.php b/classes/local/aws_helper.php index 5c52a8db8..1583822fc 100644 --- a/classes/local/aws_helper.php +++ b/classes/local/aws_helper.php @@ -36,7 +36,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class aws_helper { - /** * This creates a proxy string suitable for use with the AWS SDK. * @@ -57,7 +56,7 @@ public static function get_proxy_string() { if (!empty($CFG->proxyhost)) { $proxy = $CFG->proxyhost; if (!empty($CFG->proxyport)) { - $proxy .= ':'. $CFG->proxyport; + $proxy .= ':' . $CFG->proxyport; } if (!empty($CFG->proxyuser) && !empty($CFG->proxypassword)) { $proxy = $protocol . $CFG->proxyuser . ':' . $CFG->proxypassword . '@' . $proxy; diff --git a/classes/local/client_factory.php b/classes/local/client_factory.php index 32ed64a06..17653654a 100644 --- a/classes/local/client_factory.php +++ b/classes/local/client_factory.php @@ -24,7 +24,7 @@ */ namespace local_aws\local; -use \Aws\AwsClient; +use Aws\AwsClient; /** * AWS Client factory. Retrieves a client with moodle specific HTTP configuration. diff --git a/classes/local/guzzle_helper.php b/classes/local/guzzle_helper.php index 8a593850a..a361f9cde 100644 --- a/classes/local/guzzle_helper.php +++ b/classes/local/guzzle_helper.php @@ -28,7 +28,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class guzzle_helper { - /** * Add additional configuration to the Guzzle client. For example, adding additional Middleware. * diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index bc8b5ee35..687bd0873 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -13,6 +13,7 @@ // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . + /** * Privacy provider. * @@ -24,7 +25,7 @@ namespace local_aws\privacy; use core_privacy\local\metadata\null_provider; -use core_privacy\local\legacy_polyfill; + /** * Class provider * @author Ilya Tregubov (ilyatregubov@catalyst-au.net) @@ -32,14 +33,13 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class provider implements null_provider { - use legacy_polyfill; /** * Get the language string identifier with the component's language * file to explain why this plugin stores no data. * * @return string */ - public static function _get_reason() { + public static function get_reason(): string { return 'privacy:metadata'; } } diff --git a/sdk/Aws/Api/Parser/QueryParser.php b/sdk/Aws/Api/Parser/QueryParser.php index 50e4e3a59..b2789d011 100644 --- a/sdk/Aws/Api/Parser/QueryParser.php +++ b/sdk/Aws/Api/Parser/QueryParser.php @@ -19,19 +19,19 @@ class QueryParser extends AbstractParser private $honorResultWrapper; /** - * @param Service $api Service description - * @param XmlParser $xmlParser Optional XML parser - * @param bool $honorResultWrapper Set to false to disable the peeling - * back of result wrappers from the - * output structure. + * @param Service $api Service description + * @param \Aws\Api\Parser\XmlParser $xmlParser Optional XML parser + * @param bool $honorResultWrapper Set to false to disable the peeling + * back of result wrappers from the + * output structure. */ public function __construct( Service $api, - XmlParser $xmlParser = null, + \Aws\Api\Parser\XmlParser $xmlParser = null, $honorResultWrapper = true ) { parent::__construct($api); - $this->parser = $xmlParser ?: new XmlParser(); + $this->parser = $xmlParser ?: new \Aws\Api\Parser\XmlParser(); $this->honorResultWrapper = $honorResultWrapper; } diff --git a/sdk/Aws/Api/Parser/RestXmlParser.php b/sdk/Aws/Api/Parser/RestXmlParser.php index d04429f67..56479132f 100644 --- a/sdk/Aws/Api/Parser/RestXmlParser.php +++ b/sdk/Aws/Api/Parser/RestXmlParser.php @@ -14,13 +14,13 @@ class RestXmlParser extends AbstractRestParser use PayloadParserTrait; /** - * @param Service $api Service description - * @param XmlParser $parser XML body parser + * @param Service $api Service description + * @param \Aws\Api\Parser\XmlParser $parser XML body parser */ - public function __construct(Service $api, XmlParser $parser = null) + public function __construct(Service $api, \Aws\Api\Parser\XmlParser $parser = null) { parent::__construct($api); - $this->parser = $parser ?: new XmlParser(); + $this->parser = $parser ?: new \Aws\Api\Parser\XmlParser(); } protected function payload( diff --git a/sdk/Aws/Crypto/AesDecryptingStream.php b/sdk/Aws/Crypto/AesDecryptingStream.php index c1524cc18..feafc469f 100644 --- a/sdk/Aws/Crypto/AesDecryptingStream.php +++ b/sdk/Aws/Crypto/AesDecryptingStream.php @@ -65,7 +65,7 @@ public function getCurrentIv() return $this->cipherMethod->getCurrentIv(); } - public function getSize() + public function getSize(): ?int { $plainTextSize = $this->stream->getSize(); @@ -80,12 +80,12 @@ public function getSize() return $plainTextSize; } - public function isWritable() + public function isWritable(): bool { return false; } - public function read($length) + public function read($length): string { if ($length > strlen($this->buffer)) { $this->buffer .= $this->decryptBlock( @@ -101,7 +101,7 @@ public function read($length) return $data ? $data : ''; } - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { if ($offset === 0 && $whence === SEEK_SET) { $this->buffer = ''; diff --git a/sdk/Aws/Crypto/AesEncryptingStream.php b/sdk/Aws/Crypto/AesEncryptingStream.php index 3b7c44675..2cb5ab696 100644 --- a/sdk/Aws/Crypto/AesEncryptingStream.php +++ b/sdk/Aws/Crypto/AesEncryptingStream.php @@ -65,7 +65,7 @@ public function getCurrentIv() return $this->cipherMethod->getCurrentIv(); } - public function getSize() + public function getSize(): ?int { $plainTextSize = $this->stream->getSize(); @@ -79,12 +79,12 @@ public function getSize() return $plainTextSize; } - public function isWritable() + public function isWritable(): bool { return false; } - public function read($length) + public function read($length): string { if ($length > strlen($this->buffer)) { $this->buffer .= $this->encryptBlock( @@ -99,7 +99,7 @@ public function read($length) return $data ? $data : ''; } - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { if ($whence === SEEK_CUR) { $offset = $this->tell() + $offset; diff --git a/sdk/Aws/Crypto/AesGcmDecryptingStream.php b/sdk/Aws/Crypto/AesGcmDecryptingStream.php index 76feaa158..6ca750008 100644 --- a/sdk/Aws/Crypto/AesGcmDecryptingStream.php +++ b/sdk/Aws/Crypto/AesGcmDecryptingStream.php @@ -100,7 +100,7 @@ public function createStream() } } - public function isWritable() + public function isWritable(): bool { return false; } diff --git a/sdk/Aws/Crypto/AesGcmEncryptingStream.php b/sdk/Aws/Crypto/AesGcmEncryptingStream.php index 13357f52f..0d706e421 100644 --- a/sdk/Aws/Crypto/AesGcmEncryptingStream.php +++ b/sdk/Aws/Crypto/AesGcmEncryptingStream.php @@ -118,7 +118,7 @@ public function getTag() return $this->tag; } - public function isWritable() + public function isWritable(): bool { return false; } diff --git a/sdk/Aws/Handler/GuzzleV5/PsrStream.php b/sdk/Aws/Handler/GuzzleV5/PsrStream.php index cc07613bb..ae4b49521 100644 --- a/sdk/Aws/Handler/GuzzleV5/PsrStream.php +++ b/sdk/Aws/Handler/GuzzleV5/PsrStream.php @@ -22,12 +22,12 @@ public function __construct(GuzzleStreamInterface $stream) $this->stream = $stream; } - public function rewind() + public function rewind(): void { $this->stream->seek(0); } - public function getContents() + public function getContents(): string { return $this->stream->getContents(); } diff --git a/sdk/Aws/HashingStream.php b/sdk/Aws/HashingStream.php index 9b11e137b..31993003f 100644 --- a/sdk/Aws/HashingStream.php +++ b/sdk/Aws/HashingStream.php @@ -36,7 +36,7 @@ public function __construct( $this->callback = $onComplete; } - public function read($length) + public function read($length): string { $data = $this->stream->read($length); $this->hash->update($data); @@ -50,14 +50,15 @@ public function read($length) return $data; } - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { if ($offset === 0) { $this->hash->reset(); - return $this->stream->seek($offset); + $this->stream->seek($offset); + return; } // Seeking arbitrarily is not supported. - return false; + throw new \LogicException('Cannot seek to arbitrary positions on a HashingStream'); } } diff --git a/sdk/GuzzleHttp/Psr7/AppendStream.php b/sdk/GuzzleHttp/Psr7/AppendStream.php index fa9153d78..3924e471c 100644 --- a/sdk/GuzzleHttp/Psr7/AppendStream.php +++ b/sdk/GuzzleHttp/Psr7/AppendStream.php @@ -31,7 +31,7 @@ public function __construct(array $streams = []) } } - public function __toString() + public function __toString(): string { try { $this->rewind(); @@ -62,7 +62,7 @@ public function addStream(StreamInterface $stream) $this->streams[] = $stream; } - public function getContents() + public function getContents(): string { return Utils::copyToString($this); } @@ -72,7 +72,7 @@ public function getContents() * * {@inheritdoc} */ - public function close() + public function close(): void { $this->pos = $this->current = 0; $this->seekable = true; @@ -105,7 +105,7 @@ public function detach() return null; } - public function tell() + public function tell(): int { return $this->pos; } @@ -118,7 +118,7 @@ public function tell() * * {@inheritdoc} */ - public function getSize() + public function getSize(): ?int { $size = 0; @@ -133,14 +133,14 @@ public function getSize() return $size; } - public function eof() + public function eof(): bool { return !$this->streams || ($this->current >= count($this->streams) - 1 && $this->streams[$this->current]->eof()); } - public function rewind() + public function rewind(): void { $this->seek(0); } @@ -150,7 +150,7 @@ public function rewind() * * {@inheritdoc} */ - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { if (!$this->seekable) { throw new \RuntimeException('This AppendStream is not seekable'); @@ -184,7 +184,7 @@ public function seek($offset, $whence = SEEK_SET) * * {@inheritdoc} */ - public function read($length) + public function read($length): string { $buffer = ''; $total = count($this->streams) - 1; @@ -219,22 +219,22 @@ public function read($length) return $buffer; } - public function isReadable() + public function isReadable(): bool { return true; } - public function isWritable() + public function isWritable(): bool { return false; } - public function isSeekable() + public function isSeekable(): bool { return $this->seekable; } - public function write($string) + public function write($string): int { throw new \RuntimeException('Cannot write to an AppendStream'); } diff --git a/sdk/GuzzleHttp/Psr7/BufferStream.php b/sdk/GuzzleHttp/Psr7/BufferStream.php index 783859c19..577afc0ae 100644 --- a/sdk/GuzzleHttp/Psr7/BufferStream.php +++ b/sdk/GuzzleHttp/Psr7/BufferStream.php @@ -31,12 +31,12 @@ public function __construct($hwm = 16384) $this->hwm = $hwm; } - public function __toString() + public function __toString(): string { return $this->getContents(); } - public function getContents() + public function getContents(): string { $buffer = $this->buffer; $this->buffer = ''; @@ -44,7 +44,7 @@ public function getContents() return $buffer; } - public function close() + public function close(): void { $this->buffer = ''; } @@ -56,42 +56,42 @@ public function detach() return null; } - public function getSize() + public function getSize(): ?int { return strlen($this->buffer); } - public function isReadable() + public function isReadable(): bool { return true; } - public function isWritable() + public function isWritable(): bool { return true; } - public function isSeekable() + public function isSeekable(): bool { return false; } - public function rewind() + public function rewind(): void { $this->seek(0); } - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { throw new \RuntimeException('Cannot seek a BufferStream'); } - public function eof() + public function eof(): bool { return strlen($this->buffer) === 0; } - public function tell() + public function tell(): int { throw new \RuntimeException('Cannot determine the position of a BufferStream'); } @@ -99,7 +99,7 @@ public function tell() /** * Reads data from the buffer. */ - public function read($length) + public function read($length): string { $currentLength = strlen($this->buffer); @@ -119,7 +119,7 @@ public function read($length) /** * Writes data to the buffer. */ - public function write($string) + public function write($string): int { $this->buffer .= $string; diff --git a/sdk/GuzzleHttp/Psr7/CachingStream.php b/sdk/GuzzleHttp/Psr7/CachingStream.php index febade9f4..762b13619 100644 --- a/sdk/GuzzleHttp/Psr7/CachingStream.php +++ b/sdk/GuzzleHttp/Psr7/CachingStream.php @@ -34,7 +34,7 @@ public function __construct( $this->stream = $target ?: new Stream(Utils::tryFopen('php://temp', 'r+')); } - public function getSize() + public function getSize(): ?int { $remoteSize = $this->remoteStream->getSize(); @@ -45,12 +45,12 @@ public function getSize() return max($this->stream->getSize(), $remoteSize); } - public function rewind() + public function rewind(): void { $this->seek(0); } - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { if ($whence == SEEK_SET) { $byte = $offset; @@ -81,7 +81,7 @@ public function seek($offset, $whence = SEEK_SET) } } - public function read($length) + public function read($length): string { // Perform a regular read on any previously read data from the buffer $data = $this->stream->read($length); @@ -110,7 +110,7 @@ public function read($length) return $data; } - public function write($string) + public function write($string): int { // When appending to the end of the currently read stream, you'll want // to skip bytes from being read from the remote stream to emulate @@ -124,7 +124,7 @@ public function write($string) return $this->stream->write($string); } - public function eof() + public function eof(): bool { return $this->stream->eof() && $this->remoteStream->eof(); } @@ -132,7 +132,7 @@ public function eof() /** * Close both the remote stream and buffer stream */ - public function close() + public function close(): void { $this->remoteStream->close() && $this->stream->close(); } diff --git a/sdk/GuzzleHttp/Psr7/DroppingStream.php b/sdk/GuzzleHttp/Psr7/DroppingStream.php index 9f7420c40..511aafc99 100644 --- a/sdk/GuzzleHttp/Psr7/DroppingStream.php +++ b/sdk/GuzzleHttp/Psr7/DroppingStream.php @@ -26,7 +26,7 @@ public function __construct(StreamInterface $stream, $maxLength) $this->maxLength = $maxLength; } - public function write($string) + public function write($string): int { $diff = $this->maxLength - $this->stream->getSize(); diff --git a/sdk/GuzzleHttp/Psr7/FnStream.php b/sdk/GuzzleHttp/Psr7/FnStream.php index 76a8cc7ba..833112ddc 100644 --- a/sdk/GuzzleHttp/Psr7/FnStream.php +++ b/sdk/GuzzleHttp/Psr7/FnStream.php @@ -86,14 +86,14 @@ public static function decorate(StreamInterface $stream, array $methods) return new self($methods); } - public function __toString() + public function __toString(): string { return call_user_func($this->_fn___toString); } - public function close() + public function close(): void { - return call_user_func($this->_fn_close); + call_user_func($this->_fn_close); } public function detach() @@ -101,57 +101,57 @@ public function detach() return call_user_func($this->_fn_detach); } - public function getSize() + public function getSize(): ?int { return call_user_func($this->_fn_getSize); } - public function tell() + public function tell(): int { return call_user_func($this->_fn_tell); } - public function eof() + public function eof(): bool { return call_user_func($this->_fn_eof); } - public function isSeekable() + public function isSeekable(): bool { return call_user_func($this->_fn_isSeekable); } - public function rewind() + public function rewind(): void { call_user_func($this->_fn_rewind); } - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { call_user_func($this->_fn_seek, $offset, $whence); } - public function isWritable() + public function isWritable(): bool { return call_user_func($this->_fn_isWritable); } - public function write($string) + public function write($string): int { return call_user_func($this->_fn_write, $string); } - public function isReadable() + public function isReadable(): bool { return call_user_func($this->_fn_isReadable); } - public function read($length) + public function read($length): string { return call_user_func($this->_fn_read, $length); } - public function getContents() + public function getContents(): string { return call_user_func($this->_fn_getContents); } diff --git a/sdk/GuzzleHttp/Psr7/LimitStream.php b/sdk/GuzzleHttp/Psr7/LimitStream.php index 1173ec40d..52acf5998 100644 --- a/sdk/GuzzleHttp/Psr7/LimitStream.php +++ b/sdk/GuzzleHttp/Psr7/LimitStream.php @@ -36,7 +36,7 @@ public function __construct( $this->setOffset($offset); } - public function eof() + public function eof(): bool { // Always return true if the underlying stream is EOF if ($this->stream->eof()) { @@ -55,7 +55,7 @@ public function eof() * Returns the size of the limited subset of data * {@inheritdoc} */ - public function getSize() + public function getSize(): ?int { if (null === ($length = $this->stream->getSize())) { return null; @@ -70,7 +70,7 @@ public function getSize() * Allow for a bounded seek on the read limited stream * {@inheritdoc} */ - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { if ($whence !== SEEK_SET || $offset < 0) { throw new \RuntimeException(sprintf( @@ -95,7 +95,7 @@ public function seek($offset, $whence = SEEK_SET) * Give a relative tell() * {@inheritdoc} */ - public function tell() + public function tell(): int { return $this->stream->tell() - $this->offset; } @@ -137,7 +137,7 @@ public function setLimit($limit) $this->limit = $limit; } - public function read($length) + public function read($length): string { if ($this->limit == -1) { return $this->stream->read($length); diff --git a/sdk/GuzzleHttp/Psr7/MessageTrait.php b/sdk/GuzzleHttp/Psr7/MessageTrait.php index 0bbd63e0d..5c6b713d1 100644 --- a/sdk/GuzzleHttp/Psr7/MessageTrait.php +++ b/sdk/GuzzleHttp/Psr7/MessageTrait.php @@ -21,12 +21,12 @@ trait MessageTrait /** @var StreamInterface|null */ private $stream; - public function getProtocolVersion() + public function getProtocolVersion(): string { return $this->protocol; } - public function withProtocolVersion($version) + public function withProtocolVersion($version): \Psr\Http\Message\MessageInterface { if ($this->protocol === $version) { return $this; @@ -37,17 +37,17 @@ public function withProtocolVersion($version) return $new; } - public function getHeaders() + public function getHeaders(): array { return $this->headers; } - public function hasHeader($header) + public function hasHeader($header): bool { return isset($this->headerNames[strtolower($header)]); } - public function getHeader($header) + public function getHeader($header): array { $header = strtolower($header); @@ -60,12 +60,12 @@ public function getHeader($header) return $this->headers[$header]; } - public function getHeaderLine($header) + public function getHeaderLine($header): string { return implode(', ', $this->getHeader($header)); } - public function withHeader($header, $value) + public function withHeader($header, $value): \Psr\Http\Message\MessageInterface { $this->assertHeader($header); $value = $this->normalizeHeaderValue($value); @@ -81,7 +81,7 @@ public function withHeader($header, $value) return $new; } - public function withAddedHeader($header, $value) + public function withAddedHeader($header, $value): \Psr\Http\Message\MessageInterface { $this->assertHeader($header); $value = $this->normalizeHeaderValue($value); @@ -99,7 +99,7 @@ public function withAddedHeader($header, $value) return $new; } - public function withoutHeader($header) + public function withoutHeader($header): \Psr\Http\Message\MessageInterface { $normalized = strtolower($header); @@ -115,7 +115,7 @@ public function withoutHeader($header) return $new; } - public function getBody() + public function getBody(): \Psr\Http\Message\StreamInterface { if (!$this->stream) { $this->stream = Utils::streamFor(''); @@ -124,7 +124,7 @@ public function getBody() return $this->stream; } - public function withBody(StreamInterface $body) + public function withBody(StreamInterface $body): \Psr\Http\Message\MessageInterface { if ($body === $this->stream) { return $this; diff --git a/sdk/GuzzleHttp/Psr7/MultipartStream.php b/sdk/GuzzleHttp/Psr7/MultipartStream.php index 5a6079a89..a401ec8a5 100644 --- a/sdk/GuzzleHttp/Psr7/MultipartStream.php +++ b/sdk/GuzzleHttp/Psr7/MultipartStream.php @@ -44,7 +44,7 @@ public function getBoundary() return $this->boundary; } - public function isWritable() + public function isWritable(): bool { return false; } diff --git a/sdk/GuzzleHttp/Psr7/NoSeekStream.php b/sdk/GuzzleHttp/Psr7/NoSeekStream.php index d66bdde46..6e710fa72 100644 --- a/sdk/GuzzleHttp/Psr7/NoSeekStream.php +++ b/sdk/GuzzleHttp/Psr7/NoSeekStream.php @@ -13,12 +13,12 @@ class NoSeekStream implements StreamInterface { use StreamDecoratorTrait; - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { throw new \RuntimeException('Cannot seek a NoSeekStream'); } - public function isSeekable() + public function isSeekable(): bool { return false; } diff --git a/sdk/GuzzleHttp/Psr7/PumpStream.php b/sdk/GuzzleHttp/Psr7/PumpStream.php index 44c7b582c..e1b904e31 100644 --- a/sdk/GuzzleHttp/Psr7/PumpStream.php +++ b/sdk/GuzzleHttp/Psr7/PumpStream.php @@ -51,7 +51,7 @@ public function __construct(callable $source, array $options = []) $this->buffer = new BufferStream(); } - public function __toString() + public function __toString(): string { try { return Utils::copyToString($this); @@ -60,7 +60,7 @@ public function __toString() } } - public function close() + public function close(): void { $this->detach(); } @@ -73,52 +73,52 @@ public function detach() return null; } - public function getSize() + public function getSize(): ?int { return $this->size; } - public function tell() + public function tell(): int { return $this->tellPos; } - public function eof() + public function eof(): bool { return !$this->source; } - public function isSeekable() + public function isSeekable(): bool { return false; } - public function rewind() + public function rewind(): void { $this->seek(0); } - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { throw new \RuntimeException('Cannot seek a PumpStream'); } - public function isWritable() + public function isWritable(): bool { return false; } - public function write($string) + public function write($string): int { throw new \RuntimeException('Cannot write to a PumpStream'); } - public function isReadable() + public function isReadable(): bool { return true; } - public function read($length) + public function read($length): string { $data = $this->buffer->read($length); $readLen = strlen($data); @@ -134,7 +134,7 @@ public function read($length) return $data; } - public function getContents() + public function getContents(): string { $result = ''; while (!$this->eof()) { diff --git a/sdk/GuzzleHttp/Psr7/Request.php b/sdk/GuzzleHttp/Psr7/Request.php index c1cdaebff..7558f1e3e 100644 --- a/sdk/GuzzleHttp/Psr7/Request.php +++ b/sdk/GuzzleHttp/Psr7/Request.php @@ -56,7 +56,7 @@ public function __construct( } } - public function getRequestTarget() + public function getRequestTarget(): string { if ($this->requestTarget !== null) { return $this->requestTarget; @@ -73,7 +73,7 @@ public function getRequestTarget() return $target; } - public function withRequestTarget($requestTarget) + public function withRequestTarget($requestTarget): \Psr\Http\Message\RequestInterface { if (preg_match('#\s#', $requestTarget)) { throw new InvalidArgumentException( @@ -86,12 +86,12 @@ public function withRequestTarget($requestTarget) return $new; } - public function getMethod() + public function getMethod(): string { return $this->method; } - public function withMethod($method) + public function withMethod($method): \Psr\Http\Message\RequestInterface { $this->assertMethod($method); $new = clone $this; @@ -99,12 +99,12 @@ public function withMethod($method) return $new; } - public function getUri() + public function getUri(): \Psr\Http\Message\UriInterface { return $this->uri; } - public function withUri(UriInterface $uri, $preserveHost = false) + public function withUri(UriInterface $uri, $preserveHost = false): \Psr\Http\Message\RequestInterface { if ($uri === $this->uri) { return $this; diff --git a/sdk/GuzzleHttp/Psr7/Response.php b/sdk/GuzzleHttp/Psr7/Response.php index 8c01a0f5a..d9fdc0bad 100644 --- a/sdk/GuzzleHttp/Psr7/Response.php +++ b/sdk/GuzzleHttp/Psr7/Response.php @@ -114,17 +114,17 @@ public function __construct( $this->protocol = $version; } - public function getStatusCode() + public function getStatusCode(): int { return $this->statusCode; } - public function getReasonPhrase() + public function getReasonPhrase(): string { return $this->reasonPhrase; } - public function withStatus($code, $reasonPhrase = '') + public function withStatus($code, $reasonPhrase = ''): \Psr\Http\Message\ResponseInterface { $this->assertStatusCodeIsInteger($code); $code = (int) $code; diff --git a/sdk/GuzzleHttp/Psr7/ServerRequest.php b/sdk/GuzzleHttp/Psr7/ServerRequest.php index e6d26f5ff..9ef4bdf38 100644 --- a/sdk/GuzzleHttp/Psr7/ServerRequest.php +++ b/sdk/GuzzleHttp/Psr7/ServerRequest.php @@ -250,7 +250,7 @@ public static function getUriFromGlobals() /** * {@inheritdoc} */ - public function getServerParams() + public function getServerParams(): array { return $this->serverParams; } @@ -258,7 +258,7 @@ public function getServerParams() /** * {@inheritdoc} */ - public function getUploadedFiles() + public function getUploadedFiles(): array { return $this->uploadedFiles; } @@ -266,7 +266,7 @@ public function getUploadedFiles() /** * {@inheritdoc} */ - public function withUploadedFiles(array $uploadedFiles) + public function withUploadedFiles(array $uploadedFiles): \Psr\Http\Message\ServerRequestInterface { $new = clone $this; $new->uploadedFiles = $uploadedFiles; @@ -277,7 +277,7 @@ public function withUploadedFiles(array $uploadedFiles) /** * {@inheritdoc} */ - public function getCookieParams() + public function getCookieParams(): array { return $this->cookieParams; } @@ -285,7 +285,7 @@ public function getCookieParams() /** * {@inheritdoc} */ - public function withCookieParams(array $cookies) + public function withCookieParams(array $cookies): \Psr\Http\Message\ServerRequestInterface { $new = clone $this; $new->cookieParams = $cookies; @@ -296,7 +296,7 @@ public function withCookieParams(array $cookies) /** * {@inheritdoc} */ - public function getQueryParams() + public function getQueryParams(): array { return $this->queryParams; } @@ -304,7 +304,7 @@ public function getQueryParams() /** * {@inheritdoc} */ - public function withQueryParams(array $query) + public function withQueryParams(array $query): \Psr\Http\Message\ServerRequestInterface { $new = clone $this; $new->queryParams = $query; @@ -323,7 +323,7 @@ public function getParsedBody() /** * {@inheritdoc} */ - public function withParsedBody($data) + public function withParsedBody($data): \Psr\Http\Message\ServerRequestInterface { $new = clone $this; $new->parsedBody = $data; @@ -334,7 +334,7 @@ public function withParsedBody($data) /** * {@inheritdoc} */ - public function getAttributes() + public function getAttributes(): array { return $this->attributes; } @@ -354,7 +354,7 @@ public function getAttribute($attribute, $default = null) /** * {@inheritdoc} */ - public function withAttribute($attribute, $value) + public function withAttribute($attribute, $value): \Psr\Http\Message\ServerRequestInterface { $new = clone $this; $new->attributes[$attribute] = $value; @@ -365,7 +365,7 @@ public function withAttribute($attribute, $value) /** * {@inheritdoc} */ - public function withoutAttribute($attribute) + public function withoutAttribute($attribute): \Psr\Http\Message\ServerRequestInterface { if (false === array_key_exists($attribute, $this->attributes)) { return $this; diff --git a/sdk/GuzzleHttp/Psr7/Stream.php b/sdk/GuzzleHttp/Psr7/Stream.php index 3865d6d6a..581bbc69d 100644 --- a/sdk/GuzzleHttp/Psr7/Stream.php +++ b/sdk/GuzzleHttp/Psr7/Stream.php @@ -74,7 +74,7 @@ public function __destruct() $this->close(); } - public function __toString() + public function __toString(): string { try { if ($this->isSeekable()) { @@ -86,7 +86,7 @@ public function __toString() } } - public function getContents() + public function getContents(): string { if (!isset($this->stream)) { throw new \RuntimeException('Stream is detached'); @@ -101,7 +101,7 @@ public function getContents() return $contents; } - public function close() + public function close(): void { if (isset($this->stream)) { if (is_resource($this->stream)) { @@ -125,7 +125,7 @@ public function detach() return $result; } - public function getSize() + public function getSize(): ?int { if ($this->size !== null) { return $this->size; @@ -149,22 +149,22 @@ public function getSize() return null; } - public function isReadable() + public function isReadable(): bool { return $this->readable; } - public function isWritable() + public function isWritable(): bool { return $this->writable; } - public function isSeekable() + public function isSeekable(): bool { return $this->seekable; } - public function eof() + public function eof(): bool { if (!isset($this->stream)) { throw new \RuntimeException('Stream is detached'); @@ -173,7 +173,7 @@ public function eof() return feof($this->stream); } - public function tell() + public function tell(): int { if (!isset($this->stream)) { throw new \RuntimeException('Stream is detached'); @@ -188,12 +188,12 @@ public function tell() return $result; } - public function rewind() + public function rewind(): void { $this->seek(0); } - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { $whence = (int) $whence; @@ -209,7 +209,7 @@ public function seek($offset, $whence = SEEK_SET) } } - public function read($length) + public function read($length): string { if (!isset($this->stream)) { throw new \RuntimeException('Stream is detached'); @@ -233,7 +233,7 @@ public function read($length) return $string; } - public function write($string) + public function write($string): int { if (!isset($this->stream)) { throw new \RuntimeException('Stream is detached'); diff --git a/sdk/GuzzleHttp/Psr7/StreamDecoratorTrait.php b/sdk/GuzzleHttp/Psr7/StreamDecoratorTrait.php index 5025dd67b..16f94d84a 100644 --- a/sdk/GuzzleHttp/Psr7/StreamDecoratorTrait.php +++ b/sdk/GuzzleHttp/Psr7/StreamDecoratorTrait.php @@ -37,7 +37,7 @@ public function __get($name) throw new \UnexpectedValueException("$name not found on class"); } - public function __toString() + public function __toString(): string { try { if ($this->isSeekable()) { @@ -52,7 +52,7 @@ public function __toString() } } - public function getContents() + public function getContents(): string { return Utils::copyToString($this); } @@ -73,7 +73,7 @@ public function __call($method, array $args) return $result === $this->stream ? $this : $result; } - public function close() + public function close(): void { $this->stream->close(); } @@ -88,52 +88,52 @@ public function detach() return $this->stream->detach(); } - public function getSize() + public function getSize(): ?int { return $this->stream->getSize(); } - public function eof() + public function eof(): bool { return $this->stream->eof(); } - public function tell() + public function tell(): int { return $this->stream->tell(); } - public function isReadable() + public function isReadable(): bool { return $this->stream->isReadable(); } - public function isWritable() + public function isWritable(): bool { return $this->stream->isWritable(); } - public function isSeekable() + public function isSeekable(): bool { return $this->stream->isSeekable(); } - public function rewind() + public function rewind(): void { $this->seek(0); } - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { $this->stream->seek($offset, $whence); } - public function read($length) + public function read($length): string { return $this->stream->read($length); } - public function write($string) + public function write($string): int { return $this->stream->write($string); } diff --git a/sdk/GuzzleHttp/Psr7/UploadedFile.php b/sdk/GuzzleHttp/Psr7/UploadedFile.php index bf342c4de..b37dcd5a6 100644 --- a/sdk/GuzzleHttp/Psr7/UploadedFile.php +++ b/sdk/GuzzleHttp/Psr7/UploadedFile.php @@ -231,7 +231,7 @@ private function validateActive() * * @throws RuntimeException if the upload was not successful. */ - public function getStream() + public function getStream(): \Psr\Http\Message\StreamInterface { $this->validateActive(); @@ -255,7 +255,7 @@ public function getStream() * @throws RuntimeException on any error during the move operation, or on * the second or subsequent call to the method. */ - public function moveTo($targetPath) + public function moveTo($targetPath): void { $this->validateActive(); @@ -290,7 +290,7 @@ public function moveTo($targetPath) * * @return int|null The file size in bytes or null if unknown. */ - public function getSize() + public function getSize(): ?int { return $this->size; } @@ -302,7 +302,7 @@ public function getSize() * * @return int One of PHP's UPLOAD_ERR_XXX constants. */ - public function getError() + public function getError(): int { return $this->error; } @@ -313,7 +313,7 @@ public function getError() * @return string|null The filename sent by the client or null if none * was provided. */ - public function getClientFilename() + public function getClientFilename(): ?string { return $this->clientFilename; } @@ -321,7 +321,7 @@ public function getClientFilename() /** * {@inheritdoc} */ - public function getClientMediaType() + public function getClientMediaType(): ?string { return $this->clientMediaType; } diff --git a/sdk/GuzzleHttp/Psr7/Uri.php b/sdk/GuzzleHttp/Psr7/Uri.php index 0f9f020d3..77f8a2ed9 100644 --- a/sdk/GuzzleHttp/Psr7/Uri.php +++ b/sdk/GuzzleHttp/Psr7/Uri.php @@ -118,7 +118,7 @@ static function ($matches) { return array_map('urldecode', $result); } - public function __toString() + public function __toString(): string { return self::composeComponents( $this->scheme, @@ -420,12 +420,12 @@ public static function fromParts(array $parts) return $uri; } - public function getScheme() + public function getScheme(): string { return $this->scheme; } - public function getAuthority() + public function getAuthority(): string { $authority = $this->host; if ($this->userInfo !== '') { @@ -439,37 +439,37 @@ public function getAuthority() return $authority; } - public function getUserInfo() + public function getUserInfo(): string { return $this->userInfo; } - public function getHost() + public function getHost(): string { return $this->host; } - public function getPort() + public function getPort(): ?int { return $this->port; } - public function getPath() + public function getPath(): string { return $this->path; } - public function getQuery() + public function getQuery(): string { return $this->query; } - public function getFragment() + public function getFragment(): string { return $this->fragment; } - public function withScheme($scheme) + public function withScheme($scheme): \Psr\Http\Message\UriInterface { $scheme = $this->filterScheme($scheme); @@ -485,7 +485,7 @@ public function withScheme($scheme) return $new; } - public function withUserInfo($user, $password = null) + public function withUserInfo($user, $password = null): \Psr\Http\Message\UriInterface { $info = $this->filterUserInfoComponent($user); if ($password !== null) { @@ -503,7 +503,7 @@ public function withUserInfo($user, $password = null) return $new; } - public function withHost($host) + public function withHost($host): \Psr\Http\Message\UriInterface { $host = $this->filterHost($host); @@ -518,7 +518,7 @@ public function withHost($host) return $new; } - public function withPort($port) + public function withPort($port): \Psr\Http\Message\UriInterface { $port = $this->filterPort($port); @@ -534,7 +534,7 @@ public function withPort($port) return $new; } - public function withPath($path) + public function withPath($path): \Psr\Http\Message\UriInterface { $path = $this->filterPath($path); @@ -549,7 +549,7 @@ public function withPath($path) return $new; } - public function withQuery($query) + public function withQuery($query): \Psr\Http\Message\UriInterface { $query = $this->filterQueryAndFragment($query); @@ -563,7 +563,7 @@ public function withQuery($query) return $new; } - public function withFragment($fragment) + public function withFragment($fragment): \Psr\Http\Message\UriInterface { $fragment = $this->filterQueryAndFragment($fragment); diff --git a/sdk/GuzzleHttp/functions_include.php b/sdk/GuzzleHttp/functions_include.php index a93393acc..d088a5e1e 100644 --- a/sdk/GuzzleHttp/functions_include.php +++ b/sdk/GuzzleHttp/functions_include.php @@ -1,6 +1,6 @@ resetAfterTest(); - $setting = new admin_settings_aws_region('test_aws_region', - 'Test visible name', 'Test description', 'Test default setting'); + $setting = new admin_settings_aws_region( + 'test_aws_region', + 'Test visible name', + 'Test description', + 'Test default setting' + ); $html = $setting->output_html(''); $this->assertTrue(strpos($html, 'Test visible name') !== false); $this->assertTrue(strpos($html, 'Test description') !== false); $this->assertTrue(strpos($html, 'Default: Test default setting') !== false); - $this->assertTrue(strpos($html, 'assertTrue( + strpos($html, 'assertTrue(strpos($html, '') !== false); $this->assertTrue(strpos($html, '