Modernizing Codebase with Claude's help#114
Conversation
- Update composer.json to support PHP 8.4 - Fix implicitly nullable parameter in tests/Pest.php for PHP 8.4 compatibility - Modernize callable invocation in App.php for better performance 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add magic methods __get, __set, and __isset to handle custom theme styles - Store custom styles in private array instead of creating dynamic properties - Eliminates PHP 8.2+ deprecation warning for custom theme styles - Maintains full backward compatibility with existing theme API 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Improve PHPDoc documentation across App, Config, and DI Container classes - Add detailed method descriptions explaining delegation patterns and return types - Enhance type annotations for better IDE support and static analysis - Update dependency injection container with clearer type expectations - Maintain backward compatibility while providing better developer experience - Update composer dependencies to latest stable versions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull Request Overview
This PR modernizes the codebase to support PHP 8.4+ by improving type annotations, enhancing documentation, and implementing modern PHP practices. The changes focus on stricter typing, better API design, and cleaner syntax usage.
- Improved type annotations with nullable types and mixed types for better PHP 8.4 compatibility
- Enhanced documentation with more descriptive comments and parameter descriptions
- Added dynamic property support for ThemeConfig class and modernized callable syntax
Reviewed Changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Pest.php | Updated parameter type annotation to use nullable array syntax |
| src/Output/ThemeConfig.php | Added magic methods for dynamic property access with custom styles storage |
| src/DI/Container.php | Updated ArrayAccess method parameter type to mixed |
| src/Config.php | Enhanced documentation and changed setter parameter type to mixed |
| src/Command/CommandController.php | Improved documentation for magic method with return type details |
| src/App.php | Enhanced documentation and modernized callable syntax |
| composer.json | Updated PHP version constraint to include 8.4 |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Regenerate lock file to match current composer.json constraints - Ensure consistent dependency versions across environments 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
WendellAdriel
left a comment
There was a problem hiding this comment.
I added a few comments if you want to take a look at them
| foreach ($styles as $name => $style) { | ||
| $formatted[$name] = ThemeStyle::make(...$style); | ||
| } | ||
| $formatted = array_map(fn ($style) => ThemeStyle::make(...$style), $styles); |
There was a problem hiding this comment.
@erikaheidi IDK if I'm getting it wrong, but here I think it's going to create an array without using the $name as the key, what could create some issues
| final class ThemeConfig | ||
| { | ||
| /** @var array<string, ThemeStyle> */ | ||
| private array $customStyles = []; |
There was a problem hiding this comment.
Let's remove this functionality for the custom styles for now
|
This seems a bit messed up, I am going to close the PR and try a smaller update. |
I am currently evaluating Claude and testing it with different projects to learn how it works. Decided to give it a try here to see if I could modernize to PHP 8.4+, the results are here :) can Copilot do better? I don't know. Let's review the changes.
The full roadmap proposed by Claude Code is available on issue #115