@@ -722,12 +722,12 @@ private function evaluateScalar(string $expr, mixed $context): mixed
722722 $ bracketContent = substr ($ path , 1 , -1 );
723723 $ result = $ this ->evaluateBracket ($ bracketContent , $ context );
724724
725- return $ result ? $ result [0 ] : self :: nothing () ;
725+ return $ result ? $ result [0 ] : Nothing::Nothing ;
726726 }
727727
728728 $ results = $ this ->evaluateTokensOnDecodedData (JsonPathTokenizer::tokenize (new JsonPath ('$ ' .$ path )), $ context );
729729
730- return $ results ? $ results [0 ] : self :: nothing () ;
730+ return $ results ? $ results [0 ] : Nothing::Nothing ;
731731 }
732732
733733 // function calls
@@ -785,7 +785,7 @@ private function evaluateFunction(string $name, string $args, mixed $context): m
785785 \is_string ($ value ) => mb_strlen ($ value ),
786786 \is_array ($ value ) => \count ($ value ),
787787 $ value instanceof \stdClass => \count (get_object_vars ($ value )),
788- default => self :: nothing () ,
788+ default => Nothing::Nothing ,
789789 },
790790 'count ' => $ nodelistSize ,
791791 'match ' => match (true ) {
@@ -796,7 +796,7 @@ private function evaluateFunction(string $name, string $args, mixed $context): m
796796 \is_string ($ value ) && \is_string ($ argList [1 ] ?? null ) => (bool ) @preg_match ("/ {$ this ->transformJsonPathRegex ($ argList [1 ])}/u " , $ value ),
797797 default => false ,
798798 },
799- 'value ' => 1 < $ nodelistSize ? self :: nothing () : (1 === $ nodelistSize ? (\is_array ($ value ) ? ($ value [0 ] ?? null ) : $ value ) : $ value ),
799+ 'value ' => 1 < $ nodelistSize ? Nothing::Nothing : (1 === $ nodelistSize ? (\is_array ($ value ) ? ($ value [0 ] ?? null ) : $ value ) : $ value ),
800800 default => null ,
801801 };
802802 }
@@ -833,8 +833,8 @@ private function compare(mixed $left, mixed $right, string $operator): bool
833833
834834 private function compareEquality (mixed $ left , mixed $ right ): bool
835835 {
836- $ leftIsNothing = $ left === self :: nothing () ;
837- $ rightIsNothing = $ right === self :: nothing () ;
836+ $ leftIsNothing = $ left === Nothing::Nothing ;
837+ $ rightIsNothing = $ right === Nothing::Nothing ;
838838
839839 if (
840840 $ leftIsNothing && $ rightIsNothing
@@ -1103,11 +1103,6 @@ private function isValidMixedBracketExpression(string $expr): bool
11031103 return $ hasFilter && $ validMixed && 1 < \count ($ parts );
11041104 }
11051105
1106- private static function nothing (): \stdClass
1107- {
1108- return self ::$ nothing ??= new \stdClass ();
1109- }
1110-
11111106 private function getValueIfKeyExists (mixed $ value , string $ key ): array
11121107 {
11131108 return $ this ->isArrayOrObject ($ value ) && \array_key_exists ($ key , $ arrayValue = (array ) $ value ) ? [$ arrayValue [$ key ]] : [];
0 commit comments