Skip to content

Commit 0d100ba

Browse files
committed
fixed PHP 8.5 compatibility
1 parent f8debd4 commit 0d100ba

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/ComponentModel/Component.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ abstract class Component implements IComponent
3737
*/
3838
final public function lookup(?string $type, bool $throw = true): ?IComponent
3939
{
40+
$type ??= '';
4041
if (!isset($this->monitors[$type])) { // not monitored or not processed yet
4142
$obj = $this->parent;
4243
$path = self::NameSeparator . $this->name;
@@ -82,7 +83,7 @@ final public function lookup(?string $type, bool $throw = true): ?IComponent
8283
final public function lookupPath(?string $type = null, bool $throw = true): ?string
8384
{
8485
$this->lookup($type, $throw);
85-
return $this->monitors[$type][2];
86+
return $this->monitors[$type ?? ''][2];
8687
}
8788

8889

src/ComponentModel/Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function addComponent(IComponent $component, ?string $name, ?string $inse
6565
// user checking
6666
$this->validateChildComponent($component);
6767

68-
if (isset($this->components[$insertBefore])) {
68+
if ($insertBefore !== null && isset($this->components[$insertBefore])) {
6969
$tmp = [];
7070
foreach ($this->components as $k => $v) {
7171
if ((string) $k === $insertBefore) {

0 commit comments

Comments
 (0)