@@ -54,7 +54,7 @@ public static function format(string $value): array {
5454 *
5555 * @return ?string
5656 */
57- private static function decoded (string $ value , ?string &$ encode_fn ): ?string {
57+ private static function decoded (string $ value , ?string &$ encode_fn = null ): ?string {
5858 foreach (Config::get ('encoding ' ) as $ name => $ decoder ) {
5959 if (is_callable ($ decoder ['view ' ]) && $ decoder ['view ' ]($ value ) !== null ) {
6060 $ encode_fn = (string ) $ name ;
@@ -74,7 +74,7 @@ private static function decoded(string $value, ?string &$encode_fn): ?string {
7474 *
7575 * @return ?string
7676 */
77- private static function formatted (string $ value , bool &$ is_formatted ): ?string {
77+ private static function formatted (string $ value , bool &$ is_formatted = false ): ?string {
7878 foreach (Config::get ('formatters ' ) as $ formatter ) {
7979 if (is_callable ($ formatter ) && $ formatter ($ value ) !== null ) {
8080 $ is_formatted = true ;
@@ -117,7 +117,7 @@ private static function prettyPrintJson(string $value): string {
117117 * @return bool
118118 */
119119 private static function isJson (string $ value ): bool {
120- if (!is_string ($ value )) {
120+ if (!is_string ($ value ) || is_numeric ( $ value ) ) {
121121 return false ;
122122 }
123123
@@ -145,7 +145,7 @@ public static function encode(string $value, string $encoder): string {
145145
146146 $ encoder = Config::get ('encoding ' )[$ encoder ];
147147
148- if (is_callable ($ encoder ['save ' ]) && $ encoder [ ' save ' ]( $ value ) !== null ) {
148+ if (is_callable ($ encoder ['save ' ])) {
149149 return $ encoder ['save ' ]($ value );
150150 }
151151
0 commit comments