Skip to content

fix: autoRotate() ignores its boolean argument - #56

Merged
Baspa merged 3 commits into
mainfrom
fix/autorotate-bool
Jun 18, 2026
Merged

Baspa merged 3 commits into
mainfrom
fix/autorotate-bool

Conversation

@Baspa

@Baspa Baspa commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Bug

Two defects combined to make autoRotate() always emit -/autorotate/no/ regardless of the argument passed:

  1. src/Transformations.phpautoRotate(bool $rotate) called AutoRotate::transform() with no arguments, discarding $rotate entirely.

  2. src/Transformations/AutoRotate.phptransform() read $args['auto_rotate'] ?? false, a named-key lookup that can never be satisfied when the method receives positional variadic args, so it always resolved to false.

Fix

  • In src/Transformations.php: pass the bool — AutoRotate::transform($rotate).
  • In src/Transformations/AutoRotate.php: read the positional arg — $autoRotate = $args[0] ?? false;.

Test added

it('honors the boolean argument in autoRotate', function () {
    $uuid = '12a3456b-c789-1234-1de2-3cfa83096e25';

    expect((string) uploadcare($uuid)->autoRotate(true))->toContain('-/autorotate/yes/');
    expect((string) uploadcare($uuid)->autoRotate(false))->toContain('-/autorotate/no/');
});

@Baspa Baspa changed the title Fix: autoRotate() ignores its boolean argument fix: autoRotate() ignores its boolean argument Jun 18, 2026
# Conflicts:
#	tests/TransformationTest.php
@Baspa
Baspa merged commit 95a408f into main Jun 18, 2026
20 checks passed
@Baspa
Baspa deleted the fix/autorotate-bool branch June 18, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant