thephpleague / fractal

Output complex, flexible, AJAX/RESTful data structures.
fractal.thephpleague.com
MIT License
3.53k stars 351 forks source link

Breaking change between 0.19.2 and 0.20.0 #556

Open vlowe85 opened 2 years ago

vlowe85 commented 2 years ago

Is there an upgrade guide for breaking changes between versions?

vlowe85 commented 2 years ago

See this commit https://github.com/thephpleague/fractal/commit/5bf32b5fa3717b360d31348793d9fe9cb65fe337 (Added PHP 7.4 types)

protected function item($data, $transformer, ?string $resourceKey = null): Item item still works ok as not enforcing callable, primitive is broken.. protected function primitive($data, ?callable $transformer = null, ?string $resourceKey = null): Primitive

when used like

    public function includeFavorites(User $user)
    {
        return $this->primitive($user, new FavoritesTransformer);
    }