Skip to content

Commit c3f504f

Browse files
minor #41650 [FrameworkBundle] Make AbstractDataCollector extend DataCollector 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 ------- c8ec05d424 make AbstractDataCollector extend DataCollector to reduce boilerplate
2 parents 27d3963 + ed2748e commit c3f504f

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

DataCollector/AbstractDataCollector.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,13 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\DataCollector;
1313

14+
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
15+
1416
/**
1517
* @author Laurent VOULLEMIER <[email protected]>
1618
*/
17-
abstract class AbstractDataCollector implements TemplateAwareDataCollectorInterface
19+
abstract class AbstractDataCollector extends DataCollector implements TemplateAwareDataCollectorInterface
1820
{
19-
/**
20-
* @var array
21-
*/
22-
protected $data = [];
23-
2421
public function getName(): string
2522
{
2623
return static::class;

0 commit comments

Comments
 (0)