Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[FrameworkBundle] Upgrade notice for the Controller::json() method #18373

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2016

Conversation

derrabus
Copy link
Member

Q A
Branch? master
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets N/A
License MIT
Doc PR N/A

PR #17642 added a json() method to the Controller class. This might break existing code extending the class. This PR adds a note about this to the UPGRADE-3.1 document.

@derrabus derrabus changed the title Upgrade notice for the Controller::json() method [FrameworkBundle] Upgrade notice for the Controller::json() method Mar 30, 2016
@derrabus
Copy link
Member Author

Since I haven't changed any code, I'd guess the CI build fails are unrelated to my change.

@@ -24,6 +24,10 @@ FrameworkBundle

* As it was never an officially supported feature, the support for absolute
template paths has been deprecated and will be removed in Symfony 4.0.
* The abstract `Controller` class now has a `json()` helper method that creates
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing empty line :)

@HeahDude
Copy link
Contributor

HeahDude commented Apr 1, 2016

On second thought, if the method is overridden everything should work fine, doesn't it ?

@derrabus
Copy link
Member Author

derrabus commented Apr 1, 2016

@HeahDude: If the signatures of the methods don't match, php will throw a fatal error.

@derrabus
Copy link
Member Author

derrabus commented Apr 1, 2016

I don't think many people will run into this. Nevertheless, I think it's worth documenting.

@HeahDude
Copy link
Contributor

HeahDude commented Apr 1, 2016

Of courses! ping @dunglas

@mcfedr
Copy link
Contributor

mcfedr commented Apr 1, 2016

I see a warning about signature mismatch, but not a fatal error, just did a little check

class A {
    public function func() {
    }
}

class B extends A {
    public function func($a) {
    }
}

new B();

Warning: Declaration of B::func($a) should be compatible with A::func()

@HeahDude
Copy link
Contributor

HeahDude commented Apr 1, 2016

@mcfedr PHP version ?

@HeahDude
Copy link
Contributor

HeahDude commented Apr 1, 2016

I confirm the fatal error on PHP 5.6:
Strict Standards: Declaration of ChildTest::test() should be compatible with Test::test() in /Users/Heah/Sites/home/web/test.php on line 30 true

@mcfedr
Copy link
Contributor

mcfedr commented Apr 1, 2016

I am use php 7, I also see the Strict warning on php 5

@mcfedr
Copy link
Contributor

mcfedr commented Apr 1, 2016

Either way, its probably worth noting in the UPDATE log

@HeahDude
Copy link
Contributor

HeahDude commented Apr 1, 2016

👍

@GuilhemN
Copy link
Contributor

GuilhemN commented Apr 3, 2016

As this is not part of the symfony BC policy, I'm not sure this should be specified in the upgrade file. Maybe only in the changelog?

@xabbuh
Copy link
Member

xabbuh commented Apr 5, 2016

We didn't do that in the past when introducing more helper methods in Symfony 2.8. On the other hand it doesn't really hurt to add this and having a json() method might be more like than any of the other method names we added in the past.

@derrabus
Copy link
Member Author

derrabus commented Apr 5, 2016

I've added the extra blank line as requested by @HeahDude and rebased against master to resolve conflicts.

@fabpot
Copy link
Member

fabpot commented Apr 5, 2016

Thank you @derrabus.

@fabpot fabpot merged commit ca6694a into symfony:master Apr 5, 2016
fabpot added a commit that referenced this pull request Apr 5, 2016
…n() method (derrabus)

This PR was merged into the 3.1-dev branch.

Discussion
----------

[FrameworkBundle] Upgrade notice for the Controller::json() method

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

PR #17642 added a `json()` method to the `Controller` class. This might break existing code extending the class. This PR adds a note about this to the UPGRADE-3.1 document.

Commits
-------

ca6694a Upgrade notice for the Controller::json() method.
@derrabus derrabus deleted the patch-1 branch June 13, 2017 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants