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

Optimizations for Autoloader #4604

Merged
merged 3 commits into from Apr 24, 2021

Conversation

paulbalandan
Copy link
Member

Description
Optimizations include:

  • Make loading classmaps as a separate method
  • Load classmaps from Composer, if available

Checklist:

  • Securely signed commits

Comment on lines +203 to +205
$file = $this->classmap[$class] ?? '';

if (is_string($file) && $file !== '')
Copy link
Member

Choose a reason for hiding this comment

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

This seems like a whole lot of effort not to use empty().

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm using phpstan/phpstan-strict-rules in my workflows a lot, and one of the strict rules I'm following is the disallowance of empty() which implies loose comparison.

Copy link
Member

Choose a reason for hiding this comment

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

Understood. I'm not against this verbose, strict approach but I personally prefer empty() when it saves multiple conditions.

@paulbalandan paulbalandan merged commit 0198df1 into codeigniter4:develop Apr 24, 2021
@paulbalandan paulbalandan deleted the autoloader-optimize branch April 24, 2021 17:52
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.

None yet

3 participants