Skip to content

Commit 8f76bef

Browse files
Tini-tiny fix of "__isset" sub-supplying to the external framework when is not available in local functionality.
Basically normalizing in the same row with "__set" and "__get" methods.
1 parent b9a317f commit 8f76bef

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/traits/PropertiesTrait.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use spaf\simputils\exceptions\PropertyAccessError;
1515
use spaf\simputils\exceptions\PropertyDoesNotExist;
1616
use spaf\simputils\special\PropertiesCacheIndex;
17+
use function get_parent_class;
1718
use function in_array;
1819

1920
/**
@@ -97,15 +98,26 @@ public function __set($name, $value): void {
9798
}
9899

99100
public function __isset($name) {
100-
return $this->____checkSimpUtilsPropertyAvailability($name);
101-
}
102-
103-
private function ____checkSimpUtilsPropertyAvailability($name, $type = Property::TYPE_GET) {
101+
$type = Property::TYPE_GET;
104102
$ref = static::class.'#'.$name.'#'.$type;
105103
if ($method_name = PropertiesCacheIndex::$index[$ref] ?? false) {
106104
return $this->$method_name(null, $type, $name);
107105
}
108-
return $this->____prepareProperty($name, $type, check_and_do_not_call: true);
106+
$res = $this->____prepareProperty($name, $type, check_and_do_not_call: true);
107+
108+
if (!$res) {
109+
try {
110+
/** @noinspection PhpUndefinedMethodInspection */
111+
if (get_parent_class()) {
112+
$res = parent::__isset($name);
113+
}
114+
} catch (Error $e) {
115+
/** @noinspection PhpUnhandledExceptionInspection */
116+
throw $e;
117+
}
118+
}
119+
120+
return $res;
109121
}
110122

111123
private function ____propertyBatchMethodGet($value, $type, $name): mixed {

0 commit comments

Comments
 (0)