diff --git a/composer.json b/composer.json index c641c0c5..b3d34171 100644 --- a/composer.json +++ b/composer.json @@ -26,10 +26,10 @@ "fakerphp/faker": "^1.14", "friendsofphp/php-cs-fixer": "^3.0", "inertiajs/inertia-laravel": "^1.2", + "larastan/larastan": "^2.7", "livewire/livewire": "^3.0", "mockery/mockery": "^1.6", "nesbot/carbon": "^2.63", - "nunomaduro/larastan": "^2.0", "orchestra/testbench": "^8.0|^9.0", "pestphp/pest": "^2.31", "pestphp/pest-plugin-laravel": "^2.0", diff --git a/config/data.php b/config/data.php index 3be386d1..62bf2109 100644 --- a/config/data.php +++ b/config/data.php @@ -1,21 +1,21 @@ DATE_ATOM, - /** + /* * When transforming or casting dates, the following timezone will be used to * convert the date to the correct timezone. If set to null no timezone will * be passed. */ 'date_timezone' => null, - /** + /* * It is possible to enable certain features of the package, these would otherwise * be breaking changes, and thus they are disabled by default. In the next major * version of the package, these features will be enabled by default. @@ -23,7 +23,7 @@ 'features' => [ 'cast_and_transform_iterables' => false, - /** + /* * When trying to set a computed property value, the package will throw an exception. * You can disable this behaviour by setting this option to true, which will then just * ignore the value being passed into the computed property and recalculate it. @@ -31,7 +31,7 @@ 'ignore_exception_when_trying_to_set_computed_property_value' => false, ], - /** + /* * Global transformers will take complex types and transform them into simple * types. */ @@ -41,7 +41,7 @@ BackedEnum::class => Spatie\LaravelData\Transformers\EnumTransformer::class, ], - /** + /* * Global casts will cast values into complex types when creating a data * object from simple types. */ @@ -51,7 +51,7 @@ // Enumerable::class => Spatie\LaravelData\Casts\EnumerableCast::class, ], - /** + /* * Rule inferrers can be configured here. They will automatically add * validation rules to properties of a data object based upon * the type of the property. @@ -64,7 +64,7 @@ Spatie\LaravelData\RuleInferrers\AttributesRuleInferrer::class, ], - /** + /* * Normalizers return an array representation of the payload, or null if * it cannot normalize the payload. The normalizers below are used for * every data object, unless overridden in a specific data object class. @@ -78,14 +78,14 @@ Spatie\LaravelData\Normalizers\JsonNormalizer::class, ], - /** + /* * Data objects can be wrapped into a key like 'data' when used as a resource, * this key can be set globally here for all data objects. You can pass in * `null` if you want to disable wrapping. */ 'wrap' => null, - /** + /* * Adds a specific caster to the Symphony VarDumper component which hides * some properties from data objects and collections when being dumped * by `dump` or `dd`. Can be 'enabled', 'disabled' or 'development' @@ -93,7 +93,7 @@ */ 'var_dumper_caster_mode' => 'development', - /** + /* * It is possible to skip the PHP reflection analysis of data objects * when running in production. This will speed up the package. You * can configure where data objects are stored and which cache @@ -119,14 +119,14 @@ ], ], - /** + /* * A data object can be validated when created using a factory or when calling the from * method. By default, only when a request is passed the data is being validated. This * behaviour can be changed to always validate or to completely disable validation. */ 'validation_strategy' => \Spatie\LaravelData\Support\Creation\ValidationStrategy::OnlyRequests->value, - /** + /* * A data object can map the names of its properties when transforming (output) or when * creating (input). By default, the package will not map any names. You can set a * global strategy here, or override it on a specific data object. @@ -136,13 +136,13 @@ 'output' => null, ], - /** + /* * When using an invalid include, exclude, only or except partial, the package will * throw an exception. You can disable this behaviour by setting this option to true. */ 'ignore_invalid_partials' => false, - /** + /* * When transforming a nested chain of data objects, the package can end up in an infinite * loop when including a recursive relationship. The max transformation depth can be * set as a safety measure to prevent this from happening. When set to null, the @@ -150,32 +150,34 @@ */ 'max_transformation_depth' => null, - /** + /* * When the maximum transformation depth is reached, the package will throw an exception. * You can disable this behaviour by setting this option to true which will return an * empty array. */ 'throw_when_max_transformation_depth_reached' => true, - /** - * When using the `make:data` command, the package will use these settings to generate - * the data classes. You can override these settings by passing options to the command. - */ + /* + * When using the `make:data` command, the package will use these settings to generate + * the data classes. You can override these settings by passing options to the command. + */ 'commands' => [ - /** + + /* * Provides default configuration for the `make:data` command. These settings can be overridden with options * passed directly to the `make:data` command for generating single Data classes, or if not set they will * automatically fall back to these defaults. See `php artisan make:data --help` for more information */ 'make' => [ - /** + + /* * The default namespace for generated Data classes. This exists under the application's root namespace, * so the default 'Data` will end up as '\App\Data', and generated Data classes will be placed in the * app/Data/ folder. Data classes can live anywhere, but this is where `make:data` will put them. */ 'namespace' => 'Data', - /** + /* * This suffix will be appended to all data classes generated by make:data, so that they are less likely * to conflict with other related classes, controllers or models with a similar name without resorting * to adding an alias for the Data object. Set to a blank string (not null) to disable. @@ -184,7 +186,7 @@ ], ], - /** + /* * When using Livewire, the package allows you to enable or disable the synths * these synths will automatically handle the data objects and their * properties when used in a Livewire component. diff --git a/docs/installation-setup.md b/docs/installation-setup.md index fb826014..b87d7a4a 100644 --- a/docs/installation-setup.md +++ b/docs/installation-setup.md @@ -19,22 +19,24 @@ This is the contents of the published config file: ```php + DATE_ATOM, - /** + /* * When transforming or casting dates, the following timezone will be used to * convert the date to the correct timezone. If set to null no timezone will * be passed. */ 'date_timezone' => null, - /** + /* * It is possible to enable certain features of the package, these would otherwise * be breaking changes, and thus they are disabled by default. In the next major * version of the package, these features will be enabled by default. @@ -42,7 +44,7 @@ return [ 'features' => [ 'cast_and_transform_iterables' => false, - /** + /* * When trying to set a computed property value, the package will throw an exception. * You can disable this behaviour by setting this option to true, which will then just * ignore the value being passed into the computed property and recalculate it. @@ -50,7 +52,7 @@ return [ 'ignore_exception_when_trying_to_set_computed_property_value' => false, ], - /** + /* * Global transformers will take complex types and transform them into simple * types. */ @@ -60,7 +62,7 @@ return [ BackedEnum::class => Spatie\LaravelData\Transformers\EnumTransformer::class, ], - /** + /* * Global casts will cast values into complex types when creating a data * object from simple types. */ @@ -70,7 +72,7 @@ return [ // Enumerable::class => Spatie\LaravelData\Casts\EnumerableCast::class, ], - /** + /* * Rule inferrers can be configured here. They will automatically add * validation rules to properties of a data object based upon * the type of the property. @@ -83,7 +85,7 @@ return [ Spatie\LaravelData\RuleInferrers\AttributesRuleInferrer::class, ], - /** + /* * Normalizers return an array representation of the payload, or null if * it cannot normalize the payload. The normalizers below are used for * every data object, unless overridden in a specific data object class. @@ -97,14 +99,14 @@ return [ Spatie\LaravelData\Normalizers\JsonNormalizer::class, ], - /** + /* * Data objects can be wrapped into a key like 'data' when used as a resource, * this key can be set globally here for all data objects. You can pass in * `null` if you want to disable wrapping. */ 'wrap' => null, - /** + /* * Adds a specific caster to the Symphony VarDumper component which hides * some properties from data objects and collections when being dumped * by `dump` or `dd`. Can be 'enabled', 'disabled' or 'development' @@ -112,7 +114,7 @@ return [ */ 'var_dumper_caster_mode' => 'development', - /** + /* * It is possible to skip the PHP reflection analysis of data objects * when running in production. This will speed up the package. You * can configure where data objects are stored and which cache @@ -138,14 +140,14 @@ return [ ], ], - /** + /* * A data object can be validated when created using a factory or when calling the from * method. By default, only when a request is passed the data is being validated. This * behaviour can be changed to always validate or to completely disable validation. */ 'validation_strategy' => \Spatie\LaravelData\Support\Creation\ValidationStrategy::OnlyRequests->value, - /** + /* * A data object can map the names of its properties when transforming (output) or when * creating (input). By default, the package will not map any names. You can set a * global strategy here, or override it on a specific data object. @@ -155,13 +157,13 @@ return [ 'output' => null, ], - /** + /* * When using an invalid include, exclude, only or except partial, the package will * throw an exception. You can disable this behaviour by setting this option to true. */ 'ignore_invalid_partials' => false, - /** + /* * When transforming a nested chain of data objects, the package can end up in an infinite * loop when including a recursive relationship. The max transformation depth can be * set as a safety measure to prevent this from happening. When set to null, the @@ -169,32 +171,34 @@ return [ */ 'max_transformation_depth' => null, - /** + /* * When the maximum transformation depth is reached, the package will throw an exception. * You can disable this behaviour by setting this option to true which will return an * empty array. */ 'throw_when_max_transformation_depth_reached' => true, - /** - * When using the `make:data` command, the package will use these settings to generate - * the data classes. You can override these settings by passing options to the command. - */ + /* + * When using the `make:data` command, the package will use these settings to generate + * the data classes. You can override these settings by passing options to the command. + */ 'commands' => [ - /** + + /* * Provides default configuration for the `make:data` command. These settings can be overridden with options * passed directly to the `make:data` command for generating single Data classes, or if not set they will * automatically fall back to these defaults. See `php artisan make:data --help` for more information */ 'make' => [ - /** + + /* * The default namespace for generated Data classes. This exists under the application's root namespace, * so the default 'Data` will end up as '\App\Data', and generated Data classes will be placed in the * app/Data/ folder. Data classes can live anywhere, but this is where `make:data` will put them. */ 'namespace' => 'Data', - /** + /* * This suffix will be appended to all data classes generated by make:data, so that they are less likely * to conflict with other related classes, controllers or models with a similar name without resorting * to adding an alias for the Data object. Set to a blank string (not null) to disable. @@ -203,7 +207,7 @@ return [ ], ], - /** + /* * When using Livewire, the package allows you to enable or disable the synths * these synths will automatically handle the data objects and their * properties when used in a Livewire component.