Skip to content

Commit

Permalink
Fix coding standards
Browse files Browse the repository at this point in the history
  • Loading branch information
mariosimao committed Sep 26, 2022
1 parent b3ca7aa commit e85fdfc
Show file tree
Hide file tree
Showing 57 changed files with 114 additions and 57 deletions.
3 changes: 2 additions & 1 deletion src/Blocks/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public function __construct(
private readonly RequestFactoryInterface $requestFactory,
private readonly string $token,
private readonly string $version,
) {}
) {
}

public function find(string $blockId): BlockInterface
{
Expand Down
3 changes: 2 additions & 1 deletion src/Common/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class Date
private function __construct(
public readonly DateTimeImmutable $start,
public readonly DateTimeImmutable|null $end,
) {}
) {
}

public static function create(DateTimeImmutable $date): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Common/Emoji.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class Emoji
{
private function __construct(
public readonly string $emoji,
) {}
) {
}

public static function create(string $emoji): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Common/Equation.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class Equation
{
private function __construct(
public readonly string $expression
) {}
) {
}

public static function create(string $expression): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Common/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ private function __construct(
public readonly FileType $type,
public readonly string $url,
public readonly DateTimeImmutable|null $expiryTime,
) {}
) {
}

public static function createExternal(string $url): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Common/Mention.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ private function __construct(
public readonly string|null $databaseId,
public readonly User|null $user,
public readonly Date|null $date,
) {}
) {
}

public static function createPage(string $pageId): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Common/RichText.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ private function __construct(
public readonly Text|null $text,
public readonly Mention|null $mention,
public readonly Equation|null $equation,
) {}
) {
}

/** @psalm-mutation-free */
public static function createText(string $content): self
Expand Down
3 changes: 2 additions & 1 deletion src/Common/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class Text
private function __construct(
public readonly string $content,
public readonly string|null $url,
) {}
) {
}

/** @psalm-mutation-free */
public static function create(string $content): self
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public function __construct(
private readonly RequestFactoryInterface $requestFactory,
private readonly string $token,
private readonly string $version,
) {}
) {
}

public function find(string $databaseId): Database
{
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/Checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class Checkbox implements PropertyInterface
{
private function __construct(
private readonly PropertyMetadata $metadata,
) {}
) {
}

public static function create(string $propertyName = "Checkbox"): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/CreatedBy.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class CreatedBy implements PropertyInterface
{
private function __construct(
private readonly PropertyMetadata $metadata,
) {}
) {
}

public static function create(string $propertyName = "CreatedBy"): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/CreatedTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class CreatedTime implements PropertyInterface
{
private function __construct(
private readonly PropertyMetadata $metadata,
) {}
) {
}

public static function create(string $propertyName = "CreatedTime"): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class Date implements PropertyInterface
{
private function __construct(
private readonly PropertyMetadata $metadata,
) {}
) {
}

public static function create(string $propertyName = "Date"): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class Email implements PropertyInterface
{
private function __construct(
private readonly PropertyMetadata $metadata,
) {}
) {
}

public static function create(string $propertyName = "Email"): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/Files.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class Files implements PropertyInterface
{
private function __construct(
private readonly PropertyMetadata $metadata,
) {}
) {
}

public static function create(string $propertyName = "Files"): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/Formula.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class Formula implements PropertyInterface
private function __construct(
private readonly PropertyMetadata $metadata,
public readonly string $expression
) {}
) {
}

public static function create(string $propertyName = "Formula", string $expression = ""): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/LastEditedBy.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class LastEditedBy implements PropertyInterface
{
private function __construct(
private readonly PropertyMetadata $metadata,
) {}
) {
}

public static function create(string $propertyName = "LastEditedBy"): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/LastEditedTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class LastEditedTime implements PropertyInterface
{
private function __construct(
private readonly PropertyMetadata $metadata,
) {}
) {
}

public static function create(string $propertyName = "LastEditedTime"): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/MultiSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class MultiSelect implements PropertyInterface
private function __construct(
private readonly PropertyMetadata $metadata,
public readonly array $options,
) {}
) {
}

/** @param SelectOption[] $options */
public static function create(string $propertyName = "Multi Select", array $options = []): self
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class Number implements PropertyInterface
private function __construct(
private readonly PropertyMetadata $metadata,
public readonly NumberFormat $format,
) {}
) {
}

