xyNNN / GoogleTagManagerBundle

Google Tag Manager Bundle for Symfony 2
https://github.com/xyNNN/GoogleTagManagerBundle
GNU Lesser General Public License v3.0
27 stars 15 forks source link

minor fix #48

Closed dsbe-ak closed 1 year ago

dsbe-ak commented 1 year ago

I got the error "Typed property must not be accessed before initialization" which was fixed by setting additionalParameters = ''

dsbe-ak commented 1 year ago

Are you happy to merge/release?

xyNNN commented 1 year ago

Thanks for the fix, why not make it optional?

private ?string $additionalParameters;
dsbe-ak commented 1 year ago

I think the issue here is, that additionalParameters is undefined (null != undefined), therefore I added a default value (so setting an empty string seemed to me the easiest way here).


See https://stackoverflow.com/questions/59265625/why-i-am-suddenly-getting-a-typed-property-must-not-be-accessed-before-initiali

xyNNN commented 1 year ago

Sure, but why not using as initial value NULL instead of an empty string? @dsbe-ak

dsbe-ak commented 1 year ago

In my opinion it is not necessary to change the type to solve this error. Empty string as default value looks fine by me.

xyNNN commented 1 year ago

From my point of view empty string and null are to different states. And null is more better for a state which describes it is not initialized or used.

xyNNN commented 1 year ago

But anyway, I will merge it and create a new release

dsbe-ak commented 1 year ago

Thank you!