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

Add phpstan baseline and bump to level 2 #5975

Merged
merged 10 commits into from
May 1, 2024

Conversation

weitzman
Copy link
Member

@weitzman weitzman commented Apr 30, 2024

 ------ ------------------------------------------------------------------------------------------------ 
  Line   Commands/ConfiguresPrompts.php (in context of class Drush\Commands\DrushCommands)               
 ------ ------------------------------------------------------------------------------------------------ 
  51     Call to an undefined method Symfony\Component\Console\Style\SymfonyStyle::secret().             
         ✏️  Commands/ConfiguresPrompts.php                                                              
  91     Call to an undefined method Symfony\Component\Console\Style\SymfonyStyle::askWithCompletion().  
         ✏️  Commands/ConfiguresPrompts.php                                                              
 ------ ------------------------------------------------------------------------------------------------ 

 ------ ------------------------------------------------------------------------------ 
  Line   Commands/core/MigrateRunnerCommands.php                                       
 ------ ------------------------------------------------------------------------------ 
  391    Call to an undefined method Drupal\migrate\Plugin\MigrationInterface::set().  
         ✏️  Commands/core/MigrateRunnerCommands.php                                   
 ------ ------------------------------------------------------------------------------ 

 ------ ----------------------------------------------------------------- 
  Line   Commands/core/SiteInstallCommands.php                            
 ------ ----------------------------------------------------------------- 
  305    Result of method Drush\Style\DrushStyle::text() (void) is used.  
         ✏️  Commands/core/SiteInstallCommands.php                        
  311    Result of method Drush\Style\DrushStyle::text() (void) is used.  
         ✏️  Commands/core/SiteInstallCommands.php                        
  318    Result of method Drush\Style\DrushStyle::text() (void) is used.  
         ✏️  Commands/core/SiteInstallCommands.php                        
  325    Result of method Drush\Style\DrushStyle::text() (void) is used.  
         ✏️  Commands/core/SiteInstallCommands.php                        
  332    Result of method Drush\Style\DrushStyle::text() (void) is used.  
         ✏️  Commands/core/SiteInstallCommands.php                        
  339    Result of method Drush\Style\DrushStyle::text() (void) is used.  
         ✏️  Commands/core/SiteInstallCommands.php                        
 ------ ----------------------------------------------------------------- 

 ------ ----------------------------------------------------------------- 
  Line   Commands/field/FieldBaseOverrideCreateCommands.php               
 ------ ----------------------------------------------------------------- 
  154    Result of method Drush\Style\DrushStyle::text() (void) is used.  
         ✏️  Commands/field/FieldBaseOverrideCreateCommands.php           
  159    Result of method Drush\Style\DrushStyle::text() (void) is used.  
         ✏️  Commands/field/FieldBaseOverrideCreateCommands.php           
 ------ ----------------------------------------------------------------- 

 ------ ----------------------------------------------------------------- 
  Line   Commands/field/FieldCreateCommands.php                           
 ------ ----------------------------------------------------------------- 
  283    Result of method Drush\Style\DrushStyle::text() (void) is used.  
         ✏️  Commands/field/FieldCreateCommands.php                       
  305    Result of method Drush\Style\DrushStyle::text() (void) is used.  
         ✏️  Commands/field/FieldCreateCommands.php                       
  310    Result of method Drush\Style\DrushStyle::text() (void) is used.  
         ✏️  Commands/field/FieldCreateCommands.php                       
  394    Result of method Drush\Style\DrushStyle::text() (void) is used.  
         ✏️  Commands/field/FieldCreateCommands.php                       
 ------ ----------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------ 
  Line   Drupal/DrupalKernelTrait.php (in context of class Drush\Drupal\DrupalKernel)                    
 ------ ------------------------------------------------------------------------------------------------ 
  79     Call to an undefined method Drupal\Core\DependencyInjection\ServiceModifierInterface::check().  
         ✏️  Drupal/DrupalKernelTrait.php                                                                
 ------ ------------------------------------------------------------------------------------------------ 

 ------ ------------------------------------------------------------------------------------------------ 
  Line   Drupal/DrupalKernelTrait.php (in context of class Drush\Drupal\InstallerKernel)                 
 ------ ------------------------------------------------------------------------------------------------ 
  79     Call to an undefined method Drupal\Core\DependencyInjection\ServiceModifierInterface::check().  
         ✏️  Drupal/DrupalKernelTrait.php                                                                
 ------ ------------------------------------------------------------------------------------------------ 

 ------ ------------------------------------------------------------------------------------------------ 
  Line   Drupal/DrupalKernelTrait.php (in context of class Drush\Drupal\UpdateKernel)                    
 ------ ------------------------------------------------------------------------------------------------ 
  79     Call to an undefined method Drupal\Core\DependencyInjection\ServiceModifierInterface::check().  
         ✏️  Drupal/DrupalKernelTrait.php                                                                
 ------ ------------------------------------------------------------------------------------------------ 

 [ERROR] Found 18 errors                                                                                                


@DieterHolvoet
Copy link
Contributor

Result of method Drush\Style\DrushStyle::text() (void) is used.

This is the result of #5823. Usage of the ask() method was replaced with text(), even though text() is supposed to be used for outputting text, not collecting text. I propose switching back to ask().

Call to an undefined method Drupal\Core\Entity\EntityInterface::setComponent().

I propose adding the following before the setComponent() call: assert($storage instanceof EntityDisplayInterface)

Call to an undefined method Drupal\Core\Field\FieldStorageDefinitionInterface::isLocked().
Call to an undefined method Drupal\Core\Field\FieldStorageDefinitionInterface::getBundles().
Call to an undefined method Drupal\Core\Field\FieldStorageDefinitionInterface::delete().

I think it's safe to add an assert here as well: assert($fieldStorage instanceof FieldStorageConfigInterface);

@weitzman
Copy link
Member Author

Thanks for the assert() idea. I'll use that for a lot of fixes here.

Usage of the ask() method was replaced with text(), even though text() is supposed to be used for outputting text, not collecting text. I propose switching back to ask()

I agree, but we want pretty prompts and Laravel Prompts chose to use text() for text input instead of ask(). I think we should keep following their lead.

@DieterHolvoet
Copy link
Contributor

Well, we kinda have to follow StyleInterface here right? I would stick to ask() and call Laravel's text() in DrushStyle::ask(). The text methods do different things in Symfony and Laravel, so not much we can do there.

@weitzman weitzman merged commit 4b22734 into drush-ops:13.x May 1, 2024
2 checks passed
@weitzman weitzman deleted the phpstan-baseline branch May 1, 2024 04:05
@weitzman
Copy link
Member Author

weitzman commented May 1, 2024

Merged without fixing the items in the description. Lets tackle those in new PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants