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

Use hardcoded path to i18n file if not provided #290

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

carlos-granados
Copy link
Contributor

Alternate solution to the problem described in Behat/Behat#1602 and Behat/Behat#1603. Since the file that CachedArrayKeywords needs to load is in the same package, it does not need to be told its location by another package. We keep the option of passing a file name in case someone is using this class to load an i18n file from some other location. After this is merged in this package we should update Behat so that it does not attempt to provide the path to the file

Co-authored-by: Christophe Coevoet <[email protected]>
Copy link
Contributor

@acoulton acoulton left a comment

Choose a reason for hiding this comment

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

I think this is a good solution, but maybe we should also revert moving the files in the src directory, at least for now?

Otherwise it will only work if we release Gherkin and Behat at the same time (and bump the minimum version requirement in Behat).

Also Behat may not be the only thing using this class with a path to the Gherkin i18n file - I'm not sure the limited benefit we get from flattening the directory structure is worth even a small risk of causing problems for other people?

{
parent::__construct(include $file);
parent::__construct(include $file ?? self::I18N_FILE_LOCATION);
Copy link
Contributor

Choose a reason for hiding this comment

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

should we change this to require while we're here? include would still fail if the file didn't exist, as the false wouldn't match the array typehint on the parent constructor - but require would give a better error message?

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.

3 participants