Skip to content

v1.2.0

Latest

Choose a tag to compare

@tommyknocker tommyknocker released this 26 Oct 03:24

🎉 Release v1.2.0: Attribute Helper Tool

🚀 Major Feature Release

This release introduces the Attribute Helper Tool - a powerful automation system that dramatically reduces boilerplate code when working with Struct classes.

What's New

Attribute Helper Tool

  • Automated Field attribute generation for Struct classes
  • Console interface similar to phpstan/php-cs-fixer for batch processing
  • Intelligent type inference for PHP properties (scalars, objects, arrays, union types)
  • Smart validation suggestions based on property names
  • Automatic alias generation for camelCase properties
  • Transformer recommendations (StringToUpper, StringToLower)
  • Default value inference based on property types and names

Developer Experience

  • Composer scripts for easy integration (composer struct-helper)
  • Comprehensive test suite with full coverage
  • Live examples demonstrating real-world usage
  • Custom exceptions for better error handling

🔧 Improvements

  • Removed phpstan-baseline.neon - all PHPStan Level 9 errors properly resolved
  • Enhanced type safety in AttributeHelper with proper Reflection type handling
  • Improved code quality by eliminating all static analysis warnings
  • Updated documentation with Attribute Helper section
  • Enhanced examples directory with Attribute Helper demonstrations

📊 Impact

  • 80% reduction in boilerplate code
  • Consistent attribute patterns across all Struct classes
  • Zero PHPStan errors at Level 9
  • 100% test coverage for new functionality

🛠️ Usage

# Generate attributes for a single file
php scripts/struct-helper.php src/UserProfile.php

# Process entire directory
php scripts/struct-helper.php src/

# Dry run to see what would change
php scripts/struct-helper.php --dry-run src/

# Using composer scripts
composer struct-helper src/
composer struct-helper-dry src/

📚 Documentation

  • Updated README.md with comprehensive Attribute Helper section
  • New examples: 09_attribute_helper_demo.php and 10_real_world_api_integration.php
  • Enhanced examples README with usage instructions

🧪 Testing

All tests pass:

  • ✅ 170 PHPUnit tests
  • ✅ 385 assertions
  • ✅ 93.37% code coverage
  • ✅ All examples working
  • ✅ PHPStan Level 9 clean
  • ✅ PSR-12 compliant

Full Changelog: v1.1.0...v1.2.0