File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ public function isArray()
9292     */ 
9393    public  function  setDefault ($ defaultnull )
9494    {
95-         if  (self :: REQUIRED  ===  $ this mode  && null  !== $ default
95+         if  ($ this isRequired ()  && null  !== $ default
9696            throw  new  LogicException ('Cannot set a default value except for InputArgument::OPTIONAL mode. ' );
9797        }
9898
Original file line number Diff line number Diff line change @@ -88,6 +88,14 @@ public function testSetDefaultWithRequiredArgument()
8888        $ argumentsetDefault ('default ' );
8989    }
9090
91+     public  function  testSetDefaultWithRequiredArrayArgument ()
92+     {
93+         $ this expectException (\LogicException::class);
94+         $ this expectExceptionMessage ('Cannot set a default value except for InputArgument::OPTIONAL mode. ' );
95+         $ argumentnew  InputArgument ('foo ' , InputArgument::REQUIRED  | InputArgument::IS_ARRAY );
96+         $ argumentsetDefault ([]);
97+     }
98+ 
9199    public  function  testSetDefaultWithArrayArgument ()
92100    {
93101        $ this expectException (\LogicException::class);
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments