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

Adding more types in the FileFinder #2606

Merged
merged 3 commits into from Mar 22, 2024
Merged

Conversation

mamazu
Copy link
Contributor

@mamazu mamazu commented Mar 17, 2024

Todo maybe: This class does a lot of copying with file path arrays maybe it would make more sense to refactor this to either append the arrays or to copy only once with the spread operator.

Either:

$filePaths = [];
$this->parentFilePaths($reflection, $filePaths);
$this->interfaceFilePaths($reflection, $filePaths);

return FileList::fromFilePaths($filePaths);

or:

return FileList::fromFilePaths([
    ...$filePaths,
    ...$this->parentFilePaths($reflection),
    ...$this->interfaceFilePaths($reflection),
]);

/**
* @param array<string> $filePaths
*
* @return array<string>
Copy link
Collaborator

Choose a reason for hiding this comment

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

this was array<string|null>? is this definitely not handled? we could also skip if it's NULL for whatever reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah seeing that this never crashes it seems like it's never null but yeah, skipping those would probably be the better option.

@dantleech dantleech merged commit a6f3a78 into phpactor:master Mar 22, 2024
10 checks passed
@dantleech
Copy link
Collaborator

thanks!

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

2 participants