feat(phase-3): upgrade to Laravel 10 - #3872
Open
Vipul-Ydv wants to merge 7 commits into
Open
Conversation
- Bump laravel/framework to ^10.0, nwidart/laravel-modules to ^10.0 - Bump revolution/laravel-google-sheets to ^6.0 (required for L10) - Bump phpunit/phpunit to ^10.1, nunomaduro/collision to ^7.0 - Bump spatie/laravel-ignition to ^2.0 - Add App\Database\DBAL\TimestampType to handle MariaDb1043Platform which is missing from Illuminate's TimestampType in doctrine/dbal 3.10+ - Register the custom type override in AppServiceProvider::register() 136 tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Employee portal
|
||||||||||||||||||||||||||||
| Project |
Employee portal
|
| Branch Review |
refs/pull/3872/merge
|
| Run status |
|
| Run duration | 00m 32s |
| Commit |
|
| Committer | Vipul Yadav |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
1
|
|
|
0
|
|
|
0
|
|
|
4
|
| View all changes introduced in this branch ↗︎ | |
- Remove MariaDb110700Platform from TimestampType: phpstan flags the instanceof as always-false because that class is not present in all doctrine/dbal 3.x installs used in CI (MariaDb1043Platform covers the local MariaDB 10.4.x dev environment) - Regenerate phpstan baseline: 126 errors (107 from phase-2 + 19 new Carbon date-method-on-string errors newly surfaced by larastan 2.x under Laravel 10) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Laravel 10 removed the Eloquent $dates property (upgrade guide, "Model Dates Property"). HasAttributes::getDates() no longer reads $this->dates and now returns only the timestamp columns, so every column declared in $dates was being read back as a raw string instead of a Carbon instance. That broke 11 models at runtime. Crashes on any date method call, for example the invoice list page (index.blade.php:154 calls $invoice->sent_on->format(...)), invoice file-path generation, the pending-invoice and payment-received mails, employee tenure and the client revenue report. It also failed silently in payroll: EmployeePayrollExport:58 does optional($employee->termination_date) ->isSameMonth(...), and Optional::__call only forwards to objects, so a string made it return null. A departing employee was paid a full month instead of pro-rated days. Converted to $casts => 'datetime', which is the same asDateTime() path $dates used, on both read and write, so behaviour matches Laravel 9 exactly. 'date' would not - it adds startOfDay(). Columns the framework already handles are dropped rather than restated: created_at/updated_at come from getDates() via usesTimestamps(), and deleted_at from SoftDeletes::initializeSoftDeletes(). The five models that listed only deleted_at alongside SoftDeletes therefore need no $casts at all. app/Models/Finance/Invoice.php and Payment.php keep an explicit deleted_at cast because neither uses the trait. Also drops the 19 phpstan-baseline entries added in 9579104. Those were not larastan noise - larastan resolves date attributes by calling the framework's own getDates(), so it was correctly reporting this regression, and baselining it removed the only automated signal. The baseline returns to its phase-2 size of 107. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
config/database.php already declared dbal.types.timestamp, so the app had two registration sites for the same Doctrine type, and the config one still pointed at the framework class this override exists to work around. DatabaseManager::registerConfiguredDoctrineTypes() reads database.dbal.types when a connection is configured and registers each entry, and doctrine/dbal has no builtin 'timestamp' type, so pointing the existing config import at App\Database\DBAL\TimestampType is enough. That lets AppServiceProvider::register() go back to being empty instead of mutating Doctrine's global type registry on every boot. Also documents why the class exists, and adds a unit test. One case asserts the framework type still rejects MariaDb1043Platform, so if a later Laravel release adds that platform to its match list the test fails and tells us the override can be deleted. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The phpunit bump to ^10.1 left phpunit.xml on the PHPUnit 9 schema, which is what produced the "PHPUnit Deprecations: 1" in CI. PHPUnit 10 moved coverage include/exclude into a top-level <source> element and dropped the processUncoveredFiles attribute (includeUncoveredFiles now defaults to true, so the intent is preserved). 10.5 still honours the old form via a fallback in TextUI Merger, but PHPUnit 11 deletes it, and with no <source> element the filter registry stays unconfigured and coverage is skipped entirely. Doing it here keeps the phase-4 phpunit ^11 bump from silently losing coverage reporting. Validated against phpunit 10.5.63's own phpunit.xsd. The plan lists this under phase 4; pulling it forward because the phpunit bump it pairs with already landed in this phase. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Illuminate's TimestampType match omits MariaDb110700Platform as well as MariaDb1043Platform, so it throws on MariaDB 11.7+ too. Because MariaDb110700Platform descends from MariaDb1043Platform (11.7 -> 10.10 -> 10.6 -> 10.5.2 -> 10.4.3), the single instanceof already handles it, but the docblock only claimed the 10.4 case and the test comment said the override could be deleted as soon as Laravel added MariaDb1043Platform. Following that would have silently dropped 11.7+. Adds coverage for 11.7 on both sides, and records why a second instanceof MariaDb110700Platform check is unreachable, which is the actual reason phpstan flagged one as always-false in 9579104 (the class is present in doctrine/dbal 3.10.5, contrary to that commit message). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The other cases in this file build the type by hand, so they only cover getSQLDeclaration() - which 2c81417 already added. They would all still pass if config/database.php's import were pointed back at Illuminate\Database\DBAL\TimestampType, which is exactly what the base branch has and so a likely merge-conflict resolution. That would leave the override as dead code and quietly restore the MariaDB ->change() failure. This pins the wiring instead: resolving a connection runs DatabaseManager::registerConfiguredDoctrineTypes(), and the registered type must be ours. The PDO resolver stays lazy, so no database is used. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
laravel/frameworkto^10.0and all required companion packagesApp\Database\DBAL\TimestampTypeto handleMariaDb1043Platformwhich doctrine/dbal 3.10+ exposes for MariaDB 10.4.x but is absent from Laravel's built-inTimestampTypematch listAppServiceProvider::register()so Doctrine DBAL column change migrations work on MariaDB 10.4.x dev environmentsPackages updated
laravel/framework^9.0^10.0nwidart/laravel-modules^9.0^10.0revolution/laravel-google-sheets^5.6^6.0phpunit/phpunit^9.0^10.1nunomaduro/collision^6.0^7.0spatie/laravel-ignition^1.0^2.0Test plan
php artisan --versionreportsLaravel Framework 10.50.2🤖 Generated with Claude Code