Skip to content

Commit 29c7dae

Browse files
committed
rename file
1 parent b1fd05e commit 29c7dae

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/Illuminate/Database/Concerns/BuildsQueries.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Illuminate\Container\Container;
66
use Illuminate\Database\MultipleRecordsFoundException;
7-
use Illuminate\Database\NoRecordsFoundException;
7+
use Illuminate\Database\RecordsNotFoundException;
88
use Illuminate\Pagination\LengthAwarePaginator;
99
use Illuminate\Pagination\Paginator;
1010

@@ -150,24 +150,24 @@ public function first($columns = ['*'])
150150
}
151151

152152
/**
153-
* Execute the query and get the first result if it's the sole.
153+
* Execute the query and get the first result if it's the sole matching record.
154154
*
155155
* @param array|string $columns
156156
* @return \Illuminate\Database\Eloquent\Model|object|static|null
157157
*
158-
* @throws \Illuminate\Database\NoRecordsFoundException
158+
* @throws \Illuminate\Database\RecordsNotFoundException
159159
* @throws \Illuminate\Database\MultipleRecordsFoundException
160160
*/
161161
public function sole($columns = ['*'])
162162
{
163163
$result = $this->take(2)->get($columns);
164164

165165
if ($result->isEmpty()) {
166-
throw new NoRecordsFoundException();
166+
throw new RecordsNotFoundException;
167167
}
168168

169169
if ($result->count() > 1) {
170-
throw new MultipleRecordsFoundException();
170+
throw new MultipleRecordsFoundException;
171171
}
172172

173173
return $result->first();

src/Illuminate/Database/NoRecordsFoundException.php renamed to src/Illuminate/Database/RecordsNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use RuntimeException;
66

7-
class NoRecordsFoundException extends RuntimeException
7+
class RecordsNotFoundException extends RuntimeException
88
{
99
//
1010
}

tests/Integration/Database/QueryBuilderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
66
use Illuminate\Database\MultipleRecordsFoundException;
7-
use Illuminate\Database\NoRecordsFoundException;
7+
use Illuminate\Database\RecordsNotFoundException;
88
use Illuminate\Database\Schema\Blueprint;
99
use Illuminate\Support\Carbon;
1010
use Illuminate\Support\Facades\DB;
@@ -52,7 +52,7 @@ public function testSoleFailsForMultipleRecords()
5252

5353
public function testSoleFailsIfNoRecords()
5454
{
55-
$this->expectException(NoRecordsFoundException::class);
55+
$this->expectException(RecordsNotFoundException::class);
5656

5757
DB::table('posts')->where('title', 'Baz Post')->sole();
5858
}

0 commit comments

Comments
 (0)