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

Support custom SplFileInfo objects in Phar::buildFromIterator() #14143

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

nielsdos
Copy link
Member

@nielsdos nielsdos commented May 5, 2024

While it is possible to return a custom SplFileInfo object in the
iterator used by buildFromIterator(), the data is not actually used from
that object, instead the data from the underlying internal structure is
used. This makes it impossible to override some metadata such as the
path name and modification time.

The main motivation comes from two reasons:

  • Consistency. We expect our custom methods to be called when having a
    custom object.
  • Support reproducibility. This is the original use case as requested in
    [1].

Add support for this by calling the getMTime() and getPathname() methods
if they're overriden by a user class.

[1] theseer/Autoload#114.

While it is possible to return a custom SplFileInfo object in the
iterator used by buildFromIterator(), the data is not actually used from
that object, instead the data from the underlying internal structure is
used. This makes it impossible to override some metadata such as the
path name and modification time.

The main motivation comes from two reasons:
- Consistency. We expect our custom methods to be called when having a
  custom object.
- Support reproducibility. This is the original use case as requested in
  [1].

Add support for this by calling the getMTime() and getPathname() methods
if they're overriden by a user class.

[1] theseer/Autoload#114.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant