@@ -720,12 +720,12 @@ private function evaluateScalar(string $expr, mixed $context): mixed
720720 $ bracketContent = substr ($ path , 1 , -1 );
721721 $ result = $ this ->evaluateBracket ($ bracketContent , $ context );
722722
723- return $ result ? $ result [0 ] : self :: nothing () ;
723+ return $ result ? $ result [0 ] : Nothing::Nothing ;
724724 }
725725
726726 $ results = $ this ->evaluateTokensOnDecodedData (JsonPathTokenizer::tokenize (new JsonPath ('$ ' .$ path )), $ context );
727727
728- return $ results ? $ results [0 ] : self :: nothing () ;
728+ return $ results ? $ results [0 ] : Nothing::Nothing ;
729729 }
730730
731731 // function calls
@@ -783,7 +783,7 @@ private function evaluateFunction(string $name, string $args, mixed $context): m
783783 \is_string ($ value ) => mb_strlen ($ value ),
784784 \is_array ($ value ) => \count ($ value ),
785785 $ value instanceof \stdClass => \count (get_object_vars ($ value )),
786- default => self :: nothing () ,
786+ default => Nothing::Nothing ,
787787 },
788788 'count ' => $ nodelistSize ,
789789 'match ' => match (true ) {
@@ -794,7 +794,7 @@ private function evaluateFunction(string $name, string $args, mixed $context): m
794794 \is_string ($ value ) && \is_string ($ argList [1 ] ?? null ) => (bool ) @preg_match ("/ {$ this ->transformJsonPathRegex ($ argList [1 ])}/u " , $ value ),
795795 default => false ,
796796 },
797- 'value ' => 1 < $ nodelistSize ? self :: nothing () : (1 === $ nodelistSize ? (\is_array ($ value ) ? ($ value [0 ] ?? null ) : $ value ) : $ value ),
797+ 'value ' => 1 < $ nodelistSize ? Nothing::Nothing : (1 === $ nodelistSize ? (\is_array ($ value ) ? ($ value [0 ] ?? null ) : $ value ) : $ value ),
798798 default => null ,
799799 };
800800 }
@@ -831,8 +831,8 @@ private function compare(mixed $left, mixed $right, string $operator): bool
831831
832832 private function compareEquality (mixed $ left , mixed $ right ): bool
833833 {
834- $ leftIsNothing = $ left === self :: nothing () ;
835- $ rightIsNothing = $ right === self :: nothing () ;
834+ $ leftIsNothing = $ left === Nothing::Nothing ;
835+ $ rightIsNothing = $ right === Nothing::Nothing ;
836836
837837 if (
838838 $ leftIsNothing && $ rightIsNothing
@@ -1101,11 +1101,6 @@ private function isValidMixedBracketExpression(string $expr): bool
11011101 return $ hasFilter && $ validMixed && 1 < \count ($ parts );
11021102 }
11031103
1104- private static function nothing (): \stdClass
1105- {
1106- return self ::$ nothing ??= new \stdClass ();
1107- }
1108-
11091104 private function getValueIfKeyExists (mixed $ value , string $ key ): array
11101105 {
11111106 return $ this ->isArrayOrObject ($ value ) && \array_key_exists ($ key , $ arrayValue = (array ) $ value ) ? [$ arrayValue [$ key ]] : [];
0 commit comments