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

Allow loading different YAML extensions #1078

Merged
merged 1 commit into from
May 3, 2019

Conversation

scaytrase
Copy link
Contributor

@scaytrase scaytrase commented Apr 30, 2019

Q A
Bug fix? no
New feature? yes
Doc updated no
BC breaks? no
Deprecations? yes (TBD)
Tests pass? yes
Fixed tickets #1077
License MIT

Collaspse AbstractFileDriver into YamlDriver to allow multiple extensions (yaml, yml) to processed. Updated some tests

Fixes #1077

cc. @goetas

]), new IdenticalPropertyNamingStrategy(), null, $this->getExpressionEvaluator());
];

if ($addUnderscoreDir) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one broke getAllClassNames testm since this is invalid dir for most cases, but only getAllClassNames iterates over all directories and fails. So I made this optional

@@ -0,0 +1,4 @@
JMS\Serializer\Tests\Fixtures\Person:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just copy-pasted some files in order to check loadability

Copy link
Collaborator

@goetas goetas left a comment

Choose a reason for hiding this comment

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

Hi,
thanks a lot for your PR and I'm sorry if it took so long to review it.

Beside two small comments to me looks good.

#1078 (comment) is about keeping maximum compatibility

#1078 (comment) is just a minor CS issue

use Symfony\Component\Yaml\Yaml;

class YamlDriver extends AbstractFileDriver
class YamlDriver implements AdvancedDriverInterface
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it make sense just for compatibility to still extend AbstractFileDriver?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of it public and protected contracts were kept. Only instance of AbstractFileDriver should break. if it's not enougth we can keep extension with everything overrided

@@ -32,27 +36,74 @@ class YamlDriver extends AbstractFileDriver
* @var PropertyNamingStrategyInterface
*/
private $namingStrategy;
/**
* @var FileLocatorInterface|FileLocator
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need the FileLocator typehint here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really, just copy-pasted from metadata. Will fix it

@scaytrase
Copy link
Contributor Author

@goetas fixed both comments

@goetas goetas merged commit fa9b22a into schmittjoh:master May 3, 2019
@goetas
Copy link
Collaborator

goetas commented May 3, 2019

Thanks a lot!

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.

Support *.yaml extension
2 participants