Skip to content

Update#5

Merged
BrianHenryIE merged 6 commits into
masterfrom
update
Feb 13, 2026
Merged

Update#5
BrianHenryIE merged 6 commits into
masterfrom
update

Conversation

@BrianHenryIE

Copy link
Copy Markdown
Owner
  • Run Rector
  • PHPCS
  • PhpStan
  • composer update
  • Fix link in README

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @BrianHenryIE, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on comprehensive maintenance and modernization of the project's PHP dependencies and codebase. It brings all Composer packages up to date, removes deprecated or unused ones, and applies automated refactoring tools to leverage newer PHP language features. The changes aim to enhance code quality, improve maintainability, and ensure compatibility with current development standards.

Highlights

  • Dependency Updates: Numerous Composer dependencies have been updated to their latest versions, including composer/composer, phpstan/phpstan, rector/rector, lucatume/wp-browser, and szepeviktor/phpstan-wordpress. Several outdated or unused packages like Codeception modules, jaschilz/php-coverage-badger, kporras07/composer-symlinks, and cweagans/composer-patches have been removed.
  • Code Modernization (Rector): The codebase has been refactored using Rector, primarily applying PHP 8.0 and 8.1 features. This includes the adoption of constructor property promotion, conversion of anonymous functions to arrow functions (fn), and use of ::class constant for class names. String manipulation functions like str_contains and str_starts_with have replaced older strpos checks.
  • Improved Code Clarity and Maintainability: Constructor property promotion has been applied across several classes (Admin, BH_WP_Logger_Test_Plugin, Admin_Notices, AJAX, Logs_List_Table, Logs_Page, Plugin_Installer, Plugins_Page, API, PHP_Error_Handler, PHP_Shutdown_Handler, CLI, Cron, Functions, Init, Plugin_Logger_Actions), reducing boilerplate and improving readability. Unused properties have been removed from BH_WP_Logger_Test_Plugin.
  • README and Development Plugin Updates: The README.md file has been updated to correct a link. A new Development_Plugin_Settings class was introduced to centralize logger settings for the development plugin, replacing an anonymous class implementation.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • README.md
    • Updated the link for the PHPUnit coverage badge to point to the correct repository.
  • composer.json
    • Removed multiple Codeception modules, jaschilz/php-coverage-badger, kporras07/composer-symlinks, and phpcompatibility/phpcompatibility-wp from dev dependencies.
    • Updated lucatume/wp-browser to ^4.0 and szepeviktor/phpstan-wordpress to *.
    • Removed patches and composer-symlinks configurations from the extra section.
  • composer.lock
    • Updated content hash and numerous package versions to reflect changes in composer.json.
    • Removed entries for codeception/util-universalframework, cweagans/composer-configurable-plugin, cweagans/composer-patches, jaschilz/php-coverage-badger, and kporras07/composer-symlinks.
    • Added new packages like composer/class-map-generator, seld/signal-handler, symfony/polyfill-php81, symfony/polyfill-php84, and marc-mabe/php-enum.
    • Updated version constraints and references for composer/composer, composer/pcre, justinrainbow/json-schema, lucatume/wp-browser, phpstan/phpstan, react/promise, rector/rector, symfony/filesystem, szepeviktor/phpstan-wordpress, and wp-cli/wp-cli.
  • development-plugin/Admin/class-admin.php
    • Refactored the constructor to use PHP 8.1 constructor property promotion.
  • development-plugin/Includes/class-bh-wp-logger-development-plugin.php
    • Removed redundant property declarations for $logger and $settings.
    • Refactored the constructor to use PHP 8.1 constructor property promotion.
  • development-plugin/Includes/class-i18n.php
    • Updated dirname function call to use the second argument for depth instead of nested calls.
  • development-plugin/class-development-plugin-settings.php
    • Added a new file defining Development_Plugin_Settings class which implements Logger_Settings_Interface and uses Logger_Settings_Trait.
  • development-plugin/development-plugin.php
    • Replaced the anonymous class for $logger_settings with an instance of the new Development_Plugin_Settings class.
    • Converted an anonymous function in add_filter to an arrow function.
  • includes/admin/class-admin-notices.php
    • Refactored the constructor to use PHP 8.1 constructor property promotion and removed explicit property declarations.
  • includes/admin/class-ajax.php
    • Refactored the constructor to use PHP 8.1 constructor property promotion and removed explicit property declarations.
    • Updated PHPDoc for $settings parameter.
  • includes/admin/class-logs-list-table.php
    • Removed explicit property declarations for $logger, $settings, and $api.
    • Refactored the constructor to use PHP 8.1 constructor property promotion.
    • Simplified the catch block for DateTimeImmutable exception.
    • Converted an anonymous function in array_filter to an arrow function.
  • includes/admin/class-logs-page.php
    • Removed explicit property declarations for $settings and $api.
    • Refactored the constructor to use PHP 8.1 constructor property promotion.
    • Replaced substr string comparison with str_ends_with for checking page suffix.
  • includes/admin/class-plugin-installer.php
    • Refactored the constructor to use PHP 8.1 constructor property promotion and removed explicit property declarations.
  • includes/admin/class-plugins-page.php
    • Refactored the constructor to use PHP 8.1 constructor property promotion and removed explicit property declarations.
    • Updated PHPDoc for $api and $settings parameters.
  • includes/api/class-api.php
    • Removed explicit property declaration for $settings.
    • Refactored the constructor to use PHP 8.1 constructor property promotion.
    • Simplified debug_backtrace call by removing the false argument.
    • Replaced false !== strpos with str_contains for string checks.
    • Replaced 0 === strpos with str_starts_with for string checks.
    • Simplified the catch block for DateTimeImmutable exception.
  • includes/api/class-bh-wp-psr-logger.php
    • Refactored the constructor to use PHP 8.1 constructor property promotion.
    • Replaced get_class($exception) with $exception::class for obtaining class names.
    • Converted list() array destructuring to short array syntax.
  • includes/class-logger.php
    • Updated the return type hint for the instance method to include LoggerInterface.
    • Replaced settings = $settings ?? new class() with settings ??= new class() using the null coalescing assignment operator.
    • Refactored the anonymous class constructor within instance to use PHP 8.1 constructor property promotion.
  • includes/interface-api-interface.php
    • Updated the type hint for $value in set_common_context to mixed.
    • Updated the return type hint for get_backtrace to a more specific array shape.
  • includes/php/class-php-error-handler.php
    • Removed explicit property declarations for $api and $settings.
    • Refactored the constructor to use PHP 8.1 constructor property promotion.
    • Replaced false !== strpos with str_contains for string checks.
  • includes/php/class-php-shutdown-handler.php
    • Removed explicit property declarations for $api and $settings.
    • Refactored the constructor to use PHP 8.1 constructor property promotion.
    • Updated PHPDoc for $api and $settings parameters.
  • includes/trait-logger-settings-trait.php
    • Simplified the catch block for Exception.
    • Improved the logic in get_plugin_basename to handle cases where get_plugins might return multiple plugins.
  • includes/wp-includes/class-cli.php
    • Removed explicit property declarations for $settings and $api.
    • Refactored the constructor to use PHP 8.1 constructor property promotion.
  • includes/wp-includes/class-cron.php
    • Removed explicit property declarations for $settings and $api.
    • Refactored the constructor to use PHP 8.1 constructor property promotion.
    • Updated PHPDoc for $api and $settings parameters.
  • includes/wp-includes/class-functions.php
    • Removed explicit property declarations for $api and $settings.
    • Refactored the constructor to use PHP 8.1 constructor property promotion.
    • Renamed $function parameter to $function_name in log_deprecated_functions_only_once_per_day, log_deprecated_arguments_only_once_per_day, and log_doing_it_wrong_only_once_per_day for clarity.
    • Converted anonymous functions in log_deprecated_functions_only_once_per_day to arrow functions.
  • includes/wp-includes/class-init.php
    • Removed explicit property declarations for $api and $settings.
    • Refactored the constructor to use PHP 8.1 constructor property promotion.
    • Replaced 0 !== strpos with str_starts_with for string checks.
  • includes/wp-includes/class-plugin-logger-actions.php
    • Removed explicit property declarations for $wrapped_real_logger, $settings, and $api.
    • Refactored the constructor to use PHP 8.1 constructor property promotion.
    • Updated PHPDoc for constructor parameters.
  • rector.php
    • Added FirstClassCallableRector to the list of applied Rectors.
    • Changed the withPhpSets configuration from php84: true to php80: true.
  • tests/unit/admin/class-ajax-unit-Test.php
    • Converted anonymous functions in Expected::once calls to arrow functions.
  • tests/unit/api/class-api-unit-Test.php
    • Converted anonymous function in Patchwork\redefine to an arrow function.
  • tests/unit/class-plugin-unit-Test.php
    • Converted anonymous function in Patchwork\redefine to an arrow function.
  • tests/unit/php/class-php-shutdown-handler-unit-Test.php
    • Simplified the catch block for Exception.
    • Converted anonymous functions in Patchwork\redefine calls to arrow functions.
  • tests/wpunit/api/class-bh-wp-psr-logger-wpunit-Test.php
    • Converted anonymous function in add_filter to an arrow function.
  • tests/wpunit/class-logger-wpunit-Test.php
    • Converted anonymous functions in add_filter to arrow functions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request primarily focuses on modernizing the codebase by running Rector, which introduced PHP 8 features like constructor property promotion and arrow functions. It also includes dependency updates via composer update and fixes a link in the README. The changes significantly improve code conciseness and readability. I've found a couple of minor issues to address, mainly related to leftover code from refactoring and a hardcoded path in the development plugin.

