Download the PHP package remarkablemark/rector-laravel-database-expressions without Composer
On this page you can find all versions of the php package remarkablemark/rector-laravel-database-expressions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download remarkablemark/rector-laravel-database-expressions
More information about remarkablemark/rector-laravel-database-expressions
Files in remarkablemark/rector-laravel-database-expressions
Package rector-laravel-database-expressions
Short Description Rector to fix Laravel 10 database expressions
License MIT
Informations about the package rector-laravel-database-expressions
rector-laravel-database-expressions
Rector to refactor Laravel 10 database expressions.
From Laravel 10:
Database "expressions" (typically generated via
DB::raw
) have been rewritten in Laravel 10.x to offer additional functionality in the future. Notably, the grammar's raw string value must now be retrieved via the expression'sgetValue(Grammar $grammar)
method. Casting an expression to a string using(string)
is no longer supported.If your application is manually casting database expressions to strings using
(string)
or invoking the__toString
method on the expression directly, you should update your code to invoke thegetValue
method instead:
Requirements
PHP >=8.0
Install
Install with Composer:
Usage
Register rule in rector.php
:
See the diff:
Apply the rule:
Clear the cache and apply the rule:
Rule
Before
After
License
MIT