public static function create(
string $propertyName = "Number",
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/People.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class People implements PropertyInterface
{
private function __construct(
private readonly PropertyMetadata $metadata,
) {}
) {
}

public static function create(string $propertyName = "People"): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/PhoneNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class PhoneNumber implements PropertyInterface
{
private function __construct(
private readonly PropertyMetadata $metadata,
) {}
) {
}

public static function create(string $propertyName = "PhoneNumber"): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/PropertyMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ private function __construct(
public readonly string $id,
public readonly string $name,
public readonly PropertyType $type,
) {}
) {
}

public static function create(string $id, string $name, PropertyType $type): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/RichTextProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class RichTextProperty implements PropertyInterface
{
private function __construct(
private readonly PropertyMetadata $metadata,
) {}
) {
}

public static function create(string $propertyName = "Text"): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class Select implements PropertyInterface
private function __construct(
private readonly PropertyMetadata $metadata,
public readonly array $options
) {}
) {
}

/** @param SelectOption[] $options */
public static function create(string $propertyName = "Select", array $options = []): self
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/SelectOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ private function __construct(
public readonly string|null $id,
public readonly string|null $name,
public readonly Color $color,
) {}
) {
}

public static function fromId(string $id): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/Title.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class Title implements PropertyInterface
{
private function __construct(
private readonly PropertyMetadata $metadata,
) {}
) {
}

public static function create(string $propertyName = "Title"): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Properties/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class Url implements PropertyInterface
{
private function __construct(
private readonly PropertyMetadata $metadata,
) {}
) {
}

public static function create(string $propertyName = "Url"): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ private function __construct(
public readonly array $sorts,
public readonly string|null $startCursor,
public readonly int $pageSize,
) {}
) {
}

public static function create(): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Query/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ private function __construct(
public readonly array $pages,
public readonly bool $hasMore,
public readonly string|null $nextCursor
) {}
) {
}

/** @param QueryResultJson $array */
public static function fromArray(array $array): self
Expand Down
3 changes: 2 additions & 1 deletion src/Databases/Query/Sort.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ private function __construct(
private readonly string $type,
private readonly string $propertyName,
private readonly string $direction,
) {}
) {
}

public static function property(string $propertyName): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Exceptions/ApiException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ final class ApiException extends NotionException
{
private string $notionCode;

private function __construct(string $message, string $notionCode) {
private function __construct(string $message, string $notionCode)
{
$this->notionCode = $notionCode;

parent::__construct($message);
Expand Down
3 changes: 2 additions & 1 deletion src/Notion.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ private function __construct(
private readonly ClientInterface $psrClient,
private readonly RequestFactoryInterface $requestFactory,
private readonly string $token,
) {}
) {
}

public static function create(string $token): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Pages/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public function __construct(
private readonly RequestFactoryInterface $requestFactory,
private readonly string $token,
private readonly string $version,
) {}
) {
}

public function find(string $pageId): Page
{
Expand Down
3 changes: 2 additions & 1 deletion src/Pages/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ private function __construct(
public readonly array $properties,
public readonly PageParent $parent,
public readonly string $url
) {}
) {
}

public static function create(PageParent $parent): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Pages/PageParent.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class PageParent
private function __construct(
public readonly PageParentType $type,
public readonly string|null $id,
) {}
) {
}

public static function database(string $databaseId): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Pages/Properties/Checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class Checkbox implements PropertyInterface
private function __construct(
private readonly PropertyMetadata $metadata,
public readonly bool $checked,
) {}
) {
}

public static function create(bool $checked = false): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Pages/Properties/CreatedBy.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class CreatedBy implements PropertyInterface
private function __construct(
private readonly PropertyMetadata $metadata,
public readonly User $user,
) {}
) {
}

public function metadata(): PropertyMetadata
{
Expand Down
3 changes: 2 additions & 1 deletion src/Pages/Properties/CreatedTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class CreatedTime implements PropertyInterface
private function __construct(
private readonly PropertyMetadata $metadata,
public readonly DateTimeImmutable $time,
) {}
) {
}

public static function create(DateTimeImmutable $time): self
{
Expand Down
3 changes: 2 additions & 1 deletion src/Pages/Properties/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ private function __construct(
private readonly PropertyMetadata $metadata,
public readonly DateTimeImmutable $start,
public readonly DateTimeImmutable|null $end,
) {}
) {
}

public static function create(
DateTimeImmutable $start,
Expand Down
Loading

0 comments on commit e85fdfc

Please sign in to comment.