Comment on lines 89 to 92
add_filter(
'plugins_url',
function ( $url ) {
return str_replace( 'Users/brianhenry/Sites', 'bh-wp-logger-development-plugin/vendor/brianhenryie', $url );
}
fn( $url ) => str_replace( 'Users/brianhenry/Sites', 'bh-wp-logger-development-plugin/vendor/brianhenryie', $url )
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

This filter contains a hardcoded local file path (Users/brianhenry/Sites). This is not portable and can cause issues for other developers or in different environments. This filter should probably be removed, or made conditional (e.g., based on an environment variable or a constant defined in a local config file) if it's necessary for local development.

use Psr\Log\LogLevel;

class Development_Plugin_Settings implements Logger_Settings_Interface {
// }, WooCommerce_Logger_Settings_Interface {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This commented-out line appears to be a leftover from refactoring. It should be removed to keep the code clean.

@github-actions

Copy link
Copy Markdown

Project Code Coverage
project coverage report 42% @ 19af233

Generated: Fri, Feb 13, 2026, 21:54:01 UTC.

Lines Functions and Methods Classes and Traits
Total 🟥🟥🟥🟥⬜⬜⬜⬜⬜⬜ 43.36% (359 / 828) 🟥🟥⬜⬜⬜⬜⬜⬜⬜⬜ 29.55% (26 / 88) 🟥🟥⬜⬜⬜⬜⬜⬜⬜⬜ 25.00% (4 / 16)
admin/class-admin-notices.php 🟥⬜⬜⬜⬜⬜⬜⬜⬜⬜ 15.00% (6 / 40) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 4) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 1)
admin/class-ajax.php 🟧🟧🟧🟧🟧🟧🟧⬜⬜⬜ 70.00% (14 / 20) 🟥🟥🟥⬜⬜⬜⬜⬜⬜⬜ 33.33% (1 / 3) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 1)
admin/class-logs-list-table.php 🟥🟥🟥⬜⬜⬜⬜⬜⬜⬜ 30.49% (25 / 82) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 9) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 1)
admin/class-logs-page.php 🟥🟥⬜⬜⬜⬜⬜⬜⬜⬜ 24.21% (23 / 95) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 5) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 1)
admin/class-plugin-installer.php 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 100.00% (7 / 7) 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 100.00% (2 / 2) 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 100.00% (1 / 1)
admin/class-plugins-page.php 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 100.00% (13 / 13) 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 100.00% (2 / 2) 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 100.00% (1 / 1)
api/class-api.php 🟥🟥⬜⬜⬜⬜⬜⬜⬜⬜ 27.27% (48 / 176) 🟥🟥⬜⬜⬜⬜⬜⬜⬜⬜ 21.05% (4 / 19) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 1)
api/class-bh-wp-psr-logger.php 🟧🟧🟧🟧🟧🟧🟧⬜⬜⬜ 78.12% (50 / 64) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 4) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 1)
php/class-php-error-handler.php 🟧🟧🟧🟧🟧🟧🟧⬜⬜⬜ 75.00% (39 / 52) 🟥🟥🟥⬜⬜⬜⬜⬜⬜⬜ 33.33% (2 / 6) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 1)
php/class-php-shutdown-handler.php 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 100.00% (9 / 9) 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 100.00% (3 / 3) 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 100.00% (1 / 1)
wp-includes/class-cron.php 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 100.00% (13 / 13) 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 100.00% (3 / 3) 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 100.00% (1 / 1)
wp-includes/class-functions.php 🟥⬜⬜⬜⬜⬜⬜⬜⬜⬜ 19.30% (22 / 114) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 5) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 1)
wp-includes/class-init.php 🟥🟥🟥🟥⬜⬜⬜⬜⬜⬜ 41.30% (19 / 46) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 3) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 1)
wp-includes/class-plugin-logger-actions.php 🟧🟧🟧🟧🟧🟧⬜⬜⬜⬜ 65.38% (34 / 52) 🟥🟥🟥🟥⬜⬜⬜⬜⬜⬜ 46.15% (6 / 13) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 1)
class-logger.php 🟩🟩🟩🟩🟩🟩🟩🟩🟩⬜ 93.94% (31 / 33) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 2) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 1)
trait-logger-settings-trait.php 🟥🟥🟥🟥🟥⬜⬜⬜⬜⬜ 50.00% (6 / 12) 🟧🟧🟧🟧🟧🟧⬜⬜⬜⬜ 60.00% (3 / 5) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 1)

phpcov 8.2.1 by Sebastian Bergmann.

Unable to detect executable lines that were changed.
Are you sure your --path-prefix is correct?

@BrianHenryIE BrianHenryIE merged commit becb710 into master Feb 13, 2026
5 of 7 checks passed
@BrianHenryIE BrianHenryIE deleted the update branch March 25, 2026 03:54
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