Skip to content
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

Version 1.0 #170

Merged
merged 2 commits into from
Sep 26, 2023
Merged

Version 1.0 #170

merged 2 commits into from
Sep 26, 2023

Conversation

kevinpapst
Copy link
Owner

Description

  • Symfony 6 only
  • PHP 8 only
  • Phpstan level 9
  • Fixes deprecation with SF 6.3 about missing return types

Besides the obvious BC breaks due to added return types, there is one BC break that needs attention.

The UserInterface whose method changed from getIdentifier() to getUserIdentifier().
As latter method is part of the Symfony User Interface, this shouldn't be an issue, as we target SF 6 only.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I updated the documentation (see here)
  • I agree that this code will be published under the MIT license

@kevinpapst kevinpapst linked an issue Sep 23, 2023 that may be closed by this pull request
@tacman
Copy link
Contributor

tacman commented Sep 26, 2023

This is great! Can you also add Symfony 7, which will be out in 2 months?

My branch of the demo works with Symfony 6.4 and I've been removing deprecation warnings.

Copy link
Collaborator

@cavasinf cavasinf left a comment

Choose a reason for hiding this comment

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

I'm OK with the job except for class property inside constructors.

I don't think we should pre-shot Symfony 7 though.


public function __construct(string $id, string $message, string $type = Constants::TYPE_INFO)
public function __construct(private string $id, private string $message, private string $type = Constants::TYPE_INFO)
Copy link
Collaborator

@cavasinf cavasinf Sep 26, 2023

Choose a reason for hiding this comment

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

I'm not a big fan of putting class members INSIDE the constructor.

  1. When using PHP Attributes inside constructor parameters it can be messy.
  2. We have encountered a lot of confusing behavior logic when using it that way (in our company).
  3. Even more in a single line! It will be a pain when resolving conflicts on merge! (trust me 😭)

No complaint when using autowire though, just on models like this one.

I'll go:

public function __construct(
    private string $id, 
    private string $message, 
    private string $type = Constants::TYPE_INFO
) {
}

Or back to OLD way

private string $id;
private string $message; 
private string $type;
private ?string $url = null;

public function __construct(
    string $id, 
    string $message, 
    string $type = Constants::TYPE_INFO,
) {
    $this->id = $id;
    $this->message = $message;
    $this->type = $type;
}

Copy link
Collaborator

@cavasinf cavasinf Sep 26, 2023

Choose a reason for hiding this comment

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

If you are using rector to do this PR, we have added the Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector to the skip config. And do this upgrade only where needed.


public function __construct(string $id, string $name)
public function __construct(private string $id, private string $name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here

@cavasinf
Copy link
Collaborator

What about those issues @kevinpapst?

@kevinpapst
Copy link
Owner Author

My changes are BC breaks, that's why we need to bump to 1.0.
Also I am not a big fan of the "I am waiting for years until 1.0" release tactic.
It is time to signal that the bundle is stable.
And there is always a time for new major release if we do BC breaks in the future (e.g. remove |trans filter).

Lets move the tickets to a new milestone and close the linked one.
SF 6.3 is out and there are deprecations that need to be fixed now.
SF7 is coming soon, we should be prepared.

I agree, we can always release a 1.1 to support SF7 in two month.

Regarding your code comments: these files were NEVER changed since I committed them 2 years ago.
I am working mostly by myself since years, so you have better insights in merge problems. Larger teams on active codebases obviously have different needs than projects like this one 😄
But I do not see a big risk here, due to the rare commits in the last months 🤷 which is actually a good sign of stability IMO.

@kevinpapst kevinpapst merged commit 84d8db2 into main Sep 26, 2023
2 checks passed
@kevinpapst kevinpapst deleted the release-1.0 branch September 26, 2023 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop support for Symfony 4.4 and PHP < 8.0
3 participants