Skip to content

Commit 03cc8b1

Browse files
committed
refactor: fix phpstan no type specified UpdateModelTest
1 parent df5ad3c commit 03cc8b1

File tree

3 files changed

+95
-122
lines changed

3 files changed

+95
-122
lines changed

tests/system/Models/UpdateModelTest.php

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,44 @@ public function testUpdateBatchValidationFail(): void
208208
public function testUpdateBatchWithEntity(): void
209209
{
210210
$entity1 = new class () extends Entity {
211+
/**
212+
* @var int
213+
*/
211214
protected $id;
215+
216+
/**
217+
* @var string
218+
*/
212219
protected $name;
220+
221+
/**
222+
* @var string
223+
*/
213224
protected $email;
225+
226+
/**
227+
* @var string
228+
*/
214229
protected $country;
230+
231+
/**
232+
* @var bool
233+
*/
215234
protected $deleted;
235+
236+
/**
237+
* @var string|null
238+
*/
216239
protected $created_at;
240+
241+
/**
242+
* @var string|null
243+
*/
217244
protected $updated_at;
245+
246+
/**
247+
* @var array{'datamap': array{}, 'dates': array{string, string, string}, 'casts': array{}}|null
248+
*/
218249
protected $_options = [
219250
'datamap' => [],
220251
'dates' => [
@@ -227,13 +258,44 @@ public function testUpdateBatchWithEntity(): void
227258
};
228259

229260
$entity2 = new class () extends Entity {
261+
/**
262+
* @var int
263+
*/
230264
protected $id;
265+
266+
/**
267+
* @var string
268+
*/
231269
protected $name;
270+
271+
/**
272+
* @var string
273+
*/
232274
protected $email;
275+
276+
/**
277+
* @var string
278+
*/
233279
protected $country;
280+
281+
/**
282+
* @var bool
283+
*/
234284
protected $deleted;
285+
286+
/**
287+
* @var string|null
288+
*/
235289
protected $created_at;
290+
291+
/**
292+
* @var string|null
293+
*/
236294
protected $updated_at;
295+
296+
/**
297+
* @var array{'datamap': array{}, 'dates': array{string, string, string}, 'casts': array{}}|null
298+
*/
237299
protected $_options = [
238300
'datamap' => [],
239301
'dates' => [
@@ -399,13 +461,44 @@ public function testUpdateWithEntityNoAllowedFields(): void
399461
$this->createModel(UserModel::class);
400462

401463
$entity = new class () extends Entity {
464+
/**
465+
* @var int
466+
*/
402467
protected $id;
468+
469+
/**
470+
* @var string
471+
*/
403472
protected $name;
473+
474+
/**
475+
* @var string
476+
*/
404477
protected $email;
478+
479+
/**
480+
* @var string
481+
*/
405482
protected $country;
483+
484+
/**
485+
* @var bool
486+
*/
406487
protected $deleted;
488+
489+
/**
490+
* @var int|null
491+
*/
407492
protected $created_at;
493+
494+
/**
495+
* @var int|null
496+
*/
408497
protected $updated_at;
498+
499+
/**
500+
* @var array{'datamap': array{}, 'dates': array{string, string, string}, 'casts': array{}}|null
501+
*/
409502
protected $_options = [
410503
'datamap' => [],
411504
'dates' => [

utils/phpstan-baseline/loader.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# total 2116 errors
1+
# total 2092 errors
22

33
includes:
44
- argument.type.neon

utils/phpstan-baseline/missingType.property.neon

Lines changed: 1 addition & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# total 101 errors
1+
# total 77 errors
22

33
parameters:
44
ignoreErrors:
@@ -386,123 +386,3 @@ parameters:
386386
message: '#^Property CodeIgniter\\Model@anonymous/tests/system/Models/SaveModelTest\.php\:290\:\:\$name has no type specified\.$#'
387387
count: 1
388388
path: ../../tests/system/Models/SaveModelTest.php
389-
390-
-
391-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:210\:\:\$_options has no type specified\.$#'
392-
count: 1
393-
path: ../../tests/system/Models/UpdateModelTest.php
394-
395-
-
396-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:210\:\:\$country has no type specified\.$#'
397-
count: 1
398-
path: ../../tests/system/Models/UpdateModelTest.php
399-
400-
-
401-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:210\:\:\$created_at has no type specified\.$#'
402-
count: 1
403-
path: ../../tests/system/Models/UpdateModelTest.php
404-
405-
-
406-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:210\:\:\$deleted has no type specified\.$#'
407-
count: 1
408-
path: ../../tests/system/Models/UpdateModelTest.php
409-
410-
-
411-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:210\:\:\$email has no type specified\.$#'
412-
count: 1
413-
path: ../../tests/system/Models/UpdateModelTest.php
414-
415-
-
416-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:210\:\:\$id has no type specified\.$#'
417-
count: 1
418-
path: ../../tests/system/Models/UpdateModelTest.php
419-
420-
-
421-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:210\:\:\$name has no type specified\.$#'
422-
count: 1
423-
path: ../../tests/system/Models/UpdateModelTest.php
424-
425-
-
426-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:210\:\:\$updated_at has no type specified\.$#'
427-
count: 1
428-
path: ../../tests/system/Models/UpdateModelTest.php
429-
430-
-
431-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:229\:\:\$_options has no type specified\.$#'
432-
count: 1
433-
path: ../../tests/system/Models/UpdateModelTest.php
434-
435-
-
436-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:229\:\:\$country has no type specified\.$#'
437-
count: 1
438-
path: ../../tests/system/Models/UpdateModelTest.php
439-
440-
-
441-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:229\:\:\$created_at has no type specified\.$#'
442-
count: 1
443-
path: ../../tests/system/Models/UpdateModelTest.php
444-
445-
-
446-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:229\:\:\$deleted has no type specified\.$#'
447-
count: 1
448-
path: ../../tests/system/Models/UpdateModelTest.php
449-
450-
-
451-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:229\:\:\$email has no type specified\.$#'
452-
count: 1
453-
path: ../../tests/system/Models/UpdateModelTest.php
454-
455-
-
456-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:229\:\:\$id has no type specified\.$#'
457-
count: 1
458-
path: ../../tests/system/Models/UpdateModelTest.php
459-
460-
-
461-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:229\:\:\$name has no type specified\.$#'
462-
count: 1
463-
path: ../../tests/system/Models/UpdateModelTest.php
464-
465-
-
466-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:229\:\:\$updated_at has no type specified\.$#'
467-
count: 1
468-
path: ../../tests/system/Models/UpdateModelTest.php
469-
470-
-
471-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:401\:\:\$_options has no type specified\.$#'
472-
count: 1
473-
path: ../../tests/system/Models/UpdateModelTest.php
474-
475-
-
476-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:401\:\:\$country has no type specified\.$#'
477-
count: 1
478-
path: ../../tests/system/Models/UpdateModelTest.php
479-
480-
-
481-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:401\:\:\$created_at has no type specified\.$#'
482-
count: 1
483-
path: ../../tests/system/Models/UpdateModelTest.php
484-
485-
-
486-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:401\:\:\$deleted has no type specified\.$#'
487-
count: 1
488-
path: ../../tests/system/Models/UpdateModelTest.php
489-
490-
-
491-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:401\:\:\$email has no type specified\.$#'
492-
count: 1
493-
path: ../../tests/system/Models/UpdateModelTest.php
494-
495-
-
496-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:401\:\:\$id has no type specified\.$#'
497-
count: 1
498-
path: ../../tests/system/Models/UpdateModelTest.php
499-
500-
-
501-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:401\:\:\$name has no type specified\.$#'
502-
count: 1
503-
path: ../../tests/system/Models/UpdateModelTest.php
504-
505-
-
506-
message: '#^Property CodeIgniter\\Entity\\Entity@anonymous/tests/system/Models/UpdateModelTest\.php\:401\:\:\$updated_at has no type specified\.$#'
507-
count: 1
508-
path: ../../tests/system/Models/UpdateModelTest.php

0 commit comments

Comments
 (0)