lucasdotvin / laravel-soulbscription

A straightforward interface to handle subscriptions and feature consumption.
https://soulbscription.lucas.vin
MIT License
601 stars 84 forks source link

Add type hint, model hint, and timestamp cast #69

Open rxrw opened 1 year ago

rxrw commented 1 year ago
  1. Update phpunit.xml to new version
  2. Add type hint to all functions
  3. Add properties hint in all models
  4. (BREAKING CHANGES)Add casts to Carbon for timestamp field
rxrw commented 1 year ago

Hi, I have found this project which suits my requirement! I'm very appreciating your work.

In the process of development, I found there're some difficulties getting hints from IDE.

Above PHP 8 and Laravel 9, there's a recommendation to use type hint in order to make code more readable and easily to develop.

I have done them. Maybe the method hint in model is not fully supported, but it's enough to use. Many contributors and me will continue to make it more completely.

Please let me know if there're any issues, and I'm looking forwards to this PR to be merged ^-^

Due to the breaking changes in timestamp type, I think maybe there should have a major version change 🤔

lucasdotvin commented 1 year ago

Hello! Thanks for the contributions! I'm gonna run some tests and then merge it! 🤘

codecov[bot] commented 1 year ago

Codecov Report

Merging #69 (1d1f52a) into develop (86d227c) will decrease coverage by 1.01%. The diff coverage is 99.07%.

@@              Coverage Diff              @@
##             develop      #69      +/-   ##
=============================================
- Coverage      98.20%   97.19%   -1.01%     
  Complexity       150      150              
=============================================
  Files             26       26              
  Lines            501      499       -2     
=============================================
- Hits             492      485       -7     
- Misses             9       14       +5     
Impacted Files Coverage Δ
src/Enums/PeriodicityType.php 100.00% <ø> (ø)
src/Models/Concerns/HasSubscriptions.php 96.00% <96.77%> (-0.02%) :arrow_down:
src/Models/Concerns/Expires.php 88.88% <100.00%> (-11.12%) :arrow_down:
src/Models/Concerns/ExpiresAndHasGraceDays.php 88.88% <100.00%> (-11.12%) :arrow_down:
src/Models/Concerns/HandlesRecurrence.php 100.00% <100.00%> (ø)
src/Models/Concerns/Starts.php 90.90% <100.00%> (-9.10%) :arrow_down:
src/Models/Concerns/Suppresses.php 90.90% <100.00%> (-9.10%) :arrow_down:
src/Models/Feature.php 100.00% <100.00%> (ø)
src/Models/FeatureConsumption.php 100.00% <100.00%> (ø)
src/Models/FeaturePlan.php 100.00% <100.00%> (ø)
... and 9 more