Skip to content

Commit b6ee0d5

Browse files
committed
debug: SmartNull dumps as [value] => instead of internal properties
print_r on a SmartNull was the one dump left showing private internals (useSmartStrings, root, ...). Now it shows one [value] line like its siblings - the key matches ->value(), same as SmartString's dump.
1 parent ad075c6 commit b6ee0d5

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
## [Unreleased]
88

99
### Changed
10-
- `print_r()` and `var_dump()` now show just the array data, like dumping a plain array. The injected pseudo-properties (the README help pointer and the `useSmartStrings` flag) are gone - the class name PHP prints on every dumped object already identifies the mode, and `var_dump()` rendered the fake entries as broken-looking keys. Use `->debug()` for exact types and metadata. Matches the same change in SmartString 3.0.0.
10+
- `print_r()` and `var_dump()` now show just the array data, like dumping a plain array. The injected pseudo-properties (the README help pointer and the `useSmartStrings` flag) are gone - the class name PHP prints on every dumped object already identifies the mode, and `var_dump()` rendered the fake entries as broken-looking keys. Use `->debug()` for exact types and metadata. `SmartNull` dumps as `[value] =>` instead of exposing its internal properties. Matches the same change in SmartString 3.0.0.
1111
- Deprecated method names (`toRaw()`, `toHtml()`, `withSmartStrings()`, `enableSmartStrings()`, `noSmartStrings()`, `disableSmartStrings()`, `isMultipleOf()`, plus `smartMap()` and `chunk()`) are now real declared methods marked `@deprecated`, organized by deprecation stage in one `DeprecatedAliases` trait, instead of `__call()` shims. IDEs now show strikethroughs with the replacement, `method_exists()` reports them, and calls skip `__call()` dispatch. Same behavior and deprecation notices as before.
1212
- `set()`, `->key = $value`, and array assignment now unwrap Smart values (SmartString, SmartArray, SmartNull) instead of throwing, so values can be copied between arrays in any mode without calling `->value()` first. SmartNull stores as null; nested SmartArrays convert to the target array's mode. Matches how `where()`, `contains()`, and `merge()` already treat Smart inputs.
1313
- `SmartArray::new($data, true)` and `SmartArrayHtml::new($data, false)` now throw like the constructors do, instead of silently ignoring the boolean. Old code that passed `true` expecting auto-encoding was silently getting raw, unencoded values - now it fails at the call site with the class to use instead. Redundant booleans (`false` on SmartArray, `true` on SmartArrayHtml) log a deprecation and proceed.

src/SmartNull.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ public function help(): void
110110
echo $output;
111111
}
112112

113+
/**
114+
* Shows just the null value in print_r() and var_dump() output, hiding internal
115+
* properties. Matches SmartString's [value] dump.
116+
*/
117+
public function __debugInfo(): array
118+
{
119+
return ['value' => null];
120+
}
121+
113122
//endregion
114123
//region Iterator Methods
115124

0 commit comments

Comments
 (0)