Skip to content

Commit 9334b9b

Browse files
committed
minor polishes and cleanup
1 parent fe76f73 commit 9334b9b

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

src/Builder/DatabaseBuilder.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,20 @@ class DatabaseBuilder
1616
*/
1717
private array $payload;
1818

19+
/**
20+
* @var Databases
21+
*/
22+
private Databases $databasesEndpoint;
23+
24+
1925
/**
2026
* DatabaseBuilder constructor.
2127
*
2228
* @param Databases $databasesEndpoint
2329
*/
24-
public function __construct(private Databases $databasesEndpoint)
30+
public function __construct(Databases $databasesEndpoint)
2531
{
32+
$this->databasesEndpoint = $databasesEndpoint;
2633
$this->payload = [
2734
'is_inline' => false,
2835
'parent' => [],
@@ -43,7 +50,7 @@ public function __construct(private Databases $databasesEndpoint)
4350
* @param string $pageId
4451
* @return Database
4552
*/
46-
public function createInPage($pageId): Database
53+
public function createInPage(string $pageId): Database
4754
{
4855
$this->payload['parent'] = [
4956
'type' => 'page_id',
@@ -219,7 +226,7 @@ public function scheme(callable $callback): DatabaseBuilder
219226
* @param array|null $content
220227
* @return DatabaseBuilder
221228
*/
222-
public function addRaw(string $title, string $propertyType, array $content = null): DatabaseBuilder
229+
public function addRaw(string $title, string $propertyType, ?array $content = null): DatabaseBuilder
223230
{
224231
$this->payload['properties'][$title] = [];
225232
$this->payload['properties'][$title][$propertyType] = $content ?? new \stdClass();

src/Endpoints/Resolve.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,8 @@ public function parent(NotionParent $parent): Page|Database|Block|NotionParent
8585
return $this->notion->block($parent->getId())->retrieve();
8686
case 'workspace':
8787
return $parent;
88-
// throw new HandlingException('A Notion Workspace cannot be resolved by the Notion API.');
8988
default:
90-
throw new HandlingException('Unknown parent type while resolving the notion parent');
89+
throw new HandlingException('Unknown parent type while resolving the Notion parent');
9190
}
9291
}
9392

src/Entities/NotionParent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protected function setResponseData(array $responseData): void
2525
&& $responseData['object'] !== 'workspace'
2626
&& $responseData['object'] !== 'block_id'
2727
) {
28-
throw HandlingException::instance('invalid json-array: the given object is not a valid parent');
28+
throw HandlingException::instance('Invalid JSON: The given object is not a valid parent');
2929
}
3030

3131
$this->fillFromRaw();

src/Macros/PestHttpRecorder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ public static function register()
3434

3535
class HttpRecorder
3636
{
37-
private $snapshotDirectory = 'snapshots';
37+
private string $snapshotDirectory = 'snapshots';
3838

39-
private $usePrettyJson = true;
39+
private bool $usePrettyJson = true;
4040

41-
private $requestNames = [];
41+
private array $requestNames = [];
4242

4343
public function storeIn($directory)
4444
{

0 commit comments

Comments
 (0)