Problem/Motivation
During running the drupal-check
on the Drupal 10 compatibility issue, phpstan
reported the $config
variable might be undefined in modules/sendgrid_integration_reports/src/Api.php. The changes there did not make sense as they are not related to the Drupal 10 compatibility, hence this issue is open. The problem here is, if the config variable is empty (i.e the config is not retrieved from factory), the following $start_date
and $end_date
variables will always have their default value, and not the one stored in config.
- https://git.drupalcode.org/project/sendgrid_integration/-/blob/8.x-2.x/m...
- https://git.drupalcode.org/project/sendgrid_integration/-/blob/8.x-2.x/m...
Also, there were some $stats_data
variable checks where the variable did not exist possibly because of a type on the variable name.
Steps to reproduce
Proposed resolution
Retrieve the config before setting the variables.
$config = $this
->configFactory
->get('sendgrid_integration_reports.settings')
->get();
Rename occurrences of $statsdata
to $stats_data
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork sendgrid_integration-3306626
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
balintpekkerComment #6
Perignon CreditAttribution: Perignon commentedMerged PR
Comment #7
balintpekker