Skip to content

Fix newly reported PHPStan error#896

Merged
swissspidy merged 2 commits intomainfrom
fix/phpstan
Mar 7, 2026
Merged

Fix newly reported PHPStan error#896
swissspidy merged 2 commits intomainfrom
fix/phpstan

Conversation

@swissspidy
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings March 7, 2026 07:34
@swissspidy swissspidy requested a review from a team as a code owner March 7, 2026 07:34
@github-actions
Copy link

github-actions bot commented Mar 7, 2026

Hello! 👋

Thanks for opening this pull request! Please check out our contributing guidelines. We appreciate you taking the initiative to contribute to this project.

Contributing isn't limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.

Here are some useful Composer commands to get you started:

  • composer install: Install dependencies.
  • composer test: Run the full test suite.
  • composer phpcs: Check for code style violations.
  • composer phpcbf: Automatically fix code style violations.
  • composer phpunit: Run unit tests.
  • composer behat: Run behavior-driven tests.

To run a single Behat test, you can use the following command:

# Run all tests in a single file
composer behat features/some-feature.feature

# Run only a specific scenario (where 123 is the line number of the "Scenario:" title)
composer behat features/some-feature.feature:123

You can find a list of all available Behat steps in our handbook.

@github-actions github-actions bot added enhancement New feature or request scope:testing labels Mar 7, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello, 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 primarily addresses a static analysis issue identified by PHPStan, ensuring better code quality and maintainability. Concurrently, it performs a comprehensive update of various Composer dependencies, bringing the project's third-party libraries up to date. These changes collectively enhance the stability and future compatibility of the codebase.

Highlights

  • PHPStan Error Fix: Resolved a newly reported PHPStan error by adding a PHPDoc type hint for the $new_version variable in utils/make-phar.php.
  • Dependency Updates: Updated numerous Composer dependencies to their latest versions in composer.lock, including composer/composer, gettext/languages, justinrainbow/json-schema, phpstan/phpstan, and several WP-CLI related packages.
  • WP-CLI Command Additions: Introduced new command entries for block type exists and site-health within the composer.lock file, reflecting updates in WP-CLI packages.
Changelog
  • composer.lock
    • Updated composer/composer from 2.9.3 to 2.9.5.
    • Updated gettext/languages from 2.12.1 to 2.12.2.
    • Updated justinrainbow/json-schema from 6.6.3 to v6.7.2.
    • Updated wp-cli/ability-command to require wp-cli/wp-cli:^2.13.
    • Updated wp-cli/block-command to require wp-cli/wp-cli:^2.13 and added block type exists command.
    • Updated wp-cli/site-health-command and added site-health command.
    • Updated phpstan/phpstan from 1.12.32 to 1.12.33.
    • Updated roave/security-advisories with numerous new and updated version constraints for various packages, including aimeos/aimeos-laravel, alextselegidis/easyappointments, algolia/algoliasearch-magento-2, altcha-org/altcha, amphp/http-server, auth0/*, aws/aws-sdk-php, bagisto/bagisto, cadmium-org/cadmium-cms, cakephp/cakephp, cesargb/laravel-magiclink, ci4-cms-erp/ci4ms, composer/composer, concrete5/concrete5, coreshop/core-shop, cpsit/typo3-mailqueue, craftcms/*, croogo/croogo, devcode-it/openstamanager, directorytree/imapengine, drupal/core, ec-cube/ec-cube, egroupware/egroupware, ezsystems/ezplatform-kernel, ezsystems/ezpublish-kernel, facturascripts/facturascripts, firebase/php-jwt, fof/pretty-mail, frosh/adminer-platform, froxlor/froxlor, funadmin/funadmin, getformwork/formwork, getkirby/cms, grumpydictator/firefly-iii, idno/known, kimai/kimai, laravel/reverb, lavalite/cms, league/commonmark, librenms/librenms, livewire-filemanager/filemanager, mautic/core, microweber/microweber, mineadmin/mineadmin, moodle/moodle, october/system, openmage/magento-lts, paragonie/sodium_compat, ph7software/ph7builder, phpmyfaq/phpmyfaq, phpunit/phpunit, phraseanet/phraseanet, pimcore/*, prestashop/prestashop, psy/psysh, pterodactyl/panel, redaxo/source, shopware/*, snipe/snipe-it, solspace/craft-freeform, statamic/cms, symfony/process, symfony/symfony, thorsten/phpmyfaq, typicms/core, typo3/cms-backend, typo3/cms-core, typo3/cms-recycler, typo3/cms-redirects, vrana/adminer, winter/wn-cms-module, wwbn/avideo, yourls/yourls, and zumba/json-serializer.
  • utils/make-phar.php
    • Added a PHPDoc @var annotation for the $new_version variable to satisfy PHPStan's type checking requirements.
Activity
  • The pull request was opened by swissspidy.
  • No specific human activity (comments, reviews, etc.) has been recorded on this pull request yet.
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.

Copy link

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

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 updates several dependencies, including phpstan/phpstan, to resolve a static analysis error, and modifies utils/make-phar.php to address it. The dependency updates are appropriate. My review focuses on the code change, for which I've suggested a more robust and idiomatic alternative.

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 fixes a newly reported PHPStan static analysis error in the make-phar.php utility script by adding a @var type annotation for a variable whose type could not be inferred, and simultaneously updates composer.lock with refreshed dependency versions.

Changes:

  • Added a @var string $new_version PHPDoc annotation in utils/make-phar.php to help PHPStan narrow the type of $new_version (previously inferred as mixed from $runtime_config['version']) before it is passed to Utils\increment_version().
  • Updated composer.lock with bumped versions for several dependencies (including composer/composer, phpstan/phpstan, justinrainbow/json-schema, gettext/languages, and various wp-cli/* commands) and an expanded Roave/SecurityAdvisories conflict list.

Reviewed changes

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

File Description
utils/make-phar.php Adds a @var string $new_version PHPDoc annotation before the assignment of $runtime_config['version'] to satisfy PHPStan's type checking at level 9. Pattern is consistent with existing @var annotations in the same file (e.g., line 132–134).
composer.lock Routine dependency updates: bumps several packages to their latest patch/minor releases and refreshes the Roave/SecurityAdvisories conflict list.

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

You can also share your feedback on Copilot code review. Take the survey.

@swissspidy swissspidy merged commit 3dc4318 into main Mar 7, 2026
68 checks passed
@swissspidy swissspidy deleted the fix/phpstan branch March 7, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request scope:testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants