1111use  Ibexa \Core \Base \Exceptions \InvalidArgumentException ;
1212use  Ibexa \Core \FieldType \Validator \FileExtensionBlackListValidator ;
1313use  Ibexa \Core \FieldType \Value ;
14+ use  PHPUnit \Framework \MockObject \MockObject ;
1415
1516/** 
1617 * Base class for binary field types. 
1920 */ 
2021abstract  class  BinaryBaseTestCase extends  FieldTypeTestCase
2122{
22-     protected  $ blackListedExtensions
23+     /** @var string[] */ 
24+     protected  array  $ blackListedExtensions
2325        'php ' ,
2426        'php3 ' ,
2527        'phar ' ,
@@ -29,7 +31,7 @@ abstract class BinaryBaseTestCase extends FieldTypeTestCase
2931        'pgif ' ,
3032    ];
3133
32-     protected  function  getValidatorConfigurationSchemaExpectation ()
34+     protected  function  getValidatorConfigurationSchemaExpectation ():  array 
3335    {
3436        return  [
3537            'FileSizeValidator '  => [
@@ -41,7 +43,7 @@ protected function getValidatorConfigurationSchemaExpectation()
4143        ];
4244    }
4345
44-     protected  function  getConfigResolverMock ()
46+     protected  function  getConfigResolverMock ():  ConfigResolverInterface  &  MockObject 
4547    {
4648        $ configResolver$ this 
4749            ->createMock (ConfigResolverInterface::class);
@@ -54,65 +56,30 @@ protected function getConfigResolverMock()
5456        return  $ configResolver
5557    }
5658
57-     protected  function  getBlackListValidatorMock () 
59+     protected  function  getBlackListValidator ():  FileExtensionBlackListValidator 
5860    {
59-         return  $ this 
60-             ->getMockBuilder (FileExtensionBlackListValidator::class)
61-             ->setConstructorArgs ([
62-                 $ this getConfigResolverMock (),
63-             ])
64-             ->setMethods (null )
65-             ->getMock ();
61+         return  new  FileExtensionBlackListValidator ($ this getConfigResolverMock ());
6662    }
6763
68-     protected  function  getSettingsSchemaExpectation ()
64+     protected  function  getSettingsSchemaExpectation ():  array 
6965    {
7066        return  [];
7167    }
7268
73-     public  function  provideInvalidInputForAcceptValue ()
69+     public  function  provideInvalidInputForAcceptValue ():  iterable 
7470    {
75-         return  [
76-             [
77-                 $ this getMockForAbstractClass (Value::class),
78-                 InvalidArgumentException::class,
79-             ],
80-             [
81-                 ['id '  => '/foo/bar ' ],
82-                 InvalidArgumentException::class,
83-             ],
71+         yield  [
72+             $ this getMockForAbstractClass (Value::class),
73+             InvalidArgumentException::class,
74+         ];
75+ 
76+         yield  [
77+             ['id '  => '/foo/bar ' ],
78+             InvalidArgumentException::class,
8479        ];
8580    }
8681
87-     /** 
88-      * Provide data sets with validator configurations which are considered 
89-      * valid by the {@link validateValidatorConfiguration()} method. 
90-      * 
91-      * Returns an array of data provider sets with a single argument: A valid 
92-      * set of validator configurations. 
93-      * 
94-      * For example: 
95-      * 
96-      * <code> 
97-      *  return array( 
98-      *      array( 
99-      *          array(), 
100-      *      ), 
101-      *      array( 
102-      *          array( 
103-      *              'IntegerValueValidator' => array( 
104-      *                  'minIntegerValue' => 0, 
105-      *                  'maxIntegerValue' => 23, 
106-      *              ) 
107-      *          ) 
108-      *      ), 
109-      *      // ... 
110-      *  ); 
111-      * </code> 
112-      * 
113-      * @return array 
114-      */ 
115-     public  function  provideValidValidatorConfiguration ()
82+     public  function  provideValidValidatorConfiguration (): array 
11683    {
11784        return  [
11885            [
@@ -135,49 +102,7 @@ public function provideValidValidatorConfiguration()
135102        ];
136103    }
137104
138-     /** 
139-      * Provide data sets with validator configurations which are considered 
140-      * invalid by the {@link validateValidatorConfiguration()} method. The 
141-      * method must return a non-empty array of validation errors when receiving 
142-      * one of the provided values. 
143-      * 
144-      * Returns an array of data provider sets with a single argument: A valid 
145-      * set of validator configurations. 
146-      * 
147-      * For example: 
148-      * 
149-      * <code> 
150-      *  return array( 
151-      *      array( 
152-      *          array( 
153-      *              'NonExistentValidator' => array(), 
154-      *          ), 
155-      *      ), 
156-      *      array( 
157-      *          array( 
158-      *              // Typos 
159-      *              'InTEgervALUeVALIdator' => array( 
160-      *                  'minIntegerValue' => 0, 
161-      *                  'maxIntegerValue' => 23, 
162-      *              ) 
163-      *          ) 
164-      *      ), 
165-      *      array( 
166-      *          array( 
167-      *              'IntegerValueValidator' => array( 
168-      *                  // Incorrect value types 
169-      *                  'minIntegerValue' => true, 
170-      *                  'maxIntegerValue' => false, 
171-      *              ) 
172-      *          ) 
173-      *      ), 
174-      *      // ... 
175-      *  ); 
176-      * </code> 
177-      * 
178-      * @return array 
179-      */ 
180-     public  function  provideInvalidValidatorConfiguration ()
105+     public  function  provideInvalidValidatorConfiguration (): array 
181106    {
182107        return  [
183108            [
0 commit comments