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

Appearance settings

[3.0] Final classes by default #15233

Copy link
Copy link
Closed
Closed
Copy link
@unkind

Description

@unkind
Issue body actions

There is a rule in Symfony to make all non-public class members private by default, not protected:

We define all members as private until a valid use case is found that requires higher visibility.

by @jakzal (#14923).

I suggest to make BC policy more strict for Symfony 3: require final on every new class by default. Reasoning is simple: if you don't think that class should be inherited, then don't leave it opened for inheritance, it would allow to keep BC better. Sometimes I see PRs which technically break BC, but it is allowed because "it's too rare and weird case to inherit that class". To be consistent, you shouldn't allow to inherit that class then. Later you can remove final keyword if there is valid use case for inheritance.

I can refer to some similar opinions:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.