Skip to content

Commit

Permalink
minor #41650 [FrameworkBundle] Make AbstractDataCollector extend Data…
Browse files Browse the repository at this point in the history
…Collector to reduce boilerplate (IonBazan)

This PR was merged into the 5.2 branch.

Discussion
----------

[FrameworkBundle] Make AbstractDataCollector extend DataCollector to reduce boilerplate

| Q             | A
| ------------- | ---
| Branch?       | 5.2
| Bug fix?      | yes
| New feature?  |  no
| Deprecations? | no
| Tickets       | Partially fixes #41577 (part 1)
| License       | MIT

This PR makes `AbstractDataCollector` extend the base `DataCollector` in order to make it even easier to create the data collectors. Currently, developers must implement `__sleep()`, `__wakeup()`, `cloneVar()` etc on their own if they want to use `AbstractDataCollector` instead of the good old `DataCollector` which makes the "boilerplate" even bigger than just adding the `getName()`, `reset()` and `getTemplate()`, making this class less useful than the old one.

Commits
-------

c8ec05d make AbstractDataCollector extend DataCollector to reduce boilerplate
  • Loading branch information
nicolas-grekas committed Jul 12, 2021
2 parents 17b0187 + c8ec05d commit da1a33e
Showing 1 changed file with 3 additions and 6 deletions.
Expand Up @@ -11,16 +11,13 @@

namespace Symfony\Bundle\FrameworkBundle\DataCollector;

use Symfony\Component\HttpKernel\DataCollector\DataCollector;

/**
* @author Laurent VOULLEMIER <laurent.voullemier@gmail.com>
*/
abstract class AbstractDataCollector implements TemplateAwareDataCollectorInterface
abstract class AbstractDataCollector extends DataCollector implements TemplateAwareDataCollectorInterface
{
/**
* @var array
*/
protected $data = [];

public function getName(): string
{
return static::class;
Expand Down

0 comments on commit da1a33e

Please sign in to comment.