Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK: Correctly mark nullable method parameters as nullable #3429

Merged
merged 1 commit into from
Jan 15, 2025
Merged
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
4 changes: 2 additions & 2 deletions Neos.Cache/Classes/Backend/AbstractBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ abstract class AbstractBackend implements BackendInterface
* @param array $options Configuration options - depends on the actual backend
* @api
*/
public function __construct(EnvironmentConfiguration $environmentConfiguration = null, array $options = [])
public function __construct(?EnvironmentConfiguration $environmentConfiguration = null, array $options = [])
{
$this->environmentConfiguration = $environmentConfiguration;

Expand Down Expand Up @@ -144,7 +144,7 @@ public function setDefaultLifetime($defaultLifetime): void
* @param integer $lifetime The lifetime in seconds
* @return \DateTime The expiry time
*/
protected function calculateExpiryTime(int $lifetime = null): \DateTime
protected function calculateExpiryTime(?int $lifetime = null): \DateTime
{
if ($lifetime === self::UNLIMITED_LIFETIME || ($lifetime === null && $this->defaultLifetime === self::UNLIMITED_LIFETIME)) {
return new \DateTime(self::DATETIME_EXPIRYTIME_UNLIMITED, new \DateTimeZone('UTC'));
Expand Down
2 changes: 1 addition & 1 deletion Neos.Cache/Classes/Backend/ApcuBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function getPrefixedIdentifier(string $entryIdentifier): string
* @throws \InvalidArgumentException if the identifier is not valid
* @api
*/
public function set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = null): void
public function set(string $entryIdentifier, string $data, array $tags = [], ?int $lifetime = null): void
{
if (!$this->cache instanceof FrontendInterface) {
throw new Exception('No cache frontend has been set yet via setCache().', 1232986818);
Expand Down
2 changes: 1 addition & 1 deletion Neos.Cache/Classes/Backend/BackendInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function getPrefixedIdentifier(string $entryIdentifier): string;
* @throws \InvalidArgumentException if the identifier is not valid
* @api
*/
public function set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = null): void;
public function set(string $entryIdentifier, string $data, array $tags = [], ?int $lifetime = null): void;

/**
* Loads data from the cache.
Expand Down
2 changes: 1 addition & 1 deletion Neos.Cache/Classes/Backend/FileBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function setCache(FrontendInterface $cache): void
* @throws \InvalidArgumentException
* @api
*/
public function set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = null): void
public function set(string $entryIdentifier, string $data, array $tags = [], ?int $lifetime = null): void
{
if ($entryIdentifier !== basename($entryIdentifier)) {
throw new \InvalidArgumentException('The specified entry identifier must not contain a path segment.', 1282073032);
Expand Down
2 changes: 1 addition & 1 deletion Neos.Cache/Classes/Backend/MemcachedBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function getPrefixedIdentifier(string $entryIdentifier): string
* @throws \InvalidArgumentException if the identifier is not valid or the final memcached key is longer than 250 characters
* @api
*/
public function set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = null): void
public function set(string $entryIdentifier, string $data, array $tags = [], ?int $lifetime = null): void
{
if (strlen($this->getPrefixedIdentifier($entryIdentifier)) > 250) {
throw new \InvalidArgumentException('Could not set value. Key more than 250 characters (' . $this->getPrefixedIdentifier($entryIdentifier) . ').', 1232969508);
Expand Down
4 changes: 2 additions & 2 deletions Neos.Cache/Classes/Backend/MultiBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MultiBackend extends AbstractBackend
protected ?LoggerInterface $logger = null;
protected ?ThrowableStorageInterface $throwableStorage = null;

public function __construct(EnvironmentConfiguration $environmentConfiguration = null, array $options = [])
public function __construct(?EnvironmentConfiguration $environmentConfiguration = null, array $options = [])
{
parent::__construct($environmentConfiguration, $options);

Expand Down Expand Up @@ -96,7 +96,7 @@ protected function buildSubBackend(string $backendClassName, array $backendOptio
/**
* @throws Throwable
*/
public function set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = null): void
public function set(string $entryIdentifier, string $data, array $tags = [], ?int $lifetime = null): void
{
$this->prepareBackends();
foreach ($this->backends as $backend) {
Expand Down
2 changes: 1 addition & 1 deletion Neos.Cache/Classes/Backend/NullBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected function setProperty(string $propertyName, $propertyValue) : bool
* @return void
* @api
*/
public function set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = null): void
public function set(string $entryIdentifier, string $data, array $tags = [], ?int $lifetime = null): void
{
}

Expand Down
2 changes: 1 addition & 1 deletion Neos.Cache/Classes/Backend/PdoBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ protected function setBatchSize(int $batchSize): void
* @throws FilesException
* @api
*/
public function set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = null): void
public function set(string $entryIdentifier, string $data, array $tags = [], ?int $lifetime = null): void
{
$this->connect();

Expand Down
4 changes: 2 additions & 2 deletions Neos.Cache/Classes/Backend/RedisBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function __construct(EnvironmentConfiguration $environmentConfiguration,
* @throws CacheException
* @api
*/
public function set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = null): void
public function set(string $entryIdentifier, string $data, array $tags = [], ?int $lifetime = null): void
{
if ($this->isFrozen()) {
throw new \RuntimeException(sprintf('Cannot add or modify cache entry because the backend of cache "%s" is frozen.', $this->cacheIdentifier), 1323344192);
Expand Down Expand Up @@ -493,7 +493,7 @@ public function setBatchSize(int|string $batchSize): void
$this->batchSize = (int)$batchSize;
}

public function setRedis(\Redis $redis = null): void
public function setRedis(?\Redis $redis = null): void
{
if ($redis !== null) {
$this->redis = $redis;
Expand Down
4 changes: 2 additions & 2 deletions Neos.Cache/Classes/Backend/SimpleFileBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function getCacheDirectory(): string
* @throws \InvalidArgumentException
* @api
*/
public function set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = null): void
public function set(string $entryIdentifier, string $data, array $tags = [], ?int $lifetime = null): void
{
if ($entryIdentifier !== basename($entryIdentifier)) {
throw new \InvalidArgumentException('The specified entry identifier must not contain a path segment.', 1334756735);
Expand Down Expand Up @@ -493,7 +493,7 @@ protected function verifyCacheDirectory(): void
* @param int|null $maxlen
* @return string|false The contents of the cache file or false on error
*/
protected function readCacheFile(string $cacheEntryPathAndFilename, int $offset = 0, int $maxlen = null)
protected function readCacheFile(string $cacheEntryPathAndFilename, int $offset = 0, ?int $maxlen = null)
{
for ($i = 0; $i < 3; $i++) {
$data = false;
Expand Down
2 changes: 1 addition & 1 deletion Neos.Cache/Classes/Backend/TransientMemoryBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class TransientMemoryBackend extends IndependentAbstractBackend implements Tagga
* @throws Exception if no cache frontend has been set.
* @api
*/
public function set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = null): void
public function set(string $entryIdentifier, string $data, array $tags = [], ?int $lifetime = null): void
{
if (!$this->cache instanceof FrontendInterface) {
throw new Exception('No cache frontend has been set yet via setCache().', 1238244992);
Expand Down
2 changes: 1 addition & 1 deletion Neos.Cache/Classes/Frontend/FrontendInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function getBackend();
* @return void
* @api
*/
public function set(string $entryIdentifier, $data, array $tags = [], int $lifetime = null);
public function set(string $entryIdentifier, $data, array $tags = [], ?int $lifetime = null);

/**
* Finds and returns data from the cache.
Expand Down
2 changes: 1 addition & 1 deletion Neos.Cache/Classes/Frontend/PhpFrontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function getWrapped(string $entryIdentifier)
* @throws \Neos\Cache\Exception
* @api
*/
public function set(string $entryIdentifier, $sourceCode, array $tags = [], int $lifetime = null)
public function set(string $entryIdentifier, $sourceCode, array $tags = [], ?int $lifetime = null)
{
if (!$this->isValidEntryIdentifier($entryIdentifier)) {
throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1264023823);
Expand Down
2 changes: 1 addition & 1 deletion Neos.Cache/Classes/Frontend/StringFrontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class StringFrontend extends AbstractFrontend
* @throws \Neos\Cache\Exception
* @api
*/
public function set(string $entryIdentifier, $string, array $tags = [], int $lifetime = null)
public function set(string $entryIdentifier, $string, array $tags = [], ?int $lifetime = null)
{
if (!$this->isValidEntryIdentifier($entryIdentifier)) {
throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1233057566);
Expand Down
2 changes: 1 addition & 1 deletion Neos.Cache/Classes/Frontend/VariableFrontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function initializeObject()
* @throws \Neos\Cache\Exception
* @api
*/
public function set(string $entryIdentifier, $variable, array $tags = [], int $lifetime = null)
public function set(string $entryIdentifier, $variable, array $tags = [], ?int $lifetime = null)
{
if (!$this->isValidEntryIdentifier($entryIdentifier)) {
throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1233058264);
Expand Down
2 changes: 1 addition & 1 deletion Neos.Cache/Tests/Unit/Backend/SimpleFileBackendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function setUp(): void
* @param FrontendInterface $mockCacheFrontend
* @return SimpleFileBackend
*/
protected function getSimpleFileBackend(array $options = [], FrontendInterface $mockCacheFrontend = null)
protected function getSimpleFileBackend(array $options = [], ?FrontendInterface $mockCacheFrontend = null)
{
$simpleFileBackend = new SimpleFileBackend($this->mockEnvironmentConfiguration, $options);

Expand Down
2 changes: 1 addition & 1 deletion Neos.Eel/Classes/Helper/ArrayHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ public function reduce(iterable $array, callable $callback, $initialValue = null
* @param callable $callback Callback for testing if an element should be included in the result, current value and key will be passed as arguments
* @return array The array with elements where callback returned true
*/
public function filter(iterable $array, callable $callback = null): array
public function filter(iterable $array, ?callable $callback = null): array
{
if ($array instanceof \Traversable) {
$array = iterator_to_array($array);
Expand Down
18 changes: 9 additions & 9 deletions Neos.Error.Messages/Classes/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function addNotice(Notice $notice)
* @return array<Error>
* @api
*/
public function getErrors(string $messageTypeFilter = null): array
public function getErrors(?string $messageTypeFilter = null): array
{
return $this->filterMessages($this->errors, $messageTypeFilter);
}
Expand All @@ -144,7 +144,7 @@ public function getErrors(string $messageTypeFilter = null): array
* @return array<Warning>
* @api
*/
public function getWarnings(string $messageTypeFilter = null): array
public function getWarnings(?string $messageTypeFilter = null): array
{
return $this->filterMessages($this->warnings, $messageTypeFilter);
}
Expand All @@ -156,7 +156,7 @@ public function getWarnings(string $messageTypeFilter = null): array
* @return array<Notice>
* @api
*/
public function getNotices(string $messageTypeFilter = null): array
public function getNotices(?string $messageTypeFilter = null): array
{
return $this->filterMessages($this->notices, $messageTypeFilter);
}
Expand All @@ -168,7 +168,7 @@ public function getNotices(string $messageTypeFilter = null): array
* @return Error
* @api
*/
public function getFirstError(string $messageTypeFilter = null)
public function getFirstError(?string $messageTypeFilter = null)
{
$matchingErrors = $this->filterMessages($this->errors, $messageTypeFilter);
reset($matchingErrors);
Expand All @@ -182,7 +182,7 @@ public function getFirstError(string $messageTypeFilter = null)
* @return Warning
* @api
*/
public function getFirstWarning(string $messageTypeFilter = null)
public function getFirstWarning(?string $messageTypeFilter = null)
{
$matchingWarnings = $this->filterMessages($this->warnings, $messageTypeFilter);
reset($matchingWarnings);
Expand All @@ -196,7 +196,7 @@ public function getFirstWarning(string $messageTypeFilter = null)
* @return Notice
* @api
*/
public function getFirstNotice(string $messageTypeFilter = null)
public function getFirstNotice(?string $messageTypeFilter = null)
{
$matchingNotices = $this->filterMessages($this->notices, $messageTypeFilter);
reset($matchingNotices);
Expand All @@ -213,7 +213,7 @@ public function getFirstNotice(string $messageTypeFilter = null)
* @return Result
* @api
*/
public function forProperty(string $propertyPath = null): Result
public function forProperty(?string $propertyPath = null): Result
{
if ($propertyPath === '' || $propertyPath === null) {
return $this;
Expand Down Expand Up @@ -410,7 +410,7 @@ public function getFlattenedNotices(): array
* @param string $messageTypeFilter If specified only messages implementing the given class name are taken into account
* @return void
*/
public function flattenTree(string $propertyName, array &$result, array $level = [], string $messageTypeFilter = null)
public function flattenTree(string $propertyName, array &$result, array $level = [], ?string $messageTypeFilter = null)
{
if (count($this->$propertyName) > 0) {
$propertyPath = implode('.', $level);
Expand All @@ -429,7 +429,7 @@ public function flattenTree(string $propertyName, array &$result, array $level =
* @param string $messageTypeFilter If specified only messages implementing the given class name are taken into account
* @return array the filtered message instances
*/
protected function filterMessages(array $messages, string $messageTypeFilter = null): array
protected function filterMessages(array $messages, ?string $messageTypeFilter = null): array
{
if ($messageTypeFilter === null) {
return $messages;
Expand Down
2 changes: 1 addition & 1 deletion Neos.Flow.Log/Classes/Backend/AnsiConsoleBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function open(): void
* @param string $methodName
* @return void
*/
public function append(string $message, int $severity = LOG_INFO, $additionalData = null, string $packageKey = null, string $className = null, string $methodName = null): void
public function append(string $message, int $severity = LOG_INFO, $additionalData = null, ?string $packageKey = null, ?string $className = null, ?string $methodName = null): void
{
if ($severity > $this->severityThreshold) {
return;
Expand Down
2 changes: 1 addition & 1 deletion Neos.Flow.Log/Classes/Backend/BackendInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function open(): void;
* @return void
* @api
*/
public function append(string $message, int $severity = LOG_INFO, $additionalData = null, string $packageKey = null, string $className = null, string $methodName = null): void;
public function append(string $message, int $severity = LOG_INFO, $additionalData = null, ?string $packageKey = null, ?string $className = null, ?string $methodName = null): void;

/**
* Carries out all actions necessary to cleanly close the logging backend, such as
Expand Down
2 changes: 1 addition & 1 deletion Neos.Flow.Log/Classes/Backend/ConsoleBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function open(): void
* @return void
* @api
*/
public function append(string $message, int $severity = LOG_INFO, $additionalData = null, string $packageKey = null, string $className = null, string $methodName = null): void
public function append(string $message, int $severity = LOG_INFO, $additionalData = null, ?string $packageKey = null, ?string $className = null, ?string $methodName = null): void
{
if ($severity > $this->severityThreshold) {
return;
Expand Down
2 changes: 1 addition & 1 deletion Neos.Flow.Log/Classes/Backend/FileBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ protected function rotateLogFile(): void
* @return void
* @api
*/
public function append(string $message, int $severity = LOG_INFO, $additionalData = null, string $packageKey = null, string $className = null, string $methodName = null): void
public function append(string $message, int $severity = LOG_INFO, $additionalData = null, ?string $packageKey = null, ?string $className = null, ?string $methodName = null): void
{
if ($severity > $this->severityThreshold) {
return;
Expand Down
2 changes: 1 addition & 1 deletion Neos.Flow.Log/Classes/Backend/JsonFileBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class JsonFileBackend extends FileBackend
* @param string $methodName Name of the method triggering the log (determined automatically if not specified)
* @return void
*/
public function append(string $message, int $severity = LOG_INFO, $additionalData = null, string $packageKey = null, string $className = null, string $methodName = null): void
public function append(string $message, int $severity = LOG_INFO, $additionalData = null, ?string $packageKey = null, ?string $className = null, ?string $methodName = null): void
{

if ($severity > $this->severityThreshold) {
Expand Down
2 changes: 1 addition & 1 deletion Neos.Flow.Log/Classes/Backend/NullBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function open(): void
* @return void
* @api
*/
public function append(string $message, int $severity = 1, $additionalData = null, string $packageKey = null, string $className = null, string $methodName = null): void
public function append(string $message, int $severity = 1, $additionalData = null, ?string $packageKey = null, ?string $className = null, ?string $methodName = null): void
{
}

Expand Down
2 changes: 1 addition & 1 deletion Neos.Flow/Classes/Annotations/IgnoreValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class IgnoreValidation
*/
public $evaluate = false;

public function __construct(string $argumentName = null, bool $evaluate = false)
public function __construct(?string $argumentName = null, bool $evaluate = false)
{
$this->argumentName = $argumentName ? ltrim($argumentName, '$') : null;
$this->evaluate = $evaluate;
Expand Down
2 changes: 1 addition & 1 deletion Neos.Flow/Classes/Annotations/Validate.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ final class Validate
*/
public $validationGroups = ['Default'];

public function __construct(?string $argumentName = null, string $type = null, array $options = [], ?array $validationGroups = null)
public function __construct(?string $argumentName = null, ?string $type = null, array $options = [], ?array $validationGroups = null)
{
$this->type = $type;

Expand Down
2 changes: 1 addition & 1 deletion Neos.Flow/Classes/Aop/Advice/AbstractAdvice.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class AbstractAdvice implements AdviceInterface
* @param ObjectManagerInterface $objectManager Only require if a runtime evaluations function is specified
* @param \Closure $runtimeEvaluator Runtime evaluations function
*/
public function __construct(string $aspectObjectName, string $adviceMethodName, ObjectManagerInterface $objectManager = null, \Closure $runtimeEvaluator = null)
public function __construct(string $aspectObjectName, string $adviceMethodName, ?ObjectManagerInterface $objectManager = null, ?\Closure $runtimeEvaluator = null)
{
$this->aspectObjectName = $aspectObjectName;
$this->adviceMethodName = $adviceMethodName;
Expand Down
Loading
Loading