Skip to content

feat: add BackedEnum support and housekeeping improvements#99

Open
enricodelazzari wants to merge 14 commits intomaize-tech:mainfrom
enricodelazzari:enums
Open

feat: add BackedEnum support and housekeeping improvements#99
enricodelazzari wants to merge 14 commits intomaize-tech:mainfrom
enricodelazzari:enums

Conversation

@enricodelazzari
Copy link
Member

@enricodelazzari enricodelazzari commented Mar 7, 2026

Summary

BackedEnum support

  • Introduce MarkValue class with resolve() to normalize BackedEnum|string|null to ?string
  • Add MarkValue::resolveAll() to normalize arrays, eliminating duplicated inline logic in hasAllowedValues()
  • Update all Mark public methods (add, remove, count, has, toggle, hasAllowedValues) and Markable::scopeWhereHasMark() to accept null|string|\BackedEnum instead of ?string
  • Support enum class strings as allowed_values config (resolves all cases automatically)
  • Add tests/Enums/ReactionType.php and corresponding test coverage for all enum-based flows

Centralize config access via Support\Config

  • Add src/Support/Config.php with typed static methods (getUserModel, getTablePrefix, getAllowedValues)
  • Replace all scattered config('markable.*') calls in Mark.php and Markable.php

Housekeeping

  • Migrate test suite from PHPUnit to Pest (tests/Pest.php, pestphp/pest)
  • Replace Psalm with PHPStan (phpstan.neon.dist, analyse.yml workflow)
  • Remove spatie/laravel-ray from dev dependencies
  • Drop support for PHP < 8.3 and Laravel < 11
  • Add .claude/ to .gitignore

Test plan

  • composer test — all 36 tests pass
  • can_add_a_reaction_with_backed_enum
  • can_has_a_reaction_with_backed_enum
  • can_remove_a_reaction_with_backed_enum
  • can_toggle_a_reaction_with_backed_enum
  • can_count_reactions_with_backed_enum
  • can_use_enum_class_as_allowed_values
  • cannot_add_invalid_value_when_allowed_values_is_enum_class

🤖 Generated with Claude Code

@enricodelazzari enricodelazzari changed the title feat: add BackedEnum support for mark values feat: add BackedEnum support and housekeeping improvements Mar 7, 2026
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