Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[TwigBridge] fix FormExtension::$renderer bc break#20710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
fbourigault wants to merge1 commit intosymfony:3.2fromfbourigault:fix-twig-bridge-bc-break
Closed

[TwigBridge] fix FormExtension::$renderer bc break#20710

fbourigault wants to merge1 commit intosymfony:3.2fromfbourigault:fix-twig-bridge-bc-break

Conversation

@fbourigault
Copy link
Contributor

QA
Branch?3.2
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?yes?
Tests pass?yes
Fixed ticketsN/A
LicenseMIT
Doc PRN/A

Beforeb515702, theFormExtension::$renderer property was not declared but initialized inFormExtension::__construct(). This makes the property visibility to public. Inb515702, the property was declared but with a private visibility. This broke the backward compatibility of the
FormExtension class.

    Beforeb515702, the FormExtension::$renderer property was notdeclared but initialized in FormExtension::__construct(). This makes theproperty visibility to public. Inb515702, the property was declared butwith a private visibility. This broke the backward compatibility of theFormExtension class.
/**
* Make this property private in 4.0.
*/
public$renderer;
Copy link
Contributor

@greg0iregreg0ireDec 1, 2016
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Maybe a better way might be to keep it private and use a magic getter to throw a deprecation notice? I know, magic is bad, but deprecation notices might outweight this?

Copy link
ContributorAuthor

@fbourigaultfbourigaultDec 1, 2016
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I like the idea but how to avoid access to properties other than$renderer in a nice way? Throwing aRuntimeException? And what about__isset and__unset ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'd indeed throw an exception. And yeah,__isset and__unset would have to be implemented, so… not sure it's worth the hassle.

{
private$renderer;
/**
* Make this property private in 4.0.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

please mark it as@internal though, so that IDEs warn users

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

btw, no need to mark it as private in 4.0, as it will be removed.

fbourigault reacted with thumbs up emoji
@stof
Copy link
Member

stof commentedDec 1, 2016

I'm not even sure this will solve your issue, as I don't think the property is initialized anymore in core (due to deprecation)

@fbourigault
Copy link
ContributorAuthor

You are right. Is adding re-adding the dependency as lazy to avoid the circular reference problem fixed inb515702, removing the deprecated notice from the constructor (I think Symfony should not trigger deprecated when using own objects) and using magic methods with deprecation notice will solve the issue?

@stof
Copy link
Member

stof commentedDec 1, 2016

Note however that I'm not sure this should be actually fixed. A property not defined in the code cannot really be considered as being part of our public API covered by the BC promise (and if it had been declared explicitly previously, it would have been tagged as@internal btw, excluding it from the BC promise).

@fbourigault
Copy link
ContributorAuthor

I understand that the missing property was a mistake and if it existed, it will never been with a public visibility, but at least one bundle (sonata-project/SonataAdminBundle#4216) was using it. As sonata-project has a BC release process, it may be ok to not fix it in Symfony, but it may have other libraries relying on this public property (I don't have any example).

@stof
Copy link
Member

stof commentedDec 2, 2016

@fbourigault it would still have been public (it was necessary before) but it would have been an internal one.
And I would argue that a property not defined in the source code should not be considered part of the public API of Symfony.

@greg0ire
Copy link
Contributor

I agree that we can't really expect an undeclared property to be part of the BC promise. Relying on it in the first place was a mistake. We must fix this on the Sonata side.

@fabpot
Copy link
Member

Does it mean we can close this one?

@greg0ire
Copy link
Contributor

I think so.

@fbourigault
Copy link
ContributorAuthor

fbourigault commentedDec 2, 2016
edited
Loading

Closing because this is notconsidered as acovered by BCbreakpromise.

@fbourigaultfbourigault deleted the fix-twig-bridge-bc-break branchDecember 2, 2016 12:35
@stof
Copy link
Member

stof commentedDec 2, 2016

@fbourigault it is not that we don't consider it as a BC break (it is one indeed). But we consider that it is not covered by our BC promise, as being part of an internal implementation

@greg0ire
Copy link
Contributor

greg0ire commentedDec 2, 2016
edited
Loading

@fbourigault : I second that, everything is a BC-break ;)

bcbreak

fbourigault, stof, stloyd, and ogizanagi reacted with laugh emoji

@fbourigault
Copy link
ContributorAuthor

@stof@greg0ire I just used the wrong words in my closing comment!

@fbourigault
Copy link
ContributorAuthor

@nicolas-grekas opened a PR using magic methods:#20769

fabpot added a commit that referenced this pull requestDec 7, 2016
…::$renderer (nicolas-grekas)This PR was merged into the 3.2 branch.Discussion----------[Bridge\Twig] Trigger deprecation when using FormExtension::$renderer| Q             | A| ------------- | ---| Branch?       | 3.2| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | yes (instead of a BC break)| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -As spotted in#20710 andsonata-project/SonataAdminBundle#4216.Note that this simple implementation is fine because neither the class nor its parent have any private/protected properties.Commits-------6f1c59c [Bridge\Twig] Trigger deprecation when using FormExtension::$renderer
@fabpot
Copy link
Member

Looks like we have reenabled the spacebar heating :)

greg0ire, fbourigault, and jvasseur reacted with laugh emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

+1 more reviewer

@greg0iregreg0iregreg0ire left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@fbourigault@stof@greg0ire@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp