From db43cf9ff45552e7ef3b6c2ea4686f55a4394d00 Mon Sep 17 00:00:00 2001 From: Hendrik Becker Date: Thu, 14 Aug 2025 13:19:50 -0600 Subject: [PATCH] add missing string type for $title in Asymmetric Property inheritance example Add the missing string type to $title in the SpecialBook class. The parent defines $title as string; the child must not drop the declared type. --- language/oop5/visibility.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/language/oop5/visibility.xml b/language/oop5/visibility.xml index 8898d01becfd..465f7f87fe5c 100644 --- a/language/oop5/visibility.xml +++ b/language/oop5/visibility.xml @@ -194,7 +194,7 @@ class Book class SpecialBook extends Book { - public protected(set) $title; // OK, as reading is wider and writing the same. + public protected(set) string $title; // OK, as reading is wider and writing the same. public string $author; // OK, as reading is the same and writing is wider. public protected(set) int $pubYear; // Fatal Error. private(set) properties are final. }