A computed value usually starts as a method and becomes a property when someone forgets the parentheses. An accessor lets it be read as a property while still…
PHP 7 turned most fatal errors into thrown objects, but they do not extend Exception — they extend Error, and both implement Throwable. Every existing catch (Exception $e)…
class introduced no new object model. It is syntax over the prototype chain, which explains most of the behaviour that surprises people coming from other languages. Methods are…
Testing a class that takes an interface usually means either a mocking framework or a small stub class in its own file, which then lives forever and is…
for…of is not array syntax; it works on anything implementing the iterable protocol, which is one well-known method returning an object with a next(). A generator method is…