In depth: objects
Objects past the basics: readonly properties and classes, backed enums, cloning and serialization, late static binding, variance, abstract and final, traits and interfaces with their conflicts resolved, and the exception tree.
9.1
Readonly deep dive
readonly properties and readonly classes, cloning, and the limits
Open
9.2
Enums deep dive
backed enums, methods, tryFrom, and JSON output
Open
9.3
Clone objects
clone an object, __clone, a deep copy, and how the copies compare
Open
9.4
Serialize objects
__serialize, JSON output, and why unserialize never touches input
Open
9.5
Late static binding
self and static, forward_static_call, and a small framework pattern
Open
9.6
Variance
covariant returns, contravariant parameters, and the property rules
Open
9.7
Abstract and final
abstract and final classes, final methods, and the design intent
Open
9.8
Traits advanced
insteadof, alias with as, composed traits, and trait methods used well
Open
9.9
Interfaces advanced
segregated interfaces, extended interfaces, shared constants, Countable
Open
9.10
Exceptions advanced
the Throwable tree, a custom class, previous chaining and finally
Open