diff --git a/src/SchemaFactory.php b/src/SchemaFactory.php index 9ebd4e0..fc3894f 100644 --- a/src/SchemaFactory.php +++ b/src/SchemaFactory.php @@ -92,9 +92,12 @@ public function backup( ?string $prefix = null, ?string $separator = null, ): TableIdentifier { - $name = Type\non_empty_string()->assert($schema->value); - $enumSchema = '' === $schema::NAME ? null : $schema::NAME; - $schemas = $this->config['schemas'] ?? []; + $name = Type\non_empty_string()->assert($schema->value); + + // mago infers string('') from SchemaInterface::NAME and ignores that an implementing + // enum may override it; see SchemaInterface::NAME docblock and itPreservesSchemaFromEnumConstant. + $enumSchema = '' === $schema::NAME ? null : $schema::NAME; // @mago-expect analysis:redundant-comparison, analysis:redundant-condition + $schemas = $this->config['schemas'] ?? []; return new TableIdentifier( table : $name, @@ -139,10 +142,13 @@ public function __invoke( ?string $prefix = null, ?string $separator = null, ): TableIdentifier { - $name = Type\non_empty_string()->assert($schema->value); - $enumSchema = '' === $schema::NAME ? null : $schema::NAME; - $prefixes = $this->config['prefixes'] ?? []; - $schemas = $this->config['schemas'] ?? []; + $name = Type\non_empty_string()->assert($schema->value); + + // mago infers string('') from SchemaInterface::NAME and ignores that an implementing + // enum may override it; see SchemaInterface::NAME docblock and itPreservesSchemaFromEnumConstant. + $enumSchema = '' === $schema::NAME ? null : $schema::NAME; // @mago-expect analysis:redundant-comparison, analysis:redundant-condition + $prefixes = $this->config['prefixes'] ?? []; + $schemas = $this->config['schemas'] ?? []; return new TableIdentifier( table : $name, diff --git a/src/Session/DbSessionHandler.php b/src/Session/DbSessionHandler.php index 2785c60..2b5a99b 100644 --- a/src/Session/DbSessionHandler.php +++ b/src/Session/DbSessionHandler.php @@ -124,7 +124,10 @@ public function read(string $id): string|false ->where(['id' => $id]); $select->where->greaterThan('expires_at', date(format: self::TIMESTAMP_FORMAT)); - $row = $this->sql->prepareStatementForSqlObject($select)->execute()?->current(); + /** @var mixed $row */ + $row = $this->sql->prepareStatementForSqlObject($select)->execute()?->current(); + + /** @var mixed $payload */ $payload = is_array($row) ? $row['payload'] ?? false : false; return is_string($payload) ? $payload : false; diff --git a/src/Session/PhpDbSessionPersistence.php b/src/Session/PhpDbSessionPersistence.php index 090dc0d..e3eb967 100644 --- a/src/Session/PhpDbSessionPersistence.php +++ b/src/Session/PhpDbSessionPersistence.php @@ -135,6 +135,7 @@ public function initializeSessionFromRequest(ServerRequestInterface $request): S ->where(['id' => $id]); $select->where->greaterThan('expires_at', date(format: self::TIMESTAMP_FORMAT)); + /** @var mixed $row */ $row = $this->sql->prepareStatementForSqlObject($select)->execute()?->current(); if (! is_array($row)) { diff --git a/src/Session/SessionPayload.php b/src/Session/SessionPayload.php index fb7748a..31ede3f 100644 --- a/src/Session/SessionPayload.php +++ b/src/Session/SessionPayload.php @@ -34,6 +34,7 @@ final class SessionPayload */ public static function decode(string $payload): array { + /** @var mixed $data */ $data = unserialize(data: $payload); /** @var array */