Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 17 additions & 18 deletions Neos.Flow/Classes/Http/ContentStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static function fromContents(string $contents): self
*
* @return void
*/
public function close()
public function close(): void
{
if (!$this->resource) {
return;
Expand Down Expand Up @@ -119,7 +119,7 @@ public function replace($stream, $mode = 'r')
*
* @return int|null Returns the size in bytes if known, or null if unknown.
*/
public function getSize()
public function getSize(): ?int
{
if (!$this->isValidResource($this->resource)) {
return null;
Expand All @@ -136,7 +136,7 @@ public function getSize()
* @return int Position of the file pointer
* @throws \RuntimeException on error.
*/
public function tell()
public function tell(): int
{
$this->ensureResourceOpen();

Expand All @@ -153,7 +153,7 @@ public function tell()
*
* @return bool
*/
public function eof()
public function eof(): bool
{
if (!$this->isValidResource($this->resource)) {
return true;
Expand All @@ -167,7 +167,7 @@ public function eof()
*
* @return bool
*/
public function isSeekable()
public function isSeekable(): bool
{
if (!$this->isValidResource($this->resource)) {
return false;
Expand All @@ -188,10 +188,9 @@ public function isSeekable()
* PHP $whence values for `fseek()`. SEEK_SET: Set position equal to
* offset bytes SEEK_CUR: Set position to current location plus offset
* SEEK_END: Set position to end-of-stream plus offset.
* @return bool
* @throws \RuntimeException on failure.
*/
public function seek($offset, $whence = SEEK_SET)
public function seek($offset, $whence = SEEK_SET): void
{
$this->ensureResourceOpen();

Expand All @@ -205,7 +204,7 @@ public function seek($offset, $whence = SEEK_SET)
throw new \RuntimeException('Error seeking within stream', 1453892231);
}

return true;
return;
}

/**
Expand All @@ -218,17 +217,17 @@ public function seek($offset, $whence = SEEK_SET)
* @link http://www.php.net/manual/en/function.fseek.php
* @throws \RuntimeException on failure.
*/
public function rewind()
public function rewind(): void
{
return $this->seek(0);
$this->seek(0);
}

/**
* Returns whether or not the stream is writable.
*
* @return bool
*/
public function isWritable()
public function isWritable(): bool
{
if (!$this->isValidResource($this->resource)) {
return false;
Expand All @@ -253,7 +252,7 @@ public function isWritable()
* @return int Returns the number of bytes written to the stream.
* @throws \RuntimeException on failure.
*/
public function write($string)
public function write($string): int
{
if (!$this->isWritable()) {
throw new \RuntimeException('Stream is not writable', 1453892241);
Expand All @@ -273,7 +272,7 @@ public function write($string)
*
* @return bool
*/
public function isReadable()
public function isReadable(): bool
{
if (!$this->isValidResource($this->resource)) {
return false;
Expand All @@ -295,7 +294,7 @@ public function isReadable()
* if no bytes are available.
* @throws \RuntimeException if an error occurs.
*/
public function read($length)
public function read($length): string
{
$this->ensureResourceReadable();

Expand All @@ -315,7 +314,7 @@ public function read($length)
* @throws \RuntimeException if unable to read or an error occurs while
* reading.
*/
public function getContents()
public function getContents(): string
{
$this->ensureResourceReadable();

Expand All @@ -334,12 +333,12 @@ public function getContents()
* stream_get_meta_data() function.
*
* @link http://php.net/manual/en/function.stream-get-meta-data.php
* @param string $key Specific metadata to retrieve.
* @param string|null $key Specific metadata to retrieve.
* @return array|mixed|null Returns an associative array if no key is
* provided. Returns a specific key value if a key is provided and the
* value is found, or null if the key is not found.
*/
public function getMetadata($key = null)
public function getMetadata(?string $key = null)
{
if ($key === null) {
return stream_get_meta_data($this->resource);
Expand Down Expand Up @@ -395,7 +394,7 @@ protected function isValidResource($resource)
* @see http://php.net/manual/en/language.oop5.magic.php#object.tostring
* @return string
*/
public function __toString()
public function __toString(): string
{
if (!$this->isReadable()) {
return '';
Expand Down
12 changes: 6 additions & 6 deletions Neos.Flow/Classes/Http/UploadedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function isMoved()
* @throws RuntimeException if the upload was not successful.
* @api PSR-7
*/
public function getStream()
public function getStream(): StreamInterface
{
$this->throwExceptionIfNotAccessible();

Expand Down Expand Up @@ -172,7 +172,7 @@ public function getStream()
* the second or subsequent call to the method.
* @api PSR-7
*/
public function moveTo($targetPath)
public function moveTo($targetPath): void
{
$this->throwExceptionIfNotAccessible();

Expand Down Expand Up @@ -203,7 +203,7 @@ public function moveTo($targetPath)
* @return int|null The file size in bytes or null if unknown.
* @api PSR-7
*/
public function getSize()
public function getSize(): ?int
{
return $this->size;
}
Expand All @@ -223,7 +223,7 @@ public function getSize()
* @return int One of PHP's UPLOAD_ERR_XXX constants.
* @api PSR-7
*/
public function getError()
public function getError(): int
{
return $this->error;
}
Expand All @@ -242,7 +242,7 @@ public function getError()
* was provided.
* @api PSR-7
*/
public function getClientFilename()
public function getClientFilename(): ?string
{
return $this->clientFilename;
}
Expand All @@ -259,7 +259,7 @@ public function getClientFilename()
*
* @api PSR-7
*/
public function getClientMediaType()
public function getClientMediaType(): ?string
{
return $this->clientMediaType;
}
Expand Down
4 changes: 2 additions & 2 deletions Neos.Flow/Classes/ObjectManagement/ObjectManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function isRegistered($objectName): bool
* @param string $objectName
* @return bool
*/
public function has($objectName): bool
public function has(string $objectName): bool
{
return $this->isRegistered($objectName);
}
Expand Down Expand Up @@ -200,7 +200,7 @@ public function registerShutdownObject($object, $shutdownLifecycleMethodName): v
* @throws InvalidConfigurationTypeException
* @api
*/
public function get($objectName, ...$constructorArguments): object
public function get(string $objectName, ...$constructorArguments): object
{
if (!empty($constructorArguments) && isset($this->objects[$objectName]) && $this->objects[$objectName][self::KEY_SCOPE] !== ObjectConfiguration::SCOPE_PROTOTYPE) {
throw new \InvalidArgumentException('You cannot provide constructor arguments for singleton objects via get(). If you need to pass arguments to the constructor, define them in the Objects.yaml configuration.', 1298049934);
Expand Down
4 changes: 2 additions & 2 deletions Neos.Flow/Classes/ObjectManagement/ObjectManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getContext();
* @return T The object instance
* @api
*/
public function get($objectName, ...$constructorArguments);
public function get(string $objectName, ...$constructorArguments);

/**
* This is the PSR-11 ContainerInterface equivalent to `isRegistered`.
Expand All @@ -59,7 +59,7 @@ public function get($objectName, ...$constructorArguments);
* @return bool
* @see isRegistered
*/
public function has($objectName);
public function has(string $objectName): bool;

/**
* Returns true if an object with the given name has already
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected function createResourceMetaDataInterfaceMock(int $filesize): ResourceM
return $mock;
}

protected function createUploadedFileInterfaceMock(string $filesize): UploadedFileInterface
protected function createUploadedFileInterfaceMock(int $filesize): UploadedFileInterface
{
$mock = $this->createMock(UploadedFileInterface::class);
$mock->expects($this->once())->method('getSize')->willReturn($filesize);
Expand Down
4 changes: 2 additions & 2 deletions Neos.Flow/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@

"neos/composer-plugin": "^2.0",

"psr/http-message": "^1.0",
"psr/http-message": "^2.0",
"psr/http-factory": "^1.0",
"psr/container": "^1.0",
"psr/container": "^2.0",
"psr/log": "^2.0 || ^3.0",
"psr/http-server-middleware": "^1.0",
"psr/http-server-handler": "^1.0",
Expand Down
2 changes: 1 addition & 1 deletion Neos.Http.Factories/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"require": {
"php": "^8.2",
"psr/http-factory": "^1.0",
"psr/http-factory": "^2.0",
"guzzlehttp/psr7": "^1.8.4 || ^2.1.1"
},
"autoload": {
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
"ext-xml": "*",
"ext-xmlreader": "*",
"neos/composer-plugin": "^2.0",
"psr/http-message": "^1.0",
"psr/http-message": "^2.0",
"psr/http-factory": "^1.0",
"psr/container": "^1.0",
"psr/container": "^2.0",
"psr/http-server-middleware": "^1.0",
"psr/http-server-handler": "^1.0",
"psr/http-client": "^1.0",
Expand Down
Loading