Skip to content

Allow setting yamlInline for ObjectDriver #212

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

Merged

Conversation

tassilogroeper
Copy link
Contributor

See issue #211

@@ -12,6 +12,11 @@

class ObjectDriver implements Driver
{
public function __construct(
Copy link
Member

Choose a reason for hiding this comment

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

Instead of this single parameter, let's allow passing an array with options.

The default options should be

  'yaml_inline' => 2,
  'yaml_indent' => 4,
  'yaml_flags' => Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK,

Any options passed should be merged with the defaults.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also thought about it. fine with me.
However, I had a hard time, testing the indentation. The dedent function does behave, like I expected.
E.g. When setting the intent to 2 only the first line is corrected, but the others are still indented by 4 ?!

If you are fine to have a test for only the inline var, I can do it in my PR.

Copy link
Member

Choose a reason for hiding this comment

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

If you are fine to have a test for only the inline var, I can do it in my PR.

That's ok!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool! Requested changes are done!

@freekmurze
Copy link
Member

The tests are failing, could you take a look?

@tassilogroeper
Copy link
Contributor Author

tassilogroeper commented May 5, 2025

@freekmurze Sorry, but the tests are failing on an unrelated file in PHP 8.4, not subject to my changes AFAIK.

Is it possible, getMockForTrait got removed from phpUnit?

@freekmurze
Copy link
Member

I've fixed the tests on main. Could you rebase with main? That should fix the tests here as well.

@tassilogroeper tassilogroeper force-pushed the feature-object-driver-nesting branch from 7535cb2 to f4ac407 Compare May 7, 2025 12:31
@tassilogroeper
Copy link
Contributor Author

@freekmurze whohooo! Tests are green again

@freekmurze freekmurze merged commit 1b1825c into spatie:main May 8, 2025
17 checks passed
@freekmurze
Copy link
Member

Thank you very much!

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.

2 participants