Modernize codebase for PHP 8.5+ and fix five known bugs - #20
Modernize codebase for PHP 8.5+ and fix five known bugs#20tecpromotion 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
|
Hmm, to be honest, I can't keep up with all the changes that have been made here. In some cases, the code seems to have been changed quite significantly, even though I understand that it's already running on our setup right? Will cc also @wojsmol so he is aware that we are working here on a PHP 8.5+ only version which, from my understanding will no longer work on hosts lower than PHP 8.5 right? |
I was already incurring additional costs of over €100 a year for the old 7.4 version, so with Claude’s help I managed to get it up to a usable standard. |
|
Didnt want to say that we are not doing it just mean to cc him in as he is also using that bot for his setup |
|
@tecpromotion I took another close look at the code and think it looks fine for now. Especially since the code has already been running like this for a few weeks. But I've noticed that since April 30, I haven't been getting any updates from the JGerman bot did you remove me from that list? Or just does the telegram notification not work? |
|
As confirmed via Mattermost the messages are now comming to my channel again. I would suggest to await one final test whether the message is still correct when an upstream PR has been merged an an Issue has been created. Once that is confirmed i would reccommend to merge here. @wojsmol as you have not commented here yet can you please confirm that your proccess will not break with the new requirementes of PHP version we will deploy this once this is merged? Thanks |
|
@zero-24 I use older version and working on moving drom a standard server to a GHA for that bot - also with Claude. |
| define('GITHUB_TRANSLATION_REPO', ''); | ||
| define('GITHUB_TRANSLATION_LABEL', ''); | ||
| define('GITHUB_TRANSLATION_ASSIGMENTS', ''); | ||
| define('GITHUB_TRANSLATION_ASSIGMENTS', []); |
There was a problem hiding this comment.
| define('GITHUB_TRANSLATION_ASSIGMENTS', []); | |
| define('GITHUB_TRANSLATION_ASSIGNMENTS', []); |
There was a problem hiding this comment.
@tecpromotion Auch hier kannst du den typo noch an allen stellen im PR fixen? Oder soll ich dir einen PR schicken? aktuell klappt es da es an allen stellen falsch ist nur das anpassen hier reicht dann nicht aus.
|
@tecpromotion Additional typo find during a refactor for GHA - show in one place but there is more. |
| $options->set('translation.repo', GITHUB_TRANSLATION_REPO); | ||
| $options->set('translation.label', GITHUB_TRANSLATION_LABEL); | ||
| $options->set('translation.assigments', GITHUB_TRANSLATION_ASSIGMENTS); | ||
| $options->set('translation.templagebody', GITHUB_TRANSLATION_TEMPLATE_BODY); |
There was a problem hiding this comment.
| $options->set('translation.templagebody', GITHUB_TRANSLATION_TEMPLATE_BODY); | |
| $options->set('translation.templatebody', GITHUB_TRANSLATION_TEMPLATE_BODY); |
There was a problem hiding this comment.
@tecpromotion kannst du den typo noch an allen stellen im PR fixen? Oder soll ich dir einen PR schicken? aktuell klappt es da es an allen stellen falsch ist nur das anpassen hier reicht nicht aus.
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.