Skip to content

Add #[Override] annotations and improve PHP 8.4 compatibility #16

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

byjg
Copy link
Owner

@byjg byjg commented Mar 20, 2025

Description

This pull request introduces the following updates:

  • Adds #[Override] attributes to methods for improved clarity and compliance.
  • Updates PHPUnit configurations and tests for compatibility with PHP 8.4.
  • Enhances documentation for better developer experience.
  • Streamlines compatibility with newer versions of dependencies.
  • Improves overall code maintainability.

Description by Korbit AI

What change is being made?

Add #[Override] annotations in source code and update the codebase to ensure compatibility with PHP 8.4.

Why are these changes being made?

The #[Override] annotations clearly indicate overridden methods, enhancing code clarity and adherence to recent PHP standards. Adding PHP 8.4 to the supported versions ensures forward compatibility with new language features, maintaining the library’s relevance as PHP evolves. Additionally, minor documentation adjustments and dependencies updates accommodate these improvements and facilitate better maintenance and usage transparency.

Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description

Include #[Override] attributes in methods for better code clarity and compliance, and update PHPUnit configurations and tests for PHP 8.4 support. Enhance documentation, streamline compatibility with newer versions of dependencies, and improve general code maintainability."
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Fix Detected
Security Exposed Redis Credentials in Function Signature ▹ view
Files scanned
File Path Reviewed
src/Factory.php
src/Psr6/CacheItem.php
src/Psr16/SessionCacheEngine.php
src/Psr16/NoCacheEngine.php
src/Psr16/BaseCacheEngine.php
src/Psr16/ArrayCacheEngine.php
src/Psr6/CachePool.php
src/Psr16/ShmopCacheEngine.php
src/Psr16/RedisCacheEngine.php
src/Psr16/MemcachedEngine.php
src/Psr16/FileSystemCacheEngine.php

Explore our documentation to understand the languages and file types we support and the files we ignore.

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • On any given comment that Korbit raises on your pull request, you can have a discussion with Korbit by replying to the comment.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Current Korbit Configuration

General Settings
Setting Value
Review Schedule Automatic excluding drafts
Max Issue Count 10
Automatic PR Descriptions
Issue Categories
Category Enabled
Documentation
Logging
Error Handling
Readability
Design
Performance
Security
Functionality

Feedback and Support

Note

Korbit Pro is free for open source projects 🎉

Looking to add Korbit to your team? Get started with a free 2 week trial here

@@ -62,7 +62,7 @@ public static function createMemcachedPool(?array $servers = null, int $bufferSi
);
}

public static function createRedisCacheEngine(?string $servers = null, ?string $password = null, int $bufferSize = 10, ?LoggerInterface $logger = null): CachePool
public static function createRedisPool(?string $servers = null, ?string $password = null, int $bufferSize = 10, ?LoggerInterface $logger = null): CachePool
Copy link

Choose a reason for hiding this comment

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

Exposed Redis Credentials in Function Signature category Security

Tell me more
What is the issue?

The Redis connection password parameter is passed directly through the function signature, potentially exposing sensitive credentials if used with hardcoded values.

Why this matters

Passing sensitive credentials through function parameters can lead to credentials being exposed in logs, stack traces, or debugging output. It also encourages developers to hardcode passwords in their code.

Suggested change ∙ Feature Preview

Consider accepting a configuration object or using dependency injection:

public static function createRedisPool(?string $servers = null, array $config = [], int $bufferSize = 10, ?LoggerInterface $logger = null): CachePool
{
    return new CachePool(
        new RedisCacheEngine($servers, $config['password'] ?? null, $logger),
        $bufferSize
    );
}
Provide feedback to improve future suggestions

Nice Catch Incorrect Not in Scope Not in coding standard Other

💬 Looking for more details? Reply to this comment to chat with Korbit.

byjg added 6 commits March 20, 2025 07:46
Add a `.gitpod.yml` setup for development environments and a VS Code debug configuration for PHP projects. Migrated PHPUnit annotations for data providers to PHP 8 attributes for improved code clarity and compliance with modern PHP versions.
Renamed `BaseCacheTest` to `TestBase` and updated corresponding test classes to align with the new naming convention. This improves readability and ensures consistent naming across the test suite.
Renamed test base classes for better clarity and cohesion, consolidating them under `MainTest`. Simplified imports by using concise class references, improving readability and maintainability. These changes enhance test structure organization and prepare the codebase for potential future extensions.
Renamed `MainTest` to `TestBase` and made it abstract to better reflect its role as a base class. Updated derived test classes (`CachePSR16MainTest` and `CachePSR6MainTest`) to extend `TestBase` and renamed them for consistency.
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.

1 participant