Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove hard coded 'Y-m-d H:i:s' #1027

Merged

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Feb 14, 2024

Description
See #608 and codeigniter4/CodeIgniter4#8538

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added the refactor Pull requests that refactor code label Feb 14, 2024
@kenjis
Copy link
Member Author

kenjis commented Feb 14, 2024

I sent PR to fix: codeigniter4/CodeIgniter4#8543

 ------ --------------------------------------------------------------------- 
  Line   src/Controllers/MagicLinkController.php                              
 ------ --------------------------------------------------------------------- 
  108    Parameter #1 $row of method CodeIgniter\Model::insert() expects      
         array<int|string, float|int|string|null>|object|null, array<string,  
         CodeIgniter\I18n\Time|int|string|null> given.                        
 ------ --------------------------------------------------------------------- 

 ------ --------------------------------------------------------------------- 
  Line   src/Models/LoginModel.php                                            
 ------ --------------------------------------------------------------------- 
  77     Parameter #1 $row of method CodeIgniter\Model::insert() expects      
         array<int|string, float|int|string|null>|object|null, array<string,  
         CodeIgniter\I18n\Time|int|string|null> given.                        
 ------ --------------------------------------------------------------------- 

 ------ --------------------------------------------------------------------- 
  Line   src/Models/RememberModel.php                                         
 ------ --------------------------------------------------------------------- 
  58     Parameter #1 $row of method CodeIgniter\Model::insert() expects      
         array<int|string, float|int|string|null>|object|null, array<string,  
         CodeIgniter\I18n\Time|int|string|null> given.                        
 ------ --------------------------------------------------------------------- 

 ------ --------------------------------------------------------------------- 
  Line   tests/Authentication/MagicLinkTest.php                               
 ------ --------------------------------------------------------------------- 
  113    Parameter #1 $row of method CodeIgniter\Model::insert() expects      
         array<int|string, float|int|string|null>|object|null, array<string,  
         CodeIgniter\I18n\Time|int|string|null> given.                        
  135    Parameter #1 $row of method CodeIgniter\Model::insert() expects      
         array<int|string, float|int|string|null>|object|null, array<string,  
         CodeIgniter\I18n\Time|int|string|null> given.                        
 ------ --------------------------------------------------------------------- 

 ------ --------------------------------------------------------------------- 
  Line   tests/Controllers/MagicLinkTest.php                                  
 ------ --------------------------------------------------------------------- 
  102    Parameter #1 $row of method CodeIgniter\Model::insert() expects      
         array<int|string, float|int|string|null>|object|null, array<string,  
         CodeIgniter\I18n\Time|int|string|null> given.                        
 ------ --------------------------------------------------------------------- 

Error:  [ERROR] Found 6 errors

https://github.com/codeigniter4/shield/actions/runs/7895251231/job/21547330117?pr=1027

Copy link
Collaborator

@datamweb datamweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dateFormat has been added to CI version 4.5 In contrast, Shield supports version 4.3.5. What effect will these changes have on older versions?

src/Authentication/Authenticators/Session.php Show resolved Hide resolved
src/Models/LoginModel.php Show resolved Hide resolved
@kenjis
Copy link
Member Author

kenjis commented Feb 14, 2024

dateFormat has been added to CI version 4.5 In contrast, Shield supports version 4.3.5. What effect will these changes have on older versions?

In my understanding, there is no changes.
The Time instance that is passed to a Model will be converted to a string with hard coded Y-m-d H:i:s in the Model.
See https://github.com/codeigniter4/CodeIgniter4/blob/3595944eac90df7e499403bad8767935c41488d9/system/BaseModel.php#L1316-L1320

@datamweb datamweb closed this Feb 24, 2024
@datamweb datamweb reopened this Feb 24, 2024
@datamweb
Copy link
Collaborator

@kenjis thank you!

@datamweb datamweb merged commit 0802f39 into codeigniter4:develop Feb 24, 2024
68 checks passed
@kenjis kenjis deleted the remove-hard-coded-datetime-format branch February 24, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Pull requests that refactor code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants