From 33d864240a770f821df419e2d16d841d94968415 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 10 Jan 2018 11:25:32 -0600 Subject: [PATCH] rename validate resolved method to avoid conflicts with macro --- .../Contracts/Validation/ValidatesWhenResolved.php | 2 +- .../Foundation/Providers/FormRequestServiceProvider.php | 2 +- src/Illuminate/Validation/ValidatesWhenResolvedTrait.php | 2 +- tests/Foundation/FoundationFormRequestTest.php | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Illuminate/Contracts/Validation/ValidatesWhenResolved.php b/src/Illuminate/Contracts/Validation/ValidatesWhenResolved.php index 4c33629a7311..4e6b7577b2a3 100644 --- a/src/Illuminate/Contracts/Validation/ValidatesWhenResolved.php +++ b/src/Illuminate/Contracts/Validation/ValidatesWhenResolved.php @@ -9,5 +9,5 @@ interface ValidatesWhenResolved * * @return void */ - public function validate(); + public function validateResolved(); } diff --git a/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php b/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php index 9e413f10fdc0..8dc2912aa81e 100644 --- a/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php +++ b/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php @@ -28,7 +28,7 @@ public function register() public function boot() { $this->app->afterResolving(ValidatesWhenResolved::class, function ($resolved) { - $resolved->validate(); + $resolved->validateResolved(); }); $this->app->resolving(FormRequest::class, function ($request, $app) { diff --git a/src/Illuminate/Validation/ValidatesWhenResolvedTrait.php b/src/Illuminate/Validation/ValidatesWhenResolvedTrait.php index ad5555435f7b..9b76303ad9cd 100644 --- a/src/Illuminate/Validation/ValidatesWhenResolvedTrait.php +++ b/src/Illuminate/Validation/ValidatesWhenResolvedTrait.php @@ -12,7 +12,7 @@ trait ValidatesWhenResolvedTrait * * @return void */ - public function validate() + public function validateResolved() { $this->prepareForValidation(); diff --git a/tests/Foundation/FoundationFormRequestTest.php b/tests/Foundation/FoundationFormRequestTest.php index 4dc7276f88c5..44585084c515 100644 --- a/tests/Foundation/FoundationFormRequestTest.php +++ b/tests/Foundation/FoundationFormRequestTest.php @@ -29,7 +29,7 @@ public function test_validated_method_returns_the_validated_data() { $request = $this->createRequest(['name' => 'specified', 'with' => 'extras']); - $request->validate(); + $request->validateResolved(); $this->assertEquals(['name' => 'specified'], $request->validated()); } @@ -43,7 +43,7 @@ public function test_validate_throws_when_validation_fails() $this->mocks['redirect']->shouldReceive('withInput->withErrors'); - $request->validate(); + $request->validateResolved(); } /** @@ -52,12 +52,12 @@ public function test_validate_throws_when_validation_fails() */ public function test_validate_method_throws_when_authorization_fails() { - $this->createRequest([], FoundationTestFormRequestForbiddenStub::class)->validate(); + $this->createRequest([], FoundationTestFormRequestForbiddenStub::class)->validateResolved(); } public function test_prepare_for_validation_runs_before_validation() { - $this->createRequest([], FoundationTestFormRequestHooks::class)->validate(); + $this->createRequest([], FoundationTestFormRequestHooks::class)->validateResolved(); } /**