File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ public function failureDescription(mixed $other): string
4747        );
4848    }
4949
50-     public  function  toString (int   $ options  =  0 ): string 
50+     public  function  toString (): string 
5151    {
5252        return  (new  ReflectionClass ($ this  ))->name ;
5353    }
Original file line number Diff line number Diff line change 1111use  PHPUnit \Framework \Constraint \Constraint ;
1212use  Throwable ;
1313
14+ use  function  is_int ;
1415use  function  json_encode ;
1516use  function  sprintf ;
1617
@@ -56,10 +57,18 @@ public function failureDescription(mixed $other): string
5657    }
5758
5859    /** 
60+      * @param mixed|null $options 
61+      * 
5962     * @throws JsonException 
6063     */ 
61-     public  function  toString (int   $ options  = 0 ): string 
64+     public  function  toString ($ options  = null ): string 
6265    {
63-         return  json_encode ($ this  ->data , JSON_THROW_ON_ERROR  | $ options );
66+         if  (is_int ($ options )) {
67+             $ options  |= JSON_THROW_ON_ERROR ;
68+         } else  {
69+             $ options  = JSON_THROW_ON_ERROR ;
70+         }
71+ 
72+         return  json_encode ($ this  ->data , $ options  | $ options );
6473    }
6574}
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments