From 1875d6c8491a119f0ca7cf82b04110479bd5bf98 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Wed, 11 Dec 2024 15:38:26 +0000 Subject: [PATCH] Add support for internal classes that overload offset access --- src/Type/ObjectType.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Type/ObjectType.php b/src/Type/ObjectType.php index 3290fb97c7..9294fa2078 100644 --- a/src/Type/ObjectType.php +++ b/src/Type/ObjectType.php @@ -61,7 +61,19 @@ class ObjectType implements TypeWithClassName, SubtractableType use UndecidedComparisonTypeTrait; use NonGeneralizableTypeTrait; - private const EXTRA_OFFSET_CLASSES = ['SimpleXMLElement', 'DOMNodeList', 'Threaded']; + private const EXTRA_OFFSET_CLASSES = [ + 'DOMNamedNodeMap', // Only read and existence + 'Dom\NamedNodeMap', // Only read and existence + 'DOMNodeList', // Only read and existence + 'Dom\NodeList', // Only read and existence + 'Dom\HTMLCollection', // Only read and existence + 'Dom\DtdNamedNodeMap', // Only read and existence + 'PDORow', // Only read and existence + 'ResourceBundle', // Only read + 'FFI\CData', // Very funky and weird + 'SimpleXMLElement', + 'Threaded', + ]; private ?Type $subtractedType;