-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Version 1.0 #170
Conversation
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. |
There was a problem hiding this 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) |
There was a problem hiding this comment.
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.
- When using PHP Attributes inside constructor parameters it can be messy.
- We have encountered a lot of confusing behavior logic when using it that way (in our company).
- 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;
}
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
What about those issues @kevinpapst? |
My changes are BC breaks, that's why we need to bump to 1.0. Lets move the tickets to a new milestone and close the linked one. 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. |
Description
Besides the obvious BC breaks due to added return types, there is one BC break that needs attention.
The
UserInterface
whose method changed fromgetIdentifier()
togetUserIdentifier()
.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
Checklist