This commit is contained in:
philipp lang 2024-07-08 23:06:45 +02:00
parent 3b63a73161
commit 10a966c6ad
6 changed files with 22 additions and 1 deletions

View File

@ -8,6 +8,7 @@ use Spatie\LaravelData\Data;
class EditorData extends Data implements Editorable class EditorData extends Data implements Editorable
{ {
/** @param array<int, mixed> $blocks */
public function __construct( public function __construct(
public string $version, public string $version,
public array $blocks, public array $blocks,
@ -47,6 +48,9 @@ class EditorData extends Data implements Editorable
return $this; return $this;
} }
/**
* @param array<int, string> $replacements
*/
public function replaceWithList(string $blockContent, array $replacements): self public function replaceWithList(string $blockContent, array $replacements): self
{ {
$this->blocks = collect($this->blocks)->map(function ($block) use ($blockContent, $replacements) { $this->blocks = collect($this->blocks)->map(function ($block) use ($blockContent, $replacements) {

View File

@ -12,6 +12,9 @@ class SettingStoreAction
{ {
use AsAction; use AsAction;
/**
* @return array<string, string>
*/
public function rules(): array public function rules(): array
{ {
return [ return [

View File

@ -6,6 +6,7 @@ parameters:
stubFiles: stubFiles:
- tests/stub/phpstan/TestResponse.stub - tests/stub/phpstan/TestResponse.stub
- tests/stub/phpstan/Settings.stub
paths: paths:
- app - app

View File

@ -21,6 +21,7 @@ use Worksome\RequestFactories\RequestFactory;
* @method self isActive(bool $isActive) * @method self isActive(bool $isActive)
* @method self isPrivate(bool $isPrivate) * @method self isPrivate(bool $isPrivate)
* @method self export(ExportData $export) * @method self export(ExportData $export)
* @method self preventionText(EditorRequestFactory $text)
*/ */
class FormRequest extends RequestFactory class FormRequest extends RequestFactory
{ {

View File

@ -131,7 +131,7 @@ class FormUpdateActionTest extends FormTestCase
$this->login()->loginNami()->withoutExceptionHandling(); $this->login()->loginNami()->withoutExceptionHandling();
$form = Form::factory()->create(); $form = Form::factory()->create();
$payload = FormRequest::new() $payload = FormRequest::new()
->preventionText(EditorRequestFactory::new()->text(10, 'lorem ipsum')->create()) ->preventionText(EditorRequestFactory::new()->text(10, 'lorem ipsum'))
->state(['needs_prevention' => true]) ->state(['needs_prevention' => true])
->create(); ->create();

View File

@ -0,0 +1,12 @@
<?php
namespace Illuminate\Testing;
namespace Spatie\LaravelSettings;
/**
* @method static refresh()
*/
abstract class Settings
{
}