Skip to content

Fix undefined property BaseConfig::$key#3808

Merged
samsonasik merged 1 commit intocodeigniter4:developfrom
paulbalandan:undefined-baseconfig-prop
Oct 24, 2020
Merged

Fix undefined property BaseConfig::$key#3808
samsonasik merged 1 commit intocodeigniter4:developfrom
paulbalandan:undefined-baseconfig-prop

Conversation

@paulbalandan
Copy link
Copy Markdown
Member

Description
Before PHPStan v0.12.51, initialisation of Config\Encryption's $key property via BaseConfig is not marked as error. This was due to, as the author states, PHPStan not really doing the check at all. However, this is now being marked as erroneous.

See: phpstan/phpstan@3998

Checklist:

  • Securely signed commits
  • Component(s) with PHPdocs
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@samsonasik samsonasik merged commit 30f60bf into codeigniter4:develop Oct 24, 2020
@samsonasik
Copy link
Copy Markdown
Member

Thank you @paulbalandan

$this->initEnvValue($this->$property, $property, $prefix, $shortPrefix);

if ($shortPrefix === 'encryption' && $property === 'key')
if ($this instanceof Encryption && $property === 'key')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

actually, parent should not know about the child implementation, but probably that next refactor, like have abstract method that called and overridden in child.

@paulbalandan paulbalandan deleted the undefined-baseconfig-prop branch October 25, 2020 04:45
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.

3 participants