Closed core23 closed 3 years ago
Now that 7.1 is EOL (https://secure.php.net/supported-versions.php), maybe we should bump to 7.2 add parameter type declarations in a new minor? If we consider current docblocks as a contract?
👎 For adding parameter types. There is a reason why symfony won't do this in a major release...
👍 For adding return types
👍 for adding return types to final classes, but not otherwise, and not to interfaces either: https://3v4l.org/KLvG9
:-1: For adding parameter types. There is a reason why symfony won't do this in a major release...
You mean a minor release, and what's the reason?
👍 for adding return types to final classes, but not otherwise, and not to interfaces either: https://3v4l.org/KLvG9
👍 for full return / parameter types to final classes
You mean a minor release, and what's the reason?
If we add a parameter type and someone uses an other type hint, it would break: https://3v4l.org/XBfik
But… they can't use a type declaration if we don't, that would break the LSP, and php rightfully forbids that: https://3v4l.org/eiigE
Also, we can add type declarations to private methods.
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
As explained here some interface are required/useful if we want to add final modifier to some class.
And maybe SearchHandlerInterface.
I saw you add final to lot of classes @franmomu https://github.com/sonata-project/SonataAdminBundle/pull/6819
The last one is AdminHelper
. Declaring this class as final had complexity to our unit tests since we can't mock it anymore.
What is your opinion about this class ?
AdminHelper::getChildFormView and getChildFormBuilder seems better in another service IMHO
The AdminHelper::appendFormFieldElement is only used by AppendFormFieldElementAction maybe an service is not worth it and we should prefer move the method from the AdminHelper to the AppendFormFIeldElementAction.
since we can't mock it anymore
you can do https://github.com/dg/bypass-finals
I haven't checked that class too much, I'll try (when I can) to see if I can instantiate it, another solution could be to make it @internal
as looks like internal to us. It is used as dependency in AppendFormFieldElementAction
and RetrieveFormFieldElementAction
, but IMO these actions are meant to be called through request, not manually instantiating them.
another solution could be to make it
@internal
as looks like internal to us. It is used as dependency inAppendFormFieldElementAction
andRetrieveFormFieldElementAction
, but IMO these actions are meant to be called through request, not manually instantiating them.
I agree. I thought about this too.
I had a look and its indeed not simple to use a "real" instance of AdminHelper
in the tests. Involves fiddling around with FormFactory
, FormBuilder
, ...
I vote for making it @internal
Is there anything else to do for this issue?
The AdminHelper
class is @internal
now. See https://github.com/sonata-project/SonataAdminBundle/pull/6842
I think there is some minor changes possible:
But that's all I see. Maybe more method could be final (in the AbstractAdmin or the CRUDController for instance)
@dmaicher I started https://github.com/sonata-project/SonataAdminBundle/pull/6848
We can add final to a lot of method.
final
modifierprivate