Skip to content

fix: update dependencies for dbal v3#1172

Merged
tikhanovichA merged 9 commits intodevelopfrom
feat/update-dependency-2
Feb 26, 2026
Merged

fix: update dependencies for dbal v3#1172
tikhanovichA merged 9 commits intodevelopfrom
feat/update-dependency-2

Conversation

@tikhanovichA
Copy link
Copy Markdown
Contributor

@tikhanovichA tikhanovichA commented Feb 25, 2026

Update dbal dependencies AUT-4457

Summary by CodeRabbit

  • Refactor

    • Improved database compatibility and more consistent, stable data retrieval across the app (associative results, safer queries, clearer collection/iteration typing).
    • Minor public API typing clarifications for collections and query methods.
  • Bug Fixes

    • Improved logging reliability by ensuring log files are created before handlers run.
  • Tests

    • Hardened tests and teardown with additional guards and error handling to reduce spurious failures.
  • Chore

    • Project now requires PHP 8.0 or newer.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 25, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Migrate code to Doctrine DBAL 3 patterns (use Result and Exception types, replace fetch/fetchAll with fetchAssociative/fetchAllAssociative, use executeQuery), add Flysystem local adapter constant, tighten several method signatures, and add test guards/teardown resilience; require PHP ^8.0.

Changes

Cohort / File(s) Summary
DBAL exception & docblock updates
common/persistence/sql/class.Platform.php, common/persistence/sql/dbal/class.Driver.php, core/kernel/impl/class.ApiModelOO.php, test/integration/common/persistence/sql/dbal/DriverTest.php
Replace Doctrine\DBAL\DBALException import with Doctrine\DBAL\Exception aliased as DBALException; update docblocks/throws annotations accordingly.
fetch → fetchAssociative migration
common/persistence/class.SqlKvDriver.php, common/persistence/sql/class.QueryIterator.php, common/uri/class.MicrotimeUriProvider.php, core/kernel/api/class.ModelExporter.php, core/kernel/persistence/smoothsql/class.Class.php, core/kernel/persistence/smoothsql/class.Resource.php, core/kernel/uri/class.DatabaseSerialUriProvider.php, core/kernel/uri/MicrotimeRandUriProvider.php, test/integration/RdfExportTest.php, test/unit/model/persistence/smoothsql/SmoothModelIteratorTest.php
Replace fetch() with fetchAssociative() and fetchAll() with fetchAllAssociative() where applicable; add explicit !== false checks; convert row access to associative keys; remove redundant closeCursor() calls inside loops.
Result type & API adjustments
common/persistence/sql/dbal/class.Driver.php, core/kernel/classes/class.DbWrapper.php, core/kernel/persistence/smoothsql/search/GateWay.php, core/kernel/persistence/smoothsql/search/TaoResultSet.php, core/resource/ResourceCollection.php, common/persistence/class.SqlPersistence.php
Adopt Doctrine\DBAL\Result, replace Statement/PDO types, update PHPDoc/return annotations, switch to executeQuery() + fetchAllAssociative() in places, and add/adjust return type hints (e.g., TaoResultSet::current(): mixed, ResourceCollection iterator method return types).
SqlPersistence public signature change
common/persistence/class.SqlPersistence.php
Tightened method signature: query(string $statement, array $params = [], array $types = []): Result and updated imports/docblock to Doctrine\DBAL\Result. (Public API-affecting change.)
Filesystem constant addition
common/oatbox/filesystem/FileSystemService.php
Add public constant FLYSYSTEM_LOCAL_ADAPTER = LocalFilesystemAdapter::class with docblock describing it as the local filesystem adapter (Flysystem v3).
Monolog log-file precreate helper
common/oatbox/log/logger/TaoMonolog.php
Add protected helper ensureLogFileExists(string $handlerClass, array $handlerOptions): void and invoke it in buildHandler to pre-create log files for StreamHandler when appropriate.
DBAL parameter binding & test fetch updates
test/integration/common/persistence/sql/UpdateMultipleTestAbstract.php
Change named parameter keys in INSERT bindings from :key to key (DBAL binding style) and replace fetchAll() with fetchAllAssociative() in test result handling.
Test setup/teardown guards & static cache reset
test/integration/helpers/FileSerializerMigrationHelperTest.php, test/integration/model/persistence/starsql/ClassTest.php, test/unit/core/DependencyInjection/ContainerBuilderTest.php, test/unit/extension/ComposerInfoTest.php
Wrap teardown cleanup in try/catch (ignore Throwable), add test skip guards when dependencies are missing (Neo4j, vfsStream), and add setUp plus a reflection helper to reset ComposerInfo static caches before tests.
SmoothSQL & search gateway adjustments
core/kernel/persistence/smoothsql/class.Class.php, core/kernel/persistence/smoothsql/class.Resource.php, core/kernel/persistence/smoothsql/search/GateWay.php
Introduce @var annotations and explicit Result typing, narrow statement types to Result, simplify statementToArray to DBAL3 Result, convert data access to associative fetches, and adjust some method signatures (e.g., updateUri(...): void).
Test mocks & import adaptations
test/unit/model/persistence/smoothsql/SmoothModelIteratorTest.php, test/integration/RdfExportTest.php
Adapt tests to use DBAL Result and fetchAssociative(); update mock wiring and imports accordingly.
Composer PHP requirement
composer.json
Add "php": "^8.0" to the require section.
Misc scripts adjustments
core/kernel/api/class.ModelFactory.php, core/kernel/classes/class.DbWrapper.php, scripts/tools/CleanUpOrphanFiles.php
Switch fetchColumn() to fetchOne() for single-value queries, replace fetchAll() usage with associative variants, and remove unnecessary cursor closures.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 79.66% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately describes the main objective of the changeset: updating dependencies for DBAL v3. The title is concise, specific, and reflects the primary change across all modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/update-dependency-2

Comment @coderabbitai help to get the list of available commands and usage tips.

@tikhanovichA tikhanovichA requested review from a team, Karol-Stelmaczonek, KirylHatalski, bartlomiejmarszal and pnal and removed request for a team February 25, 2026 14:42
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
common/uri/class.MicrotimeUriProvider.php (1)

59-72: ⚠️ Potential issue | 🟠 Major

Reset $uriExist each iteration to prevent sticky true state.

Line 69 sets $uriExist = true on collision, but it is never reset inside the loop. After one collision, the loop can become non-terminating.

Proposed fix
         $uriExist = false;
         do {
+            $uriExist = false;
             list($usec, $sec) = explode(" ", microtime());
             $uri = $modelUri . 'i' . (str_replace(".", "", $sec . "" . $usec));
             $sqlResult = $dbWrapper->query(
                 "SELECT COUNT(subject) AS num FROM statements WHERE subject = '" . $uri . "'"
             );

             if (($row = $sqlResult->fetchAssociative()) !== false) {
                 $found = (int)$row['num'];
                 if ($found > 0) {
                     $uriExist = true;
                 }
             }
         } while ($uriExist);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@common/uri/class.MicrotimeUriProvider.php` around lines 59 - 72, The loop in
MicrotimeUriProvider uses $uriExist to control repetition but never resets it
after a collision, causing it to remain true forever; fix by reinitializing
$uriExist = false at the start of each do iteration (or derive $uriExist solely
from the current query result) so that each generated $uri is re-checked
correctly in the block that builds $uri, runs the SELECT COUNT(...), and
inspects $row['num'].
🧹 Nitpick comments (4)
core/kernel/uri/class.DatabaseSerialUriProvider.php (1)

75-77: Use fetchOne() for single-value retrieval instead of fetchAssociative() with current().

Line 77 uses current($row) on an associative array, introducing implicit dependence on key order. The codebase already uses fetchOne() for scalar value retrieval (e.g., in class.DbWrapper.php and class.Class.php). Refactor to use this more explicit and order-independent API:

$returnValue = (string)($sth->fetchOne() ?? '');
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/kernel/uri/class.DatabaseSerialUriProvider.php` around lines 75 - 77, In
DatabaseSerialUriProvider, replace the scalar retrieval using
$sth->fetchAssociative() and current($row) with the explicit single-value API
$sth->fetchOne() to avoid reliance on associative key order; change the
assignment to set $returnValue from the result of $sth->fetchOne() (casting to
string and defaulting to empty string if null) instead of using
fetchAssociative()/current().
test/unit/extension/ComposerInfoTest.php (1)

44-49: Guard setAccessible(true) for backward compatibility with PHP <8.1.

ReflectionProperty::setAccessible(true) became a no-op in PHP 8.1.0 and will be deprecated in PHP 8.5+. Wrap it with a version check to support PHP 8.0 and earlier without introducing deprecation warnings on newer versions.

Proposed change
         foreach (['availablePackages', 'jsons', 'locks'] as $propName) {
             if ($ref->hasProperty($propName)) {
                 $prop = $ref->getProperty($propName);
-                $prop->setAccessible(true);
+                if (PHP_VERSION_ID < 80100) {
+                    $prop->setAccessible(true);
+                }
                 $prop->setValue(null);
             }
         }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/unit/extension/ComposerInfoTest.php` around lines 44 - 49, The test
calls ReflectionProperty::setAccessible(true) for properties
'availablePackages','jsons','locks' via a ReflectionClass in ComposerInfoTest;
guard these calls with a PHP version check (e.g. only call setAccessible when
PHP_VERSION_ID < 80100) so the setAccessible(true) invocation is skipped on PHP
8.1+ and avoids deprecation/no-op warnings — wrap the $prop->setAccessible(true)
call inside that conditional in the loop that uses $ref->getProperty(...) so
behavior remains the same on older PHP while silent on newer versions.
common/oatbox/filesystem/FileSystemService.php (1)

45-47: Reuse the new local-adapter constant to remove duplication.

You introduced FLYSYSTEM_LOCAL_ADAPTER, but registerLocalFileSystem() still hardcodes LocalFilesystemAdapter::class. Reusing the constant keeps adapter wiring centralized.

Proposed refactor
-            'class' => LocalFilesystemAdapter::class,
+            'class' => self::FLYSYSTEM_LOCAL_ADAPTER,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@common/oatbox/filesystem/FileSystemService.php` around lines 45 - 47,
registerLocalFileSystem() still hardcodes LocalFilesystemAdapter::class instead
of using the newly added FLYSYSTEM_LOCAL_ADAPTER constant; update
registerLocalFileSystem() to reference self::FLYSYSTEM_LOCAL_ADAPTER (or
static::FLYSYSTEM_LOCAL_ADAPTER if appropriate) when wiring the adapter so the
adapter class is centralized via the constant and duplication is removed.
core/kernel/persistence/smoothsql/class.Class.php (1)

111-112: Simplify the existence check and remove the unused loop variable.

Line 118 assigns $row without using it. A direct fetch check is clearer and avoids static-analysis noise.

Proposed refactor
-        while (($row = $result->fetchAssociative()) !== false) {
-            $returnValue =  true;
-            break;
-        }
+        $returnValue = $result->fetchAssociative() !== false;

Also applies to: 118-120

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/kernel/persistence/smoothsql/class.Class.php` around lines 111 - 112,
The existence check uses an unused loop variable ($row) and can be simplified:
when calling $this->getPersistence()->query($query, [...]) store the Result in
$result and then directly call $result->fetch() (or check truthiness of the
fetch) instead of iterating or assigning $row; remove the unnecessary
foreach/loop and unused $row variable in the method in class.Class.php to make
the check concise and silence static-analysis warnings.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@core/kernel/uri/MicrotimeRandUriProvider.php`:
- Around line 78-82: The code in MicrotimeRandUriProvider.php interpolates $uri
into the SQL for the statements lookup; change the query to a
parameterized/prepared one (use the persistence layer's parameter binding, e.g.,
executeQuery/prepare + execute with params) instead of string concatenation so
the subject value is bound as a parameter when calling getPersistence()->query
(or prepare) and then fetchAssociative() as before; update the block where
$sqlResult is created and where $uri is referenced to use the bound parameter.

In `@core/resource/ResourceCollection.php`:
- Around line 146-155: The code uses $results->rowCount() to set
$this->endOfClass which is unreliable for SELECTs; change the logic to fetch the
rows first (use the result of $results->fetchAllAssociative()), compute the
count with count($rows) and set $this->endOfClass = $count < $this->cacheSize,
then iterate over $rows to push into $this->resources and update $this->lastId
(replace references to $results->fetchAllAssociative() in the foreach with the
fetched $rows variable).

---

Outside diff comments:
In `@common/uri/class.MicrotimeUriProvider.php`:
- Around line 59-72: The loop in MicrotimeUriProvider uses $uriExist to control
repetition but never resets it after a collision, causing it to remain true
forever; fix by reinitializing $uriExist = false at the start of each do
iteration (or derive $uriExist solely from the current query result) so that
each generated $uri is re-checked correctly in the block that builds $uri, runs
the SELECT COUNT(...), and inspects $row['num'].

---

