Skip to content

Conversation

@tlvanknippenberg
Copy link
Contributor

I have taken the liberty of updating FileCache.php to be inline with the v2 amphp/file methods.

(This is the first time in a long while since I've contributed anything to OSS. Please let me know if I have missed anything.)

Co-authored-by: Jáchym Toušek <enumag@gmail.com>
@enumag
Copy link
Contributor

enumag commented Jun 29, 2021

Nice! I was planning to take care of this but you were faster. Looks good to me. :-)

@kelunik
Copy link
Member

kelunik commented Jun 29, 2021

@tlvanknippenberg Thanks! You currently do not have your GPG key uploaded into your account, so your commits show up as Unverified, do you want to fix that? It's not that important, because I'll squash on merge anyway.

@kelunik
Copy link
Member

kelunik commented Jun 29, 2021

We could also make it compatible with both, I guess? Check whether the new function exists and fallback to the old one?

@tlvanknippenberg
Copy link
Contributor Author

You currently do not have your GPG key uploaded into your account, so your commits show up as Unverified, do you want to fix that?

Good point. I have added keys to my account for future commits. Thanks!

@tlvanknippenberg
Copy link
Contributor Author

Regarding the backwards compatibility, would something like this be acceptable? (line 38)

                $files = yield method_exists(File::class, 'listFiles')
                    ? File\listFiles($directory)
                    : File\scandir($directory);

@kelunik
Copy link
Member

kelunik commented Jun 29, 2021

@tlvanknippenberg Yes, exactly, but we'll need function_exists('Amp\File\listFiles') ? ... : ..., as it's not a method.

@kelunik kelunik changed the title Update FileCache for amphp/file v2 Support amphp/file v2 Jun 29, 2021
@kelunik kelunik merged commit 52aa861 into amphp:master Jun 29, 2021
@kelunik
Copy link
Member

kelunik commented Jun 29, 2021

Thanks!

kelunik added a commit that referenced this pull request Jul 8, 2021
* master:
  Fix file cache keeping the GC watcher referenced (#14)
  Migrate PHPUnit configuration
  Update license
  Increase timeout in AtomicCacheTest for macOS
  Upgrade psalm to 4.x
  Fix static analysis errors
  Switch to GitHub Actions
  Support amphp/file v2 (#12)

# Conflicts:
#	.gitignore
#	composer.json
#	lib/ArrayCache.php
#	lib/Cache.php
#	lib/FileCache.php
#	lib/NullCache.php
#	lib/SerializedCache.php
#	phpunit.xml.dist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants