Modernize codebase for PHP 8.5+ and fix five known bugs#20
Open
tecpromotion wants to merge 3 commits into
Open
Modernize codebase for PHP 8.5+ and fix five known bugs#20tecpromotion wants to merge 3 commits into
tecpromotion wants to merge 3 commits into
Conversation
Replace the four per-event notifier posts (Start / count / date / End) plus the per-issue messages with one consolidated message sent at the end of the run. Slack and Mattermost get an attachment with a colored bar — green on success, yellow when the daily guard skipped the run. Telegram keeps a plain-text variant with HTML links. - Add RunStatus + RunSummary under joomlagerman\Notification\ - NotificationChannel::summaryPayload() builds the channel payload - NotifyerHelper exposes a single sendRunSummary() method - Drop the unused NOTIFYER_GITHUB_ISSUE_MESSAGE_TEMPLATE constant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Modernizes the bot to run on PHP 8.5+ idiomatically, bumps the Joomla framework dependencies from
^1/~1to^4, fixes five long-standing bugs, and introduces a small tooling stack (PHPStan max, PHP-CS-Fixer, PHPUnit). The architecture stays the same: CLI entry point + helpers, configured viaincludes/constants.php.Verified end-to-end on a production-equivalent server running PHP 8.5.5 — both the once-a-day guard path and the full GitHub-API-fetch path execute cleanly.
⚠ Breaking Changes
composer.jsonplatform constraint).vendor/is no longer committed. Installations must runcomposer install --no-devafter pulling.includes/constants.phpfiles must be updated:NOTIFYER_SLACK_ENABED→NOTIFYER_SLACK_ENABLEDNOTIFYER_MATTERMOST_ENABED→NOTIFYER_MATTERMOST_ENABLEDNOTIFYER_TELEGRAM_ENABED→NOTIFYER_TELEGRAM_ENABLEDincludes/github-base.phpwas removed — replaced byjoomlagerman\Helper\Bootstrap. Anyone embedding the bot from custom CLI scripts must update accordingly.Bug fixes
getLatestGithubReleaseByBranch(): theversion_comparecheck picked the oldest matching tag instead of the newest. Now extracted into a pure, unit-tested static helperGithubApiHelper::pickLatestTag().lastrelease<branch>.datawas initialized with<branch>.0v0instead of<branch>.0.0.substr($targetBranch, 0, 3)mangled4.10-devintoJoomla! 4.1. Now handled byjoomlagerman\Enum\JoomlaBranch::labelFor(), with explicit tests for historical (3.10-dev,4.10-dev) and modern (5.4-dev,6.1-dev,6.4-dev) branches.Registryimport inNotifyerHelper: a fallback path referencednew Registrywithoutuse Joomla\Registry\Registry;.getSourcePullDiff()readGITHUB_AUTHTOKENdirectly instead of going through the options Registry. The token is now wired in viaBootstrap.PHP 8.5+ modernization
declare(strict_types=1)in every PHP file.finalclasses,readonlyproperties, constructor property promotion.matchexpressions for the notifier channel routing.joomlagerman\Enum\NotificationChannel(Slack/Mattermost/Telegram) — each case carries its ownisEnabled(),endpoint(),payload(). Replaces three near-duplicateif-blocks.joomlagerman\Enum\JoomlaBranch— pure branch-label parsing.\DateTimeImmutableinstead of\DateTime.joomlagerman\Helper\Bootstrapfactory replaces therequire-with-side-effects pattern inincludes/github-base.php. The CLI script stays procedural but is now type-safe.optString()); no more(string) $registry->get(...)casts onmixedvalues.HttpFactory::getHttp()was previously called statically, which fatals on PHP 8.4+. Now(new HttpFactory())->getHttp().Dependency bumps
php7.3^8.5joomla/github^1.7^4.0joomla/http~1.3^4.0joomla/registry^4.0joomla/uri^4.0Includes a small adapter for the PSR-7 response shape that
joomla/http 4.xexposes ($response->getBody()instead of the old$response->body).Tooling
composer test— PHPUnit 11, 14 tests covering branch-label parsing, latest-tag selection (incl. the bug-A fix), notifier channel routing.composer stan— PHPStan atlevel: max, 0 errors.composer cs-check/composer cs-fix— PHP-CS-Fixer with PSR-12 + tab indent (matching.editorconfig).tools/phpstan-stubs/constants.stub.php— type stubs so PHPStan knows the runtime constants.Migration guide for existing deployments
Test plan
composer test— 14/14 greencomposer stan—[OK] No errorscomposer cs-check— cleanNotes
joomla/github 4.0.1andjoomla/http 4.0.2emit a handful ofE_DEPRECATEDwarnings on PHP 8.5 (implicitly nullable parameters, dynamic property creation). These are upstream issues in those packages, not introduced by this PR. They will not break execution on PHP 8.5 but will need fixing before PHP 9.setOption()on the helpers is unused externally. Kept in place for now; can be deprecated/removed in a follow-up if there are no embedders.