Nitpick comments:
In `@common/oatbox/filesystem/FileSystemService.php`:
- Around line 45-47: registerLocalFileSystem() still hardcodes
LocalFilesystemAdapter::class instead of using the newly added
FLYSYSTEM_LOCAL_ADAPTER constant; update registerLocalFileSystem() to reference
self::FLYSYSTEM_LOCAL_ADAPTER (or static::FLYSYSTEM_LOCAL_ADAPTER if
appropriate) when wiring the adapter so the adapter class is centralized via the
constant and duplication is removed.

In `@core/kernel/persistence/smoothsql/class.Class.php`:
- Around line 111-112: The existence check uses an unused loop variable ($row)
and can be simplified: when calling $this->getPersistence()->query($query,
[...]) store the Result in $result and then directly call $result->fetch() (or
check truthiness of the fetch) instead of iterating or assigning $row; remove
the unnecessary foreach/loop and unused $row variable in the method in
class.Class.php to make the check concise and silence static-analysis warnings.

In `@core/kernel/uri/class.DatabaseSerialUriProvider.php`:
- Around line 75-77: In DatabaseSerialUriProvider, replace the scalar retrieval
using $sth->fetchAssociative() and current($row) with the explicit single-value
API $sth->fetchOne() to avoid reliance on associative key order; change the
assignment to set $returnValue from the result of $sth->fetchOne() (casting to
string and defaulting to empty string if null) instead of using
fetchAssociative()/current().

In `@test/unit/extension/ComposerInfoTest.php`:
- Around line 44-49: The test calls ReflectionProperty::setAccessible(true) for
properties 'availablePackages','jsons','locks' via a ReflectionClass in
ComposerInfoTest; guard these calls with a PHP version check (e.g. only call
setAccessible when PHP_VERSION_ID < 80100) so the setAccessible(true) invocation
is skipped on PHP 8.1+ and avoids deprecation/no-op warnings — wrap the
$prop->setAccessible(true) call inside that conditional in the loop that uses
$ref->getProperty(...) so behavior remains the same on older PHP while silent on
newer versions.

ℹ️ Review info

Configuration used: Path: https://raw.githubusercontent.com/oat-sa/tao-code-quality/main/coderabbit/php/authoring/v1/.coderabbit.yaml (via .coderabbit.yaml)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 60042fb and 666f40e.

📒 Files selected for processing (24)
  • common/oatbox/filesystem/FileSystemService.php
  • common/persistence/class.SqlKvDriver.php
  • common/persistence/sql/class.Platform.php
  • common/persistence/sql/class.QueryIterator.php
  • common/persistence/sql/dbal/class.Driver.php
  • common/uri/class.MicrotimeUriProvider.php
  • core/kernel/api/class.ModelExporter.php
  • core/kernel/classes/class.DbWrapper.php
  • core/kernel/impl/class.ApiModelOO.php
  • core/kernel/persistence/smoothsql/class.Class.php
  • core/kernel/persistence/smoothsql/class.Resource.php
  • core/kernel/persistence/smoothsql/search/GateWay.php
  • core/kernel/persistence/smoothsql/search/TaoResultSet.php
  • core/kernel/uri/MicrotimeRandUriProvider.php
  • core/kernel/uri/class.DatabaseSerialUriProvider.php
  • core/resource/ResourceCollection.php
  • test/integration/RdfExportTest.php
  • test/integration/common/persistence/sql/UpdateMultipleTestAbstract.php
  • test/integration/common/persistence/sql/dbal/DriverTest.php
  • test/integration/helpers/FileSerializerMigrationHelperTest.php
  • test/integration/model/persistence/starsql/ClassTest.php
  • test/unit/core/DependencyInjection/ContainerBuilderTest.php
  • test/unit/extension/ComposerInfoTest.php
  • test/unit/model/persistence/smoothsql/SmoothModelIteratorTest.php

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
core/resource/ResourceCollection.php (1)

1-1: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1) — coding guideline violation.

The file does not declare strict types.

Proposed fix
 <?php
