Passing a string where an object was hinted used to be a recoverable fatal, which in practice meant an unrecoverable one. It is an exception now, which makes…
PHP 7 added scalar type hints and then made them optional in a way that surprises people: without declare(strict_types=1) the engine coerces, so a function typed int happily…
[…new Set(values)] is the shortest deduplication in the language and it compares by identity, so it does nothing at all for a list of objects that happen to…
Eloquent fires saving, created, deleted and the rest when a model instance is saved. A mass update or delete goes straight to the query builder and fires nothing…
The rule reads backwards from how everyone assumes it works. declare(strict_types=1) governs the calls made from that file, not the calls made into the functions declared in it.…
Objects cannot be array keys, so checking whether an object is already in a collection usually turns into in_array($obj, $list, true) — a linear scan that gets slower…
Code that calls time() or new DateTime() internally cannot be tested at a chosen moment. The usual workarounds are a sleep() in the test, which makes the suite…