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: Model #8260

Merged
merged 12 commits into from
Dec 7, 2023
Merged

refactor: Model #8260

merged 12 commits into from
Dec 7, 2023

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Nov 27, 2023

Description

  • fix and add PHPDoc types
  • extract methods
  • rename parameter names

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 Nov 27, 2023
@kenjis kenjis marked this pull request as draft November 27, 2023 23:58
@kenjis kenjis marked this pull request as ready for review November 28, 2023 00:37
@kenjis kenjis mentioned this pull request Nov 28, 2023
11 tasks
Copy link
Member

@michalsn michalsn left a comment

Choose a reason for hiding this comment

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

I'm not sure about changes that restrict the use of certain methods to the Entity class only.

system/BaseModel.php Outdated Show resolved Hide resolved
system/Model.php Outdated Show resolved Hide resolved
@kenjis kenjis force-pushed the refactor-model branch 2 times, most recently from ec520ac to 4bfa67c Compare December 7, 2023 00:06
@kenjis kenjis marked this pull request as ready for review December 7, 2023 00:33
@kenjis
Copy link
Member Author

kenjis commented Dec 7, 2023

The PHPStan errors are not related to this PR.
And I cannot reproduce them in my local environment.

 ------ ----------------------------------------------------------------------- 
  Line   system/Log/Logger.php                                                  
 ------ ----------------------------------------------------------------------- 
         Ignored error pattern #^Parameter \#1 \$level \(string\) of method     
         CodeIgniter\\Log\\Logger\:\:log\(\) should be contravariant with       
         parameter \$level \(mixed\) of method                                  
         Psr\\Log\\LoggerInterface\:\:log\(\)$# in path                         
         /home/runner/work/CodeIgniter4/CodeIgniter4/system/Log/Logger.php was  
         not matched in reported errors.                                        
  159    Parameter #1 $message (string) of method                               
         CodeIgniter\Log\Logger::emergency() should be contravariant with       
         parameter $message (mixed) of method                                   
         PsrExt\Log\LoggerInterface::emergency()                                
  172    Parameter #1 $message (string) of method                               
         CodeIgniter\Log\Logger::alert() should be contravariant with           
         parameter $message (mixed) of method                                   
         PsrExt\Log\LoggerInterface::alert()                                    
  184    Parameter #1 $message (string) of method                               
         CodeIgniter\Log\Logger::critical() should be contravariant with        
         parameter $message (mixed) of method                                   
         PsrExt\Log\LoggerInterface::critical()                                 
  195    Parameter #1 $message (string) of method                               
         CodeIgniter\Log\Logger::error() should be contravariant with           
         parameter $message (mixed) of method                                   
         PsrExt\Log\LoggerInterface::error()                                    
  208    Parameter #1 $message (string) of method                               
         CodeIgniter\Log\Logger::warning() should be contravariant with         
         parameter $message (mixed) of method                                   
         PsrExt\Log\LoggerInterface::warning()                                  
  218    Parameter #1 $message (string) of method                               
         CodeIgniter\Log\Logger::notice() should be contravariant with          
         parameter $message (mixed) of method                                   
         PsrExt\Log\LoggerInterface::notice()                                   
  230    Parameter #1 $message (string) of method                               
         CodeIgniter\Log\Logger::info() should be contravariant with parameter  
         $message (mixed) of method PsrExt\Log\LoggerInterface::info()          
  240    Parameter #1 $message (string) of method                               
         CodeIgniter\Log\Logger::debug() should be contravariant with           
         parameter $message (mixed) of method                                   
         PsrExt\Log\LoggerInterface::debug()                                    
  251    Parameter #1 $level (string) of method CodeIgniter\Log\Logger::log()   
         should be contravariant with parameter $level (mixed) of method        
         PsrExt\Log\LoggerInterface::log()                                      
  251    Parameter #2 $message (string) of method                               
         CodeIgniter\Log\Logger::log() should be contravariant with parameter   
         $message (mixed) of method PsrExt\Log\LoggerInterface::log()           
 ------ ----------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------ 
  Line   system/Test/TestLogger.php                                              
 ------ ------------------------------------------------------------------------ 
         Ignored error pattern #^Parameter \#1 \$level \(string\) of method      
         CodeIgniter\\Test\\TestLogger\:\:log\(\) should be contravariant with   
         parameter \$level \(mixed\) of method                                   
         Psr\\Log\\LoggerInterface\:\:log\(\)$# in path                          
         /home/runner/work/CodeIgniter4/CodeIgniter4/system/Test/TestLogger.php  
         was not matched in reported errors.                                     
  30     Parameter #1 $level (string) of method                                  
         CodeIgniter\Test\TestLogger::log() should be contravariant with         
         parameter $level (mixed) of method PsrExt\Log\LoggerInterface::log()    
  30     Parameter #2 $message (string) of method                                
         CodeIgniter\Test\TestLogger::log() should be contravariant with         
         parameter $message (mixed) of method                                    
         PsrExt\Log\LoggerInterface::log()                                       
 ------ ------------------------------------------------------------------------ 

https://github.com/codeigniter4/CodeIgniter4/actions/runs/7121907724/job/19392022128?pr=8260

Created an issue #8300

@kenjis kenjis merged commit e49516c into codeigniter4:develop Dec 7, 2023
60 of 61 checks passed
@kenjis kenjis deleted the refactor-model branch December 7, 2023 09:24
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.

2 participants