+
+declare(strict_types=1);
+
 /**
  * This program is free software; ...

As per coding guidelines: "Use strict types declare(strict_types=1); in all PHP files."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/resource/ResourceCollection.php` at line 1, Add a strict types
declaration to this PHP file by inserting declare(strict_types=1); immediately
after the opening <?php tag in ResourceCollection.php so the file follows the
coding guideline; ensure the declaration appears before any namespace, use
statements, or class definitions (e.g., class ResourceCollection) so strict
typing is applied across the file.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@core/resource/ResourceCollection.php`:
- Around line 201-204: The code uses the PHP 8.0 `mixed` return type in
ResourceCollection::current() and ResourceCollection::key(), so update
composer.json to declare a PHP >=8.0 requirement (e.g. add "php": "^8.0" to the
"require" section) so installations on older PHP (7.4) won't cause parse errors;
after updating composer.json, run composer update to refresh the lockfile.

---

Outside diff comments:
In `@core/resource/ResourceCollection.php`:
- Line 1: Add a strict types declaration to this PHP file by inserting
declare(strict_types=1); immediately after the opening <?php tag in
ResourceCollection.php so the file follows the coding guideline; ensure the
declaration appears before any namespace, use statements, or class definitions
(e.g., class ResourceCollection) so strict typing is applied across the file.

ℹ️ Review info

Configuration used: Path: https://raw.githubusercontent.com/oat-sa/tao-code-quality/main/coderabbit/php/authoring/v1/.coderabbit.yaml (via .coderabbit.yaml)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1cc0e79 and 507fa53.

📒 Files selected for processing (1)
  • core/resource/ResourceCollection.php

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
composer.json (1)

98-98: ⚠️ Potential issue | 🟠 Major

Remove oat\\generis\\test\\ namespace from autoload section and correct autoload-dev path.

The namespace oat\\generis\\test\\ is currently declared in both autoload (line 98) and autoload-dev (line 109). The autoload section exposes the test namespace in all environments, including production, which violates the principle of least privilege. The autoload-dev entry points to "generis/test/", which does not exist; test files are located in "test/".

Remove the test namespace from autoload entirely. Update autoload-dev to map "oat\\generis\\test\\" to "test/" to correctly target the directory containing test classes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@composer.json` at line 98, Remove the test namespace mapping from the
autoload section so production code does not expose tests: delete the
"oat\\generis\\test\\" entry under "autoload". Then correct the autoload-dev
mapping by adding or updating the "oat\\generis\\test\\" key to point to "test/"
(not "generis/test/") under "autoload-dev" so test classes are only autoloaded
in dev environments.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@composer.json`:
- Line 57: Update the PHP platform constraint in composer.json from "php":
"^8.0" to "php": "^8.1" so it matches Symfony 6.4 requirements; modify the "php"
entry in composer.json and then regenerate the lockfile (run composer update or
composer update --lock) to resolve dependencies against PHP 8.1, ensuring
packages like symfony/lock, symfony/cache, symfony/dependency-injection and
symfony/config can be installed.

---

Outside diff comments:
In `@composer.json`:
- Line 98: Remove the test namespace mapping from the autoload section so
production code does not expose tests: delete the "oat\\generis\\test\\" entry
under "autoload". Then correct the autoload-dev mapping by adding or updating
the "oat\\generis\\test\\" key to point to "test/" (not "generis/test/") under
"autoload-dev" so test classes are only autoloaded in dev environments.

ℹ️ Review info

Configuration used: Path: https://raw.githubusercontent.com/oat-sa/tao-code-quality/main/coderabbit/php/authoring/v1/.coderabbit.yaml (via .coderabbit.yaml)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 507fa53 and fb3a13f.

📒 Files selected for processing (1)
  • composer.json

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (3)
common/persistence/class.SqlPersistence.php (1)

1-1: Missing declare(strict_types=1);.

Per coding guidelines, all PHP files must use declare(strict_types=1);. This is a pre-existing omission, but given that this PR tightens the method signature with explicit types, adding strict types would be consistent with the direction of these changes.

Proposed fix
 <?php
+
+declare(strict_types=1);

As per coding guidelines, "Use strict types declare(strict_types=1); in all PHP files."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@common/persistence/class.SqlPersistence.php` at line 1, Add the strict types
declaration to this PHP file by inserting declare(strict_types=1); immediately
after the opening <?php tag in class.SqlPersistence.php so the SqlPersistence
class and its newly tightened method signatures are validated under strict
typing rules; ensure there is a blank line or newline after the declaration to
keep file formatting consistent.
core/kernel/api/class.ModelFactory.php (1)

1-1: Missing declare(strict_types=1);.

The file does not declare strict types. As per coding guidelines, "Use strict types declare(strict_types=1); in all PHP files."

♻️ Proposed fix
 <?php
+
+declare(strict_types=1);
+
 /**
  * This program is free software; ...
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/kernel/api/class.ModelFactory.php` at line 1, Add a strict types
declaration to this PHP file by inserting declare(strict_types=1); immediately
after the opening <?php tag in core/kernel/api/class.ModelFactory.php so the
file (and the ModelFactory class) enforces strict typing per project guidelines.
scripts/tools/CleanUpOrphanFiles.php (1)

1-1: Add declare(strict_types=1); to the file.

The file is missing the strict types declaration required by coding guidelines for all PHP files. As per coding guidelines: "Use strict types declare(strict_types=1); in all PHP files."

♻️ Proposed fix
 <?php
+
+declare(strict_types=1);
+
 /**
  * This program is free software; ...
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/tools/CleanUpOrphanFiles.php` at line 1, Add the strict types
declaration at the top of the PHP file immediately after the opening PHP tag
(<?php) by inserting declare(strict_types=1); so the file uses strict typing;
ensure it's the first statement following the PHP open tag and before any other
code or comments to comply with the project's coding guidelines.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@common/oatbox/log/logger/TaoMonolog.php`:
- Around line 154-155: Validate $handlerOptions before using $handlerOptions[0]:
ensure it's an array and that an element at numeric index 0 exists and is a
string; if not, extract the first string value from the array (e.g., via
reset(array_values($handlerOptions)) or a short foreach) or throw a clear
configuration error. Replace the direct access $path = $handlerOptions[0]; with
a guarded assignment that checks isset($handlerOptions[0]) &&
is_string($handlerOptions[0]) and otherwise finds a viable string value from
$handlerOptions, then proceed with the existing strpos(...) and subsequent file
checks using that validated $path in TaoMonolog.php.

In `@common/persistence/class.SqlPersistence.php`:
- Around line 107-112: Update the method signatures for
common_persistence_sql_Driver::query() and
common_persistence_sql_dbal_Driver::query() to match the SqlPersistence::query()
signature by adding the scalar and return type declarations: change the
$statement parameter to be type-hinted as string and add the return type
declaration : Result to the method signature; ensure the implementations (in
class common_persistence_sql_dbal_Driver and the interface
common_persistence_sql_Driver) and any PHPDoc remain consistent with the new
signature to satisfy PSR-12.

---

Nitpick comments:
In `@common/persistence/class.SqlPersistence.php`:
- Line 1: Add the strict types declaration to this PHP file by inserting
declare(strict_types=1); immediately after the opening <?php tag in
class.SqlPersistence.php so the SqlPersistence class and its newly tightened
method signatures are validated under strict typing rules; ensure there is a
blank line or newline after the declaration to keep file formatting consistent.

In `@core/kernel/api/class.ModelFactory.php`:
- Line 1: Add a strict types declaration to this PHP file by inserting
declare(strict_types=1); immediately after the opening <?php tag in
core/kernel/api/class.ModelFactory.php so the file (and the ModelFactory class)
enforces strict typing per project guidelines.

In `@scripts/tools/CleanUpOrphanFiles.php`:
- Line 1: Add the strict types declaration at the top of the PHP file
immediately after the opening PHP tag (<?php) by inserting
declare(strict_types=1); so the file uses strict typing; ensure it's the first
statement following the PHP open tag and before any other code or comments to
comply with the project's coding guidelines.

ℹ️ Review info

Configuration used: Path: https://raw.githubusercontent.com/oat-sa/tao-code-quality/main/coderabbit/php/authoring/v1/.coderabbit.yaml (via .coderabbit.yaml)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between fb3a13f and ed455c6.

📒 Files selected for processing (5)
  • common/oatbox/log/logger/TaoMonolog.php
  • common/persistence/class.SqlPersistence.php
  • core/kernel/api/class.ModelFactory.php
  • core/kernel/persistence/smoothsql/class.Resource.php
  • scripts/tools/CleanUpOrphanFiles.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • core/kernel/persistence/smoothsql/class.Resource.php

Co-authored-by: Karol-Stelmaczonek <118974926+Karol-Stelmaczonek@users.noreply.github.com>
Signed-off-by: Aleksej Tikhanovich <tihanovich.a@gmail.com>
@github-actions
Copy link
Copy Markdown

Version

❕ Some commits are not using the conventional commits formats. They will be ignored in version management.

Target Version 17.1.0
Last version 17.0.0

There are 0 BREAKING CHANGE, 5 features, 3 fixes

@tikhanovichA tikhanovichA merged commit cddd590 into develop Feb 26, 2026
6 checks passed
@tikhanovichA tikhanovichA deleted the feat/update-dependency-2 branch February 26, 2026 08:49
@coderabbitai coderabbitai bot mentioned this pull request Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants