Upgrade to 3.9.5
This commit is contained in:
@@ -364,8 +364,8 @@ class App
|
||||
* by name. All relevant dependencies are
|
||||
* automatically injected
|
||||
*
|
||||
* @param string $name
|
||||
* @return \Kirby\Cms\Collection|null
|
||||
* @return \Kirby\Toolkit\Collection|null
|
||||
* @todo 5.0 Add return type declaration
|
||||
*/
|
||||
public function collection(string $name)
|
||||
{
|
||||
@@ -379,10 +379,8 @@ class App
|
||||
|
||||
/**
|
||||
* Returns all user-defined collections
|
||||
*
|
||||
* @return \Kirby\Cms\Collections
|
||||
*/
|
||||
public function collections()
|
||||
public function collections(): Collections
|
||||
{
|
||||
return $this->collections ??= new Collections();
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ trait AppUsers
|
||||
} finally {
|
||||
// ensure that the impersonation is *always* reset
|
||||
// to the original value, even if an error occurred
|
||||
$auth->impersonate($userBefore !== null ? $userBefore->id() : null);
|
||||
$auth->impersonate($userBefore?->id());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -209,9 +209,9 @@ class Collection extends BaseCollection
|
||||
* or ids and then search accordingly.
|
||||
*
|
||||
* @param string|object $needle
|
||||
* @return int
|
||||
* @return int|false
|
||||
*/
|
||||
public function indexOf($needle): int
|
||||
public function indexOf($needle): int|false
|
||||
{
|
||||
if (is_string($needle) === true) {
|
||||
return array_search($needle, $this->keys());
|
||||
|
||||
@@ -28,25 +28,20 @@ class Collections
|
||||
* has been called, to avoid further
|
||||
* processing on sequential calls to
|
||||
* the same collection.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $cache = [];
|
||||
protected array $cache = [];
|
||||
|
||||
/**
|
||||
* Store of all collections
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $collections = [];
|
||||
protected array $collections = [];
|
||||
|
||||
/**
|
||||
* Magic caller to enable something like
|
||||
* `$collections->myCollection()`
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $arguments
|
||||
* @return \Kirby\Cms\Collection|null
|
||||
* @return \Kirby\Toolkit\Collection|null
|
||||
* @todo 5.0 Add return type declaration
|
||||
*/
|
||||
public function __call(string $name, array $arguments = [])
|
||||
{
|
||||
@@ -56,9 +51,9 @@ class Collections
|
||||
/**
|
||||
* Loads a collection by name if registered
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $data
|
||||
* @return \Kirby\Cms\Collection|null
|
||||
* @return \Kirby\Toolkit\Collection|null
|
||||
* @todo 4.0 Add deprecation warning when anything else than a Collection is returned
|
||||
* @todo 5.0 Add return type declaration
|
||||
*/
|
||||
public function get(string $name, array $data = [])
|
||||
{
|
||||
|
||||
@@ -95,7 +95,7 @@ trait HasFiles
|
||||
|
||||
// find by global UUID
|
||||
if (Uuid::is($filename, 'file') === true) {
|
||||
return Uuid::for($filename, $this->files())->model();
|
||||
return Uuid::for($filename, $this->$in())->model();
|
||||
}
|
||||
|
||||
if (strpos($filename, '/') !== false) {
|
||||
|
||||
@@ -19,9 +19,9 @@ trait HasSiblings
|
||||
*
|
||||
* @param \Kirby\Cms\Collection|null $collection
|
||||
*
|
||||
* @return int
|
||||
* @return int|false
|
||||
*/
|
||||
public function indexOf($collection = null): int
|
||||
public function indexOf($collection = null): int|false
|
||||
{
|
||||
$collection ??= $this->siblingsCollection();
|
||||
return $collection->indexOf($this);
|
||||
@@ -29,10 +29,13 @@ trait HasSiblings
|
||||
|
||||
/**
|
||||
* Returns the next item in the collection if available
|
||||
* @todo `static` return type hint is not 100% accurate because of
|
||||
* quirks in the `Form` classes; would break if enforced
|
||||
* (https://github.com/getkirby/kirby/pull/5175)
|
||||
*
|
||||
* @param \Kirby\Cms\Collection|null $collection
|
||||
*
|
||||
* @return \Kirby\Cms\Model|null
|
||||
* @return static|null
|
||||
*/
|
||||
public function next($collection = null)
|
||||
{
|
||||
@@ -55,10 +58,13 @@ trait HasSiblings
|
||||
|
||||
/**
|
||||
* Returns the previous item in the collection if available
|
||||
* @todo `static` return type hint is not 100% accurate because of
|
||||
* quirks in the `Form` classes; would break if enforced
|
||||
* (https://github.com/getkirby/kirby/pull/5175)
|
||||
*
|
||||
* @param \Kirby\Cms\Collection|null $collection
|
||||
*
|
||||
* @return \Kirby\Cms\Model|null
|
||||
* @return static|null
|
||||
*/
|
||||
public function prev($collection = null)
|
||||
{
|
||||
|
||||
@@ -270,9 +270,9 @@ class Pages extends Collection
|
||||
$query = $startAt;
|
||||
|
||||
foreach ($path as $key) {
|
||||
$collection = $item ? $item->children() : $this;
|
||||
$query = ltrim($query . '/' . $key, '/');
|
||||
$item = $collection->get($query) ?? null;
|
||||
$collection = $item?->children() ?? $this;
|
||||
$query = ltrim($query . '/' . $key, '/');
|
||||
$item = $collection->get($query) ?? null;
|
||||
|
||||
if ($item === null && $multiLang === true && !App::instance()->language()->isDefault()) {
|
||||
if (count($path) > 1 || $collection->parent()) {
|
||||
|
||||
Reference in New Issue
Block a user