Skip to content

Conversation

@samdark
Copy link
Member

@samdark samdark commented Dec 21, 2025

Q A
Is bugfix?
New feature?
Breaks BC?

Copilot AI review requested due to automatic review settings December 21, 2025 13:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR performs code cleanup by modernizing PHP syntax and improving code style consistency across the codebase. The changes focus on using fully qualified class names from imports, updating attribute syntax, and adding proper type hints.

Key changes:

  • Replaced #[\Override] with #[Override] after adding proper use Override; imports
  • Added type hints to static properties (e.g., public static $DRIVERpublic static ?string $DRIVER)
  • Replaced fully qualified class names with imported aliases (e.g., \ArrayIteratorArrayIterator, \ReflectionMethodReflectionMethod)
  • Updated EntityWriter constructor to use readonly property promotion
  • Simplified string interpolation syntax from {$var} to $var in test assertions
  • Replaced deprecated Handler class reference with HandlerInterface

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/Unit/Sqlite/Reader/FilterHandler/SqliteLikeHandlerTest.php Added type hint to static $DRIVER property
tests/Unit/Reader/EntityReaderTest.php Added ReflectionMethod import and replaced fully qualified name
tests/Unit/Reader/Cache/CachedCountTest.php Added Countable import and replaced fully qualified name
tests/Unit/Reader/Cache/CachedCollectionTest.php Added ArrayIterator import, replaced fully qualified names, removed Generator type assertion
tests/Unit/Mssql/Reader/FilterHandler/SqlServerLikeHandlerTest.php Added type hint to static $DRIVER property
tests/Feature/DataTrait.php Added type hint to $DRIVER property, updated Handler to HandlerInterface
tests/Feature/Base/Writer/BaseEntityWriterTestCase.php Added iterator_to_array function import and replaced fully qualified calls
tests/Feature/Base/Reader/ReaderWithFilter/BaseReaderWithOrXTestCase.php Simplified string interpolation syntax in assertions
tests/Feature/Base/Reader/ReaderWithFilter/BaseReaderWithAllTestCase.php Simplified string interpolation syntax in assertions
src/Writer/EntityWriter.php Added Override import, updated attribute syntax, added readonly to constructor property
src/Reader/FilterHandler/OrXHandler.php Added Override import and updated attribute syntax
src/Reader/FilterHandler/NotHandler.php Added Override import and updated attribute syntax
src/Reader/FilterHandler/NoneHandler.php Added Override import and updated attribute syntax
src/Reader/FilterHandler/LikeHandler/SqliteLikeHandler.php Added Override import and updated attribute syntax
src/Reader/FilterHandler/LikeHandler/SqlServerLikeHandler.php Added Override import and updated attribute syntax
src/Reader/FilterHandler/LikeHandler/PostgresLikeHandler.php Added Override import and updated attribute syntax
src/Reader/FilterHandler/LikeHandler/MysqlLikeHandler.php Added Override import and updated attribute syntax
src/Reader/FilterHandler/LikeHandler/BaseLikeHandler.php Added Override import and updated attribute syntax
src/Reader/FilterHandler/LessThanOrEqualHandler.php Added Override import and updated attribute syntax
src/Reader/FilterHandler/LessThanHandler.php Added Override import and updated attribute syntax
src/Reader/FilterHandler/InHandler.php Added Override import and updated attribute syntax
src/Reader/FilterHandler/GreaterThanOrEqualHandler.php Added Override import and updated attribute syntax
src/Reader/FilterHandler/GreaterThanHandler.php Added Override import and updated attribute syntax
src/Reader/FilterHandler/EqualsNullHandler.php Added Override import and updated attribute syntax
src/Reader/FilterHandler/EqualsHandler.php Added Override import and updated attribute syntax
src/Reader/FilterHandler/BetweenHandler.php Added Override import and updated attribute syntax
src/Reader/FilterHandler/AndXHandler.php Added Override import and updated attribute syntax
src/Reader/FilterHandler/AllHandler.php Added Override import and updated attribute syntax
src/Reader/EntityReader.php Added Override import and updated attribute syntax
src/Reader/Cache/CachedCollection.php Added Generator import and replaced fully qualified return type

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

$cachedCollection->setCollection($collection);

$this->assertInstanceOf(\Generator::class, $cachedCollection->getGenerator());
$this->assertSame(['foo'], iterator_to_array($cachedCollection->getGenerator()));
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

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

A test assertion was removed that verified the return type of getGenerator() is a Generator. This reduces test coverage by removing validation of the method's return type. Consider keeping this assertion to maintain comprehensive test coverage.

Copilot uses AI. Check for mistakes.
use Cycle\Database\DatabaseManager;
use Cycle\Database\DatabaseProviderInterface;
use Cycle\Database\Driver\Handler;
use Cycle\Database\Driver\HandlerInterface;
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

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

The old import statement for Handler is no longer used after replacing Handler::DROP_FOREIGN_KEYS with HandlerInterface::DROP_FOREIGN_KEYS. This unused import should be removed as part of the cleanup.

Suggested change
use Cycle\Database\Driver\HandlerInterface;

Copilot uses AI. Check for mistakes.
@samdark samdark closed this Dec 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants