Skip to content

Modernize codebase: drop Latte 2 support and update to PHP 8.2+#153

Open
ohmyfelix wants to merge 6 commits into
masterfrom
claude/youthful-fermi-SMDPU
Open

Modernize codebase: drop Latte 2 support and update to PHP 8.2+#153
ohmyfelix wants to merge 6 commits into
masterfrom
claude/youthful-fermi-SMDPU

Conversation

@ohmyfelix

Copy link
Copy Markdown
Contributor

This PR modernizes the codebase by removing legacy code and updating dependencies to current standards.

Summary

Removes support for Latte 2.x and PHP 8.0-8.1, consolidating the codebase around Latte 3.x and PHP 8.2+. This eliminates compatibility shims and simplifies the translation extension implementation.

Key Changes

  • Removed legacy Latte 2 support: Deleted src/Latte/Macros.php and src/Latte/Filters.php which contained version-specific code for Latte 2.x compatibility
  • Updated to Latte 3 node-based API: Refactored TranslatorExtension to use modern Latte 3 compiler nodes instead of macro-based approach
  • Simplified TranslateNode: Cleaned up conditional logic in the print method using ternary operators
  • Updated PHP version requirements: Changed minimum PHP version from 8.0.2 to 8.2 in composer.json
  • Updated Latte dependency: Removed support for Latte 2.6, now requires only ^3.0.25
  • Modernized type hints: Updated deprecated ITranslator interface to Translator class throughout codebase
  • Updated CI/CD: Changed GitHub Actions workflows to use PHP 8.2 as base version
  • Simplified PHPStan configuration: Consolidated to use contributte/phpstan package, removed version-specific ignore rules
  • Updated QA tooling: Migrated from ninjify/qa to contributte/qa with updated Makefile targets
  • Code style improvements: Fixed formatting, added type declarations, improved code consistency

Implementation Details

  • Removed version detection logic for Latte (checking Engine::VERSION_ID)
  • Removed Filters class that wrapped translator for Latte 2 compatibility
  • Updated TranslatorExtension to work exclusively with Latte 3's tag-based extension system
  • Replaced deprecated Nette interfaces with their modern equivalents
  • Removed PhpLiteral usage in favor of modern alternatives
  • Updated test files to use modern PHP features (e.g., str_contains() instead of Strings::contains())

https://claude.ai/code/session_01UPxf8e9GsykRoeqXM4j871

claude added 6 commits May 27, 2026 21:26
Replace ninjify/nunjuck and ninjify/qa with contributte/tester and
contributte/qa, bump the PHP requirement to ^8.2, and adapt the codebase
to the stricter contributte/qa coding standard.

https://claude.ai/code/session_01UPxf8e9GsykRoeqXM4j871
Require latte/latte ^3.0.25 and remove the Latte 2 compatibility layer:
delete the MacroSet-based Macros and the Filters class, simplify the DI
extension to register the Latte 3 TranslatorExtension unconditionally, and
switch from the deprecated Nette\Localization\ITranslator to
Nette\Localization\Translator.

Inspired by #140

https://claude.ai/code/session_01UPxf8e9GsykRoeqXM4j871
Replace the individual phpstan/phpstan and phpstan-* rule dependencies with
contributte/phpstan, and include its bundled phpstan.neon in both config files.

https://claude.ai/code/session_01UPxf8e9GsykRoeqXM4j871
Adopt the kernel-style Makefile (direct phpcs/phpcbf with cs2pr under CI,
neon-driven phpstan, install target), use the PHP 8.2 contributte/qa ruleset
and exclude generated test artifacts, scope phpstan to src, refresh
.gitignore/.gitattributes/.editorconfig, and install cs2pr in CI.

https://claude.ai/code/session_01UPxf8e9GsykRoeqXM4j871
Drop the project-level FullyQualifiedClassNameInAnnotation rule (kernel
inherits contributte/qa's default that does not require FQ class names in
annotations) and convert the remaining fully-qualified throws/use sites
across src and tests to imported short names.

https://claude.ai/code/session_01UPxf8e9GsykRoeqXM4j871
Tees tester.out and posts it as a PR comment when the PHP 8.4 tests job
fails, so the failure cause is visible from outside the runner.

https://claude.ai/code/session_01UPxf8e9GsykRoeqXM4j871
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.

2 participants