Skip to content

Releases: dedoc/scramble

v0.12.31

24 Aug 11:38
ff8fd42
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.12.30...v0.12.31

v0.12.30

14 Aug 13:21
2138ec1
Compare
Choose a tag to compare

What's Changed

  • Add support for transforming inferred paginator types by @romalytvynenko in #931
  • Add support for transforming response type with headers to schema and improve collection responses type to schema transformation by @romalytvynenko in #932
  • Add support for system color theme by @macbookandrew in #923

New Contributors

Full Changelog: v0.12.29...v0.12.30

v0.12.29

12 Aug 12:18
b1fecfa
Compare
Choose a tag to compare

What's Changed

  • Fixed Scramble silently logs error when mixed used in a function return type hint by @romalytvynenko in #920
  • Preserve enum cases description when adding description to enum class or properties where enum is used by @romalytvynenko in #926
  • Fixed duplicated schemas in generated spec when using FQN with leading slash in PHPDoc by @romalytvynenko in #929
  • Fixed document serialization issue when response is removed from components by @romalytvynenko in #930

Full Changelog: v0.12.28...v0.12.29

v0.12.28

04 Aug 12:22
Compare
Choose a tag to compare

What's Changed

  • Fixed ClassConstFetchTypeGetter breaking when fetching class const on new expression by @romalytvynenko in #918

Full Changelog: v0.12.27...v0.12.28

v0.12.27

03 Aug 09:26
1cc4038
Compare
Choose a tag to compare

Deeper setter analysis

When analyzing method calls, Scramble now infers much more useful type information thanks to deeper setter analysis.

Consider this example:

class Foo
{
    property int $foo;

    public function __construct()
    {
        $this->setFoo(42);
    }

    public function setFoo(int $foo): self
    {
        $this->foo = $foo;
        return $this;
    }
}

Previously, Scramble correctly inferred that new Foo() produces a Foo<42>.

However, if you move the setter call into a setup method, Scramble used to lose that information:

class Foo
{
    property int $foo;

    public function __construct()
    {
        $this->setup();
    }

    private function setup(): void
    {
        $this->setFoo(42);
    }

    public function setFoo(int $foo): self
    {
        $this->foo = $foo;
        return $this;
    }
}

In this case, Scramble would no longer know that $foo had been set to 42.

This release fixes that: the example above now works perfectly as expected. Deep setter analysis applies not only in __construct but in any class method.

This enhancement makes Scramble more accurate across a broader range of codebases, letting you focus on your business logic instead of adding extra annotations.

Performance improvements

Deeper setter analysis requires analyzing more code and doing more work. So initially, the draft version of this feature severely impacted Scramble's performance (slowing it down by 2x — sic!).

Fixing this performance regression not only resulted in a 10% speed-up over the original performance levels but also slightly reduced memory usage.

Long story short: the performance gain came from skipping work that wasn’t absolutely necessary. So, going back to the latest example: if setup or setFoo methods are never called in places Scramble actually cares about (like API controllers), they won’t be analyzed — which significantly boosts performance.

Also, if you have a statement like return count(some_complex_function()), some_complex_function() won’t be analyzed at all, since count is known to return an int regardless of the arguments you pass.

This required some internal changes to how arguments are handled, which might technically be breaking changes — but they shouldn’t affect you, since it’s all internal.

🚨 Potentially breaking changes

This release does not introduce any changes to the public API documented in the docs. However, if you rely on undocumented internals to extend type inference, please note:

  • All call event classes' arguments property is now an instance of Dedoc\Scramble\Infer\Contracts\ArgumentTypeBag, instead of plain array<string, Type>. This affects Dedoc\Scramble\Infer\Extensions\Event\{AnyMethodCallEvent, FunctionCallEvent, MethodCallEvent, SideEffectCallEvent, StaticMethodCallEvent} classes.
  • The early "side effects" concept has been replaced by industry-adopted self-out types (does anyone understand this sentence at all?). As a result, the following classes have been removed: Dedoc\Scramble\Support\Type\SideEffects\{SelfTemplateDefinition, ParentConstructCall}.

What's Changed

Full Changelog: v0.12.26...v0.12.27

v0.12.26

27 Jul 11:51
cf49fb8
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.12.25...v0.12.26

v0.12.25

26 Jul 19:41
a236fa5
Compare
Choose a tag to compare

What's Changed

  • Validation rules documentation is retrieved from inferred type rather than from AST nodes by @romalytvynenko in #906
  • Fixed performance regression and too much memory usage by @romalytvynenko in #907

Full Changelog: v0.12.24...v0.12.25

v0.12.24

25 Jul 08:55
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.12.23...v0.12.24

v0.12.23

17 Jun 07:00
5b65016
Compare
Choose a tag to compare

What's Changed

  • Fixed document level tags ordering when using weight argument on #[Group] attribute by @romalytvynenko in #870
  • Fix setOperationId called in an operation transformer not working by @romalytvynenko in #872

Full Changelog: v0.12.22...v0.12.23

v0.12.22

03 Jun 09:06
3c06a75
Compare
Choose a tag to compare

What's Changed

  • Fixed incorrect generic creation when looking for JSON resource in anonymous resource collection by @romalytvynenko in #862
  • Fixed memory leak when running tests if there are extensions registered via programmatic API by @romalytvynenko in #864
  • Allow using #[Group] attribute on route's controller methods by @romalytvynenko in #865

Full Changelog: v0.12.21...v0.12.22