File tree Expand file tree Collapse file tree 4 files changed +22
-2
lines changed Expand file tree Collapse file tree 4 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 3232 "phpunit/phpcov" : " ^8.2" ,
3333 "phpunit/phpunit" : " ^9.1" ,
3434 "predis/predis" : " ^1.1 || ^2.0" ,
35- "rector/rector" : " 1.0.2 " ,
35+ "rector/rector" : " 1.0.3 " ,
3636 "vimeo/psalm" : " ^5.0"
3737 },
3838 "replace" : {
Original file line number Diff line number Diff line change 3030use Rector \CodingStyle \Rector \ClassMethod \FuncGetArgsToVariadicParamRector ;
3131use Rector \CodingStyle \Rector \ClassMethod \MakeInheritedMethodVisibilitySameAsParentRector ;
3232use Rector \CodingStyle \Rector \FuncCall \CountArrayToEmptyArrayComparisonRector ;
33+ use Rector \CodingStyle \Rector \FuncCall \VersionCompareFuncCallToConstantRector ;
3334use Rector \Config \RectorConfig ;
3435use Rector \DeadCode \Rector \ClassMethod \RemoveUnusedConstructorParamRector ;
3536use Rector \DeadCode \Rector \ClassMethod \RemoveUnusedPrivateMethodRector ;
189190 $ rectorConfig ->rule (CompleteDynamicPropertiesRector::class);
190191 $ rectorConfig ->rule (BooleanInIfConditionRuleFixerRector::class);
191192 $ rectorConfig ->rule (SingleInArrayToCompareRector::class);
193+ $ rectorConfig ->rule (VersionCompareFuncCallToConstantRector::class);
192194
193195 $ rectorConfig
194196 ->ruleWithConfiguration (StringClassNameToClassConstantRector::class, [
Original file line number Diff line number Diff line change @@ -765,7 +765,7 @@ protected function shouldUpdate($row): bool
765765 {
766766 $ id = $ this ->getIdValue ($ row );
767767
768- return ! ($ id === null || $ id === []);
768+ return ! ($ id === null || $ id === [] || $ id === '' );
769769 }
770770
771771 /**
Original file line number Diff line number Diff line change @@ -44,6 +44,24 @@ public function testSaveNewRecordObject(): void
4444 $ this ->seeInDatabase ('job ' , ['name ' => 'Magician ' ]);
4545 }
4646
47+ /**
48+ * @see https://github.com/codeigniter4/CodeIgniter4/issues/8613
49+ */
50+ public function testSaveNewRecordArrayWithEmptyStringId (): void
51+ {
52+ $ this ->createModel (JobModel::class);
53+
54+ $ data = [
55+ 'id ' => '' ,
56+ 'name ' => 'Magician ' ,
57+ 'description ' => 'Makes peoples things dissappear. ' ,
58+ ];
59+
60+ $ this ->model ->save ($ data );
61+
62+ $ this ->seeInDatabase ('job ' , ['name ' => 'Magician ' ]);
63+ }
64+
4765 public function testSaveNewRecordArray (): void
4866 {
4967 $ this ->createModel (JobModel::class);
You can’t perform that action at this time.
0 commit comments