01
Object Model
Classes and objects, inheritance and abstract classes, interfaces, traits, static members, magic methods and type declarations — each as a mechanism that decides what the code using a definition experiences when that definition changes.
- 01 Classes and Objects What the code that uses a class experiences when a name inside the class changes: a private property, a public property, and a consumer that writes to a public property; the four reaches that measure where a change goes.
- 02 Inheritance and Abstract Classes A change inside a parent class shifting the result of a subclass implicitly, an added abstract method stopping the subclasses, and the same counter built with composition leaving the same change in place.
- 03 Interfaces A class that implements an interface failing to declare when a method is added to the interface, the interface as a type and instanceof, and the same addition staying in place in an abstract class with a body.
- 04 Traits Sharing methods between classes with a trait, resolving a conflict with insteadof and as, and the consumer stopping when a method of the same name is added to a trait it uses.
- 05 Static Members and Constants Properties, methods, and constants bound to the class, hiding the constructor behind a static factory method, and which changes stop the consumer.
- 06 Magic Methods The __get, __set, __isset, __call, and __toString methods, resolving a name that is read through a method, and the implicit and breaking results the consumer meets when that resolution changes.
- 07 Type Declarations Parameter, return, and property types, ?int and the union type, and which inputs stop the consumer when a type is added to a parameter.