Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] Adds support for Laravel >=11.33.0, Fixes #81 #83

Merged
merged 24 commits into from
Dec 16, 2024

Conversation

ayrtonandino
Copy link
Contributor

@ayrtonandino ayrtonandino commented Nov 28, 2024

Upgrade modeltyper to V3.x

The problem with previous version comes from laravel 11.33 extracting functionalities from ShowModelCommand to a external class Illuminate\Database\Eloquent\ModelInspector (see #81).

Changes

This pull request drops support for Laravel <11.0 and php 8.1, updates dependencies and include php 8.4 in testbench.

Now, instead of extending ShowModelCommand, modeltyper implements ModelInspector directly, and drops its internal ShowModelCommand.

Dependencies have been updated, larastan v3, orchestra v9, make sure phpstan and test pass (there where a lot of tests that where not implemented, those were updated).

Additions

  • Added more test, all command flags are now tested.
  • Added new command artisan model:typer-mappings, it returns a table with current mappings.
  • Added more config options, to enable to run artisan model:typer and get the data exactly how you want it.
  • Added option to enable model:typer to run after migrating, disabled by default.
  • Added UPGRADE.md

Removed

  • Remove flag --all, in description it implied it "Enable all output options", in reality only 2 (--plurals --api-resources),
  • Remove flags --resolve-abstract and --throw-exceptions, these are no longer needed.
  • Remove spatie/laravel-ray as it is incompatible at this time with larastan@v3.

Task list

  • Update Dependencies, PHP 8.2
  • Update workflows
  • Remove deprecated ModelInterface and TypescriptInterface
  • Update skeleton to default orchestra v9 skeleton
  • Update expectations for new skeleton
  • Fix failing tests, remove deprecated phpunit annotations
  • Change composer.json conflict from ">=11.33.0" to "<11.33.0" and update dependencies
  • Check if ShowModelCommand can be updated (it can't)
  • Implement ModelInspector and remove ShowModelCommand
  • Update config, to allow set project defaults
  • Check phpstan/test pass
  • Add migrations Docs
  • Update readme

Optional

I would like some other improvements for V3, if ok, like:

@ayrtonandino
Copy link
Contributor Author

Added new class RunModelInspector, runs an extended FumeApp\ModelTyper\Overrides\ModelInspector that in constructor updates the protected $relationMethods array, with those defined in config, but there are no test for it

ayrtonandino and others added 14 commits November 29, 2024 13:01
add output-file tests

Fix ModelTyperCommand

Add ShowModelTyperMappingsCommand

Update ModelInspectorTest.php

Create ModelInspectorTest.php
Update ModelInspectorTest.php

Update GeneratorTest

Update DetermineAccessorTypeTest.php

Update GeneratorTest.php
more tests

run modeltyper after migration

Update readme.md

add UPGRADE.md

update deps

slim skeleton

replace \n with PHP_EOL
@ayrtonandino ayrtonandino marked this pull request as ready for review December 3, 2024 22:24
@ayrtonandino
Copy link
Contributor Author

I'm sorry for so many changes, I know that reviewing so many modifications is quite tedious, let me know if you need me to clarify anything.

@tcampbPPU
Copy link
Member

I'm sorry for so many changes, I know that reviewing so many modifications is quite tedious, let me know if you need me to clarify anything.

All good, much appreciated! I'll be sure to review this when i can asap thanks again

@tcampbPPU tcampbPPU merged commit 6675374 into fumeapp:master Dec 16, 2024
6 checks passed
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