Repository navigation
chore(tooling): adopt pekral checkers, ai-olympus and supported PHP versions - #48
Merged
Merged
Conversation
…ersions Replace phing, the local slevomat ruleset and PHPStan 1 with pekral/phpcs-rules, pekral/phpstan-rules (PHPStan 2, level max) and pekral/rector-rules, all pinned to the PHP 8.2 minimum. Install pekral/ai-olympus as a dev dependency; its generated agent files are git-ignored. Make the code pass the new checkers: narrow untyped JSON data, fix the Method::get() calls left over from the enum migration, make operator conversion independent of key order, and point phpunit.xml at tests/. Replace the PHP 8.0 build workflow with checks on PHP 8.4/8.5 and a runtime lint/resolve job on PHP 8.2/8.3.
pekral
marked this pull request as ready for review
November 12, 2026 13:21
This was referenced Nov 12, 2026
Collaborator
Author
Code ReviewStatus: clean Summary: 0 Critical · 0 Moderate · 0 Minor · 0 Refactoring · assignment conformance: no linked issue · reviewer comments: none · no linked issue — issue summary skipped |
CR finding: "Refactored HTTP/response layer has no test coverage in CI" (part 1 of 2: the seams the tests need). - Client and CompanyClient accept an optional HttpClient, so tests can replace the network boundary with a double. - HttpClient is no longer final/readonly: Mockery cannot double either. - cURL options are built by the new CurlOptionsFactory as a plain array, which tests can assert without executing a request. Behavior is unchanged.
…client CompanyClient built its parent Client without the debug flag from the given Config, so debug mode (request headers in Forbidden errors) never worked for company-level calls such as backup() and restore().
CR finding: "TLS verification is forced off whenever session auth is used". Requests carrying X-authSessionId disabled CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST even when the caller asked for verification, exposing the session token to a man-in-the-middle. Verification now follows the verifySSLCertificate option for every auth method.
CR finding: "JSON encoding failure now escapes as a non-domain JsonException". Post fields that cannot be JSON-encoded (e.g. invalid UTF-8) now raise EcomailFlexibeeRequestFail with the JsonException as previous, so callers handling the package exceptions also handle this failure.
CR finding: "Empty-URL guard hidden inside a curl_setopt() argument". The check now runs first, before any cURL option is built, instead of being an inline throw expression inside the option list.
CR finding: "Refactored HTTP/response layer has no test coverage in CI" (part 2 of 2: the tests). Unit tests for ResponseFactory, ResponseHydrator, CurlOptionsFactory, HttpClient (through a local file:// fixture) and Client (through a Mockery double of HttpClient). Every line changed in src/ by this pull request is now covered by `composer test`.
CR finding (iteration 2): CurlOptionsFactory::create() took six parameters, above the four-parameter limit in the PHP core standards. The request part now travels as the CurlRequest DTO; the public HttpCurlBuilder::build() signature stays unchanged.
Collaborator
Author
CR status — convergedStatus: converged · Critical 0 · Moderate 0 · Minor 0 Resolved items
|
This was referenced Nov 12, 2026
CR finding (Minor): "E_DEPRECATED is silenced for the whole test run". The global error_reporting override in phpunit.xml hid deprecations from this package's own code. Its main source, the abandoned rakit/validation, was used for a single rule (code: max 20 characters, uppercase), which ParameterValidator now checks with mb_strlen()/mb_strtoupper(). The override is gone; tests/bootstrap.php only loads Purl\AbstractPart with E_DEPRECATED off until ecomailcz/purl is removed (#49). BREAKING CHANGE: ParameterValidator no longer extends Rakit\Validation\Validator and EcomailFlexibeeInvalidRequestParameter no longer takes a Rakit\Validation\Validation; it is a plain exception.
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.
TL;DR
Balíček přechází na nástroje pekral (phpcs-rules, phpstan-rules, rector-rules) a na
pekral/ai-olympus. Podporuje jen aktuálně udržované verze PHP: 8.2–8.5. Kód je upravený tak, aby všechny checkery prošly, a přitom zůstal kompatibilní s PHP 8.2.Změny
Nástroje (dev závislosti)
pekral/ai-olympus^0.4,pekral/phpcs-rules,pekral/phpstan-rules,pekral/rector-rules(všechnydev-master, jako v oficiálních repozitářích) arector/rector^2.8.^1.10→^2.1(deprecation-rules^2.0, phpunit^2.0). Úroveňmax, analyzujesrcitests, rozsah PHP 8.2–8.5.fzaninotto/faker(opuštěný,composer auditselhával) → oficiální nástupcefakerphp/faker^1.24se stejným API.phing/phing(+build.xml),slevomat/coding-standard(teď přichází přes phpcs-rules),phpstan/phpstan-strict-rules(teď přes phpstan-rules) aphp-parallel-lint.ruleset.xmldědívendor/pekral/phpcs-rules/ruleset.xmlsphp_version 80200.rector.phpimportuje sadu pekral sPhpVersion::PHP_82. Nástroje tak nenavrhnou syntaxi novější než 8.2.check,fix,build,phpcs-check,rector-check,analyse,test,test:integration,security-audit,composer-normalize-check,ai-olympus:install.allow-plugins. Vygenerované.claude/,.codex/,.agents/aAGENTS.mdjsou v.gitignore. Pocomposer installje obnovíš příkazemcomposer ai-olympus:install.GitHub Actions (podle
pekral/phpcs-rulesci.ymlapekral/rector-rulespr.yml)build.yml(phing, PHP 8.0, jen push) je nahrazený souboremchecks.yml, který běží na push i PR domaster.checksna PHP 8.4 a 8.5 spouští security audit, composer normalize, PHPCS, Rector, PHPStan a unit testy.runtimena PHP 8.2 a 8.3 validujecomposer.json, ověří, že runtime závislosti jdou na dané verzi nainstalovat (bezrequire-dev, které vyžaduje 8.4+), a lintujesrc/.Úpravy kódu kvůli checkerům
ResponseFactory,ResponseHydrator,Client). Duplicitní logika vResponseHydratorje sloučená do privátních metod.ResponseFactory::createFromOutputje rozdělená na menší privátní metody (status kódy přesmatch), chování zůstává stejné.tests/Config.phpuž nedědí z odstraněné třídyConsistence\ObjectPrototype. Kvůli tomu dosud namasterpadaly všechny testy vClientTest.phpunit.xmlukazoval testsuite na.(včetněvendor/) a coverage na../src. Opraveno natestsasrc.readonlyvlastnosti a třídy (PHP 8.2), pojmenované argumenty, abecedně seřazené klíče polí, kde na pořadí nezáleží.Opravy z code review
verifySSLCertificate: true. Session token tak byl vystavený útoku MITM. Opraveno.CompanyClientnepředávaldebugModerodičovské třídě, takže ladění ubackup()/restore()nefungovalo. Opraveno.CurlOptionsFactory(vstupCurlRequestDTO).HttpClientjde doClientpředat, takže je celá HTTP vrstva testovatelná bez sítě.src/(měřeno PCOV). Celkem 70 unit testů, prochází i na PHP 8.2.35.phpstan/phpstan-mockery^2.0.Opravené chyby (nalezené PHPStanem)
CompanyClient::backup()arestore()volaly neexistujícíMethod::get(...), zbytek po přechodu na enumy, a padaly na fatal error. Teď používajíMethod::GETaMethod::PUT.SearchQueryOperator: převod operátorů závisel na pořadí klíčů pole. Nově se používástrtr(), které vždy nahrazuje nejdelší shodu (<=před<) bez ohledu na pořadí.CURLOPT_HTTPAUTHdostávaltrue/false. Teď dostáváCURLAUTH_BASIC/0(hodnoty se nemění).CURLOPT_SSL_VERIFYHOSTdostává2/0.Merge danger
^8.2, veřejné API se nemění;save()a další volání nově vyhodíEcomailFlexibeeRequestFail(původníJsonExceptionje vprevious) místo tichého odeslánífalse;authSessionId) nevypíná. Řídí se jen volbouverifySSLCertificate. Kdo session přihlášení používá proti serveru s neplatným certifikátem, musí předatverifySSLCertificate: false;ClientaCompanyClientmají nový volitelný poslední parametr?HttpClient $httpClient,HttpClientuž nenífinal;EcomailFlexibeeRequestFail;Response::getStatistics()se PHPDoc změnil zarray<string>naarray<mixed>, protože to odpovídá skutečným datům.ruleset.xml, ne anotace v kódu):Config::verifySSLCertificate()(název metody, veřejné API);Client(vstupní bod balíčku, rozdělení by byl BC break).rakit/validationje odstraněný (opuštěný balíček, na PHP 8.4+ vypisoval deprecations). Používal se jen na kontrolu kódu (max. 20 znaků, velká písmena). Tu teďParameterValidatordělá přesmb_strlen()/mb_strtoupper(). BC break:ParameterValidatoruž nedědí zRakit\Validation\ValidatoraEcomailFlexibeeInvalidRequestParameterje obyčejná výjimka bez rakit parametru.tests/bootstrap.phpnačte jenPurl\AbstractParts vypnutýmE_DEPRECATED, dokud purl neodstraní refactor(http): build FlexiBee URLs natively instead of ecomailcz/purl #51. Deprecations z vlastního kódu se v testech projeví.Testování
composer check(normalize, PHPCS, Rector, PHPStan max, unit testy) lokálně na PHP 8.5: ✅php -lceléhosrc/na PHP 8.2 a 8.3: ✅ClientTest, skupinaintegration, běží proti živémudemo.flexibee.eu) nejsou v CI. Na této větvi padá stejná sada 16 testů jako namaster, ověřeno srovnáním namasters opravenýmtests/Config.php. Nejde tedy o regresi. Demo přístupywinstrom/winstromjsou podle dokumentace ABRA Flexi stále platné a server odpovídá. Pády způsobuje aktuální stav demo dat a API a je potřeba je řešit samostatně. Spuštění:composer test:integration.testRunBackendProcesses. Byl trvale přeskočený (markTestSkippeda za ním nedosažitelný kód), a s ním i jím jediným volanácheckResponseStructure().ResponseFactory,ResponseHydrator,CurlOptionsFactory,HttpClient,Client(offline přes mockHttpClient) aCompanyClient.Zdroje
.github/workflows/ci.yml).github/workflows/project-checks.yml).github/workflows/pr.yml)