Skip to content

Conversation

paulbalandan
Copy link
Member

Description
Fixing some phpstan errors. Hope I did not break anything.

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

@paulbalandan paulbalandan added the refactor Pull requests that refactor code label May 26, 2025
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.

Thanks, looks good!

@michalsn michalsn merged commit 63ab555 into codeigniter4:develop May 31, 2025
83 of 84 checks passed
@paulbalandan paulbalandan deleted the refactor-logger branch May 31, 2025 08:01
@mjomble
Copy link

mjomble commented Sep 17, 2025

Looks like it did break something 😁

In isEmpty(), return empty($this->data); was correct, but return $this->data !== []; actually checks for "is not empty".

Also, both this and if (! empty($this->data)) { in collectLogs() assume $this->data is always an array, but it starts out as null.

And ironically, due to this very assumption, it will always remain null 😄

Seems to me like empty() is perfect here, covering both the null and empty array cases.
Does phpstan recommend avoiding it? If so, I wonder why?

@paulbalandan
Copy link
Member Author

Hi @mjomble , please send a PR fixing those. We're moving away from use of empty() as it is a loose check.

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.

3 participants