Skip to content

Commit

Permalink
Fix return types: $this, static and self
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico Hoffmann committed Feb 21, 2021
1 parent 317f494 commit c22b772
Show file tree
Hide file tree
Showing 59 changed files with 290 additions and 275 deletions.
16 changes: 8 additions & 8 deletions src/Api/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ public function routes(): array
* Setter for the authentication callback
*
* @param \Closure|null $authentication
* @return self
* @return $this
*/
protected function setAuthentication(Closure $authentication = null)
{
Expand All @@ -488,7 +488,7 @@ protected function setAuthentication(Closure $authentication = null)
* Setter for the collections definition
*
* @param array|null $collections
* @return self
* @return $this
*/
protected function setCollections(array $collections = null)
{
Expand All @@ -502,7 +502,7 @@ protected function setCollections(array $collections = null)
* Setter for the injected data
*
* @param array|null $data
* @return self
* @return $this
*/
protected function setData(array $data = null)
{
Expand All @@ -514,7 +514,7 @@ protected function setData(array $data = null)
* Setter for the debug flag
*
* @param bool $debug
* @return self
* @return $this
*/
protected function setDebug(bool $debug = false)
{
Expand All @@ -526,7 +526,7 @@ protected function setDebug(bool $debug = false)
* Setter for the model definitions
*
* @param array|null $models
* @return self
* @return $this
*/
protected function setModels(array $models = null)
{
Expand All @@ -541,7 +541,7 @@ protected function setModels(array $models = null)
* Setter for the request data
*
* @param array|null $requestData
* @return self
* @return $this
*/
protected function setRequestData(array $requestData = null)
{
Expand All @@ -559,7 +559,7 @@ protected function setRequestData(array $requestData = null)
* Setter for the request method
*
* @param string|null $requestMethod
* @return self
* @return $this
*/
protected function setRequestMethod(string $requestMethod = null)
{
Expand All @@ -571,7 +571,7 @@ protected function setRequestMethod(string $requestMethod = null)
* Setter for the route definitions
*
* @param array|null $routes
* @return self
* @return $this
*/
protected function setRoutes(array $routes = null)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Api/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function __construct(Api $api, $data, array $schema)

/**
* @param string|array|null $keys
* @return self
* @return $this
* @throws \Exception
*/
public function select($keys = null)
Expand Down Expand Up @@ -168,7 +168,7 @@ public function toResponse(): array

/**
* @param string $view
* @return self
* @return $this
*/
public function view(string $view)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Api/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function __construct(Api $api, $data, array $schema)

/**
* @param null $keys
* @return self
* @return $this
* @throws \Exception
*/
public function select($keys = null)
Expand Down Expand Up @@ -225,7 +225,7 @@ public function toResponse(): array

/**
* @param string $name
* @return self
* @return $this
* @throws \Exception
*/
public function view(string $name)
Expand Down
4 changes: 2 additions & 2 deletions src/Cache/Value.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function expires(): ?int
* Creates a value object from an array
*
* @param array $array
* @return self
* @return static
*/
public static function fromArray(array $array)
{
Expand All @@ -91,7 +91,7 @@ public static function fromArray(array $array)
* returns null on error
*
* @param string $json
* @return self|null
* @return static|null
*/
public static function fromJson(string $json)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cms/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public function session(array $options = [])
* Setter for the parent Kirby instance
*
* @param \Kirby\Cms\App $kirby
* @return self
* @return $this
*/
protected function setKirby(App $kirby)
{
Expand Down
20 changes: 10 additions & 10 deletions src/Cms/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public function apply(string $name, array $args, string $modify, ?Event $origina
/**
* Normalizes and globally sets the configured options
*
* @return self
* @return $this
*/
protected function bakeOptions()
{
Expand Down Expand Up @@ -260,7 +260,7 @@ protected function bakeOptions()
* Sets the directory structure
*
* @param array|null $roots
* @return self
* @return $this
*/
protected function bakeRoots(array $roots = null)
{
Expand All @@ -273,7 +273,7 @@ protected function bakeRoots(array $roots = null)
* Sets the Url structure
*
* @param array|null $urls
* @return self
* @return $this
*/
protected function bakeUrls(array $urls = null)
{
Expand Down Expand Up @@ -342,7 +342,7 @@ public function call(string $path = null, string $method = null)
*
* @param array $props
* @param bool $setInstance If false, the instance won't be set globally
* @return self
* @return static
*/
public function clone(array $props = [], bool $setInstance = true)
{
Expand Down Expand Up @@ -609,7 +609,7 @@ public function file(string $path, $parent = null, bool $drafts = true)
*
* @param \Kirby\Cms\App|null $instance
* @param bool $lazy If `true`, the instance is only returned if already existing
* @return self|null
* @return static|null
*/
public static function instance(self $instance = null, bool $lazy = false)
{
Expand Down Expand Up @@ -1244,7 +1244,7 @@ public function sessionHandler()
* Create your own set of languages
*
* @param array|null $languages
* @return self
* @return $this
*/
protected function setLanguages(array $languages = null)
{
Expand All @@ -1266,7 +1266,7 @@ protected function setLanguages(array $languages = null)
* used for the router
*
* @param string|null $path
* @return self
* @return $this
*/
protected function setPath(string $path = null)
{
Expand All @@ -1278,7 +1278,7 @@ protected function setPath(string $path = null)
* Sets the request
*
* @param array|null $request
* @return self
* @return $this
*/
protected function setRequest(array $request = null)
{
Expand All @@ -1293,7 +1293,7 @@ protected function setRequest(array $request = null)
* Create your own set of roles
*
* @param array|null $roles
* @return self
* @return $this
*/
protected function setRoles(array $roles = null)
{
Expand All @@ -1310,7 +1310,7 @@ protected function setRoles(array $roles = null)
* Sets a custom Site object
*
* @param \Kirby\Cms\Site|array|null $site
* @return self
* @return $this
*/
protected function setSite($site = null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cms/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function path(): string
* Setter for the path
*
* @param string $path
* @return self
* @return $this
*/
protected function setPath(string $path)
{
Expand Down
10 changes: 5 additions & 5 deletions src/Cms/Auth/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function user()
* Sets the type of the active challenge
*
* @param string|null $challenge
* @return self
* @return $this
*/
protected function setChallenge(?string $challenge = null)
{
Expand All @@ -166,7 +166,7 @@ protected function setChallenge(?string $challenge = null)
* a fallback when $challenge is `null`
*
* @param string|null $challengeFallback
* @return self
* @return $this
*/
protected function setChallengeFallback(?string $challengeFallback = null)
{
Expand All @@ -178,7 +178,7 @@ protected function setChallengeFallback(?string $challengeFallback = null)
* Sets the email address of the current/pending user
*
* @param string|null $email
* @return self
* @return $this
*/
protected function setEmail(?string $email = null)
{
Expand All @@ -190,7 +190,7 @@ protected function setEmail(?string $email = null)
* Sets the Kirby instance for user lookup
*
* @param \Kirby\Cms\App $kirby
* @return self
* @return $this
*/
protected function setKirby(App $kirby)
{
Expand All @@ -202,7 +202,7 @@ protected function setKirby(App $kirby)
* Sets the authentication status
*
* @param string $status `active|impersonated|pending|inactive`
* @return self
* @return $this
*/
protected function setStatus(string $status)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cms/Blueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public static function extend($props): array
* @param string $name
* @param string|null $fallback
* @param \Kirby\Cms\Model $model
* @return self
* @return static
*/
public static function factory(string $name, string $fallback = null, Model $model)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cms/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public function prepend(...$args)
* Any part of the query is optional.
*
* @param array $query
* @return self
* @return static
*/
public function query(array $query = [])
{
Expand Down
6 changes: 3 additions & 3 deletions src/Cms/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function keys(): array
* passed key(s)
*
* @param string ...$keys
* @return self
* @return static
*/
public function not(...$keys)
{
Expand Down Expand Up @@ -227,7 +227,7 @@ public function parent()
* Set the parent model
*
* @param \Kirby\Cms\Model $parent
* @return self
* @return $this
*/
public function setParent(Model $parent)
{
Expand All @@ -252,7 +252,7 @@ public function toArray(): array
*
* @param array|null $content
* @param bool $overwrite
* @return self
* @return $this
*/
public function update(array $content = null, bool $overwrite = false)
{
Expand Down
10 changes: 5 additions & 5 deletions src/Cms/ContentTranslation.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function parent()

/**
* @param string $code
* @return self
* @return $this
*/
protected function setCode(string $code)
{
Expand All @@ -173,7 +173,7 @@ protected function setCode(string $code)

/**
* @param array|null $content
* @return self
* @return $this
*/
protected function setContent(array $content = null)
{
Expand All @@ -183,7 +183,7 @@ protected function setContent(array $content = null)

/**
* @param \Kirby\Cms\Model $parent
* @return self
* @return $this
*/
protected function setParent(Model $parent)
{
Expand All @@ -193,7 +193,7 @@ protected function setParent(Model $parent)

/**
* @param string|null $slug
* @return self
* @return $this
*/
protected function setSlug(string $slug = null)
{
Expand All @@ -216,7 +216,7 @@ public function slug(): ?string
*
* @param array|null $data
* @param bool $overwrite
* @return self
* @return $this
*/
public function update(array $data = null, bool $overwrite = false)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cms/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function model()
* Provides a fallback if the field value is empty
*
* @param mixed $fallback
* @return self
* @return $this|static
*/
public function or($fallback = null)
{
Expand Down
Loading

0 comments on commit c22b772

Please sign in to comment.