Skip to content

Add Rector and modernize SDK generator CI#1578

Merged
ChiragAgg5k merged 8 commits into
masterfrom
chore/rector-ci-php85-cleanup
Jun 7, 2026
Merged

Add Rector and modernize SDK generator CI#1578
ChiragAgg5k merged 8 commits into
masterfrom
chore/rector-ci-php85-cleanup

Conversation

@ChiragAgg5k

Copy link
Copy Markdown
Member

Summary

This PR modernizes the SDK generator maintenance/tooling baseline and removes deprecated generator surface area.

It adds Rector as a first-class refactor check, moves the generator runtime/tooling baseline to PHP 8.5, consolidates CI workflows, removes the deprecated Markdown SDK generator, and refreshes agent/repo documentation to match the current SDK list and workflows.

Changes

  • Add Rector tooling:

    • Adds rector/rector to dev dependencies.
    • Adds composer refactor and composer refactor:check scripts.
    • Adds rector.php with PHP 8.5 sets, core prepared sets, and PHPUnitSetList::PHPUNIT_CODE_QUALITY.
    • Applies Rector baseline changes across generator source and tests.
  • Move generator tooling to PHP 8.5:

    • Updates Composer PHP requirement/platform from 8.3 to 8.5.
    • Updates workflow PHP setup to 8.5.
    • Updates locked dev dependencies needed for PHP 8.5 compatibility.
  • Refresh GitHub Actions:

    • Consolidates tests.yml and djlint.yml into ci.yml.
    • Keeps test matrix, PHP lint, Rector check, Twig lint, and Twig line-length checks in one CI workflow.
    • Renames SDK build validation workflow to compatibility.yml with display name Compatibility.
    • Updates the README workflow badge to point to ci.yml.
  • Remove deprecated Markdown SDK:

    • Removes src/SDK/Language/Markdown.php.
    • Removes templates/markdown/**.
    • Removes Markdown SDK registration from example.php.
    • Removes Markdown SDK docs entries from README and AGENTS guidance.
  • Cleanup docs/config:

    • Removes .coderabbit.yaml.
    • Updates AGENTS.md to prefer local PHP commands, include Rector in pre-submit checks, and reflect the current SDK list.
    • Fixes example.php cleanup items surfaced during refactoring, including $spec initialization and simpler platform defaulting.

Validation

Ran successfully:

  • composer validate --no-check-publish --no-interaction
  • composer refactor:check
  • composer lint
  • composer lint-twig
  • Workflow YAML parse check with Ruby YAML.load_file

Not run to completion:

  • Full composer test suite. A prior local run hit environment-specific Docker/Android Gradle execution failures (./gradlew: Operation not permitted) before completion.

Notes

No generated SDK output was regenerated in this checkout because the repository currently does not include an examples/ directory. Markdown SDK generator inputs were removed as deprecated, so there is no replacement generated output for that target.

@greptile-apps

greptile-apps Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR modernizes the SDK generator tooling baseline by adding Rector, upgrading the PHP requirement to 8.5, consolidating CI workflows, and removing the deprecated Markdown SDK generator.

  • Rector integration: Adds rector/rector ^2.4 with a rector.php config covering PHP 8.5, dead-code, code-quality, type-declaration, and PHPUnit quality sets; applies the resulting changes across src/, tests/, and example.php (arrow functions, constructor promotion, array_any(), #[Override] on methods and — new in PHP 8.5 — properties).
  • PHP 8.5 upgrade: Bumps composer.json platform and CI matrix PHP version from 8.3 to 8.5; array_any() usage in SDK.php and #[Override] on properties in test classes are both valid PHP 8.5 features.
  • CI consolidation: Merges tests.yml + djlint.yml into ci.yml (adds a push-to-master trigger that was absent from the old tests.yml), renames sdk-build-validation.yml to validation.yml, and pins all action SHAs.

Confidence Score: 5/5

Safe to merge — changes are additive tooling improvements with semantically equivalent code transformations applied by Rector.

All Rector-applied transformations are logically equivalent to the original code. PHP 8.5-specific features (array_any(), #[Override] on properties, typed constants) are gated behind the updated >=8.5 requirement. The Markdown SDK is removed cleanly with no dangling references. The CI consolidation preserves all previously tested SDK matrix entries and adds a push-to-master trigger that was missing before.

No files require special attention.

Important Files Changed

Filename Overview
rector.php New Rector configuration file enabling PHP 8.5 sets, dead-code/code-quality/type-declaration prepared sets, PHPUnit quality set, with sensible skips for ThrowWithPreviousExceptionRector and DisallowedEmptyRuleFixerRector.
.github/workflows/ci.yml Consolidates tests.yml and djlint.yml into a single CI workflow; adds lint, Rector check, Twig lint, and line-length jobs; upgrades matrix PHP version from 8.3 to 8.5; also adds push-to-master trigger that was missing from the old tests.yml.
.github/workflows/validation.yml Renamed from sdk-build-validation.yml with updated display name and PHP 8.5; adds concurrency cancellation and comprehensive per-SDK build steps including security audit commands.
composer.json Bumps PHP requirement and platform to 8.5, removes minimum-stability/prefer-stable settings, adds rector/rector dev dependency and refactor/refactor:check scripts.
src/SDK/SDK.php Heavy Rector cleanup: converts closures to arrow functions, uses constructor property promotion, replaces empty() with strict array comparisons, and uses PHP 8.5 array_any() for hasUploads/hasLocation/hasWebAuth.
src/Spec/Swagger2.php Adds #[Override] on all interface implementations, fixes usort comparator to use explicit (int) casts, converts closures to arrow functions.
example.php Removes Markdown SDK registration, initializes $spec to empty string before conditional fetch, adds return type to getSSLPage(), collapses catch to Throwable-only.
tests/Base.php Adds declare(strict_types=1), imports FQCNs, replaces sizeof() with count(), assertEquals with assertSame for strict type checking.
tests/Node16Test.php Representative of all 35 test files: adds declare(strict_types=1), final modifier, #[Override] on both methods and properties (PHP 8.5 feature), uses ::class constant instead of FQCN strings.
src/SDK/Language/Markdown.php Removed entirely as part of deprecating the Markdown SDK generator; corresponding templates also removed.

Reviews (5): Last reviewed commit: "Keep PHP integration test compatible wit..." | Re-trigger Greptile

Comment thread example.php Outdated
Comment thread src/Spec/Swagger2.php Outdated
@ChiragAgg5k ChiragAgg5k merged commit f2869f1 into master Jun 7, 2026
58 checks passed
@ChiragAgg5k ChiragAgg5k deleted the chore/rector-ci-php85-cleanup branch June 7, 2026 13:39
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