Skip to content

Conversation

paulbalandan
Copy link
Member

Description
Fixing some phpstan issues related to access of protected properties via magic __get() and __isset().

  • PHPStan does not want to use isset() so I just compared them to null instead.
  • For tests, I just ignored them as the tests are testing those magic methods.
  • For FeatureTestTrait, I checked CIUnitTestCase declares the $session property with default empty array so I think the change is fine.

Checklist:

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

@paulbalandan paulbalandan added the refactor Pull requests that refactor code label Sep 26, 2025
}

$sqlite = (! isset($this->password) || $this->password !== '')
$sqlite = ($this->password === null || $this->password !== '')
Copy link
Member Author

Choose a reason for hiding this comment

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

@michalsn quick question. should the RHS of this conditional be checking === ''?

Copy link
Member

Choose a reason for hiding this comment

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

Good one... It's definitely a bug. It should be $this->password === ''

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, my fault #9302

Copy link
Member

Choose a reason for hiding this comment

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

I think this should be handled in a separate PR, so I'll hold off on the fix until this one is merged.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for confirming. I think this is good to be merged. Merging.

@paulbalandan paulbalandan merged commit 89fee62 into codeigniter4:develop Sep 27, 2025
49 checks passed
@paulbalandan paulbalandan deleted the isset-magic-property branch September 27, 2025 18:32
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.

4 participants