Skip to content

Conversation

@jrushlow
Copy link
Collaborator

No description provided.

@jrushlow jrushlow added Status: Needs Work Additional work is needed Minor Minor Enhancement labels May 18, 2022
jrushlow and others added 2 commits May 19, 2022 10:29
Co-authored-by: Oskar Stark <oskarstark@googlemail.com>
Co-authored-by: Oskar Stark <oskarstark@googlemail.com>
@OskarStark
Copy link
Contributor

OskarStark commented May 19, 2022

I really think all property constructer promotions should be on a new line like, even if its only one:

public function __construct(
    private LoggerInterface $logger = null,
) {
}

it increases readability a lot. Not sure what you think @weaverryan

jrushlow and others added 2 commits May 19, 2022 10:34
Co-authored-by: Oskar Stark <oskarstark@googlemail.com>
Co-authored-by: Oskar Stark <oskarstark@googlemail.com>
@jrushlow
Copy link
Collaborator Author

I really think all property constructer promotions should be on a new line like, even if its only one:

public function __construct(
    private LoggerInterface $logger = null,
) {
}

it increases readability a lot. Not sure what you think @weaverryan

agree'd

* use statement would appear as "use Some\Class::class as 'ZXY'". It is ok
* to mix non-aliases classes with aliases.
*
* @param string[]|array<string, string> $classesToBeImported
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@OskarStark - over in symfony, do you guys use any of the #[ArrayShape] attributes instead of the param notations?

Something like https://blog.jetbrains.com/phpstorm/2020/10/phpstorm-2020-3-eap-4/#arrayshape or similar?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can't remember

Copy link
Member

Choose a reason for hiding this comment

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

No, Symfony is mostly sticking to phpDocumentor's types and annotations (with some occasional Psalm types).

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you Wouter 😃

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks Wouter! I'm getting curious about using #ArrayShape from PHPStorm, or "cloning" it in MakerBundle's NS so we can use it here. We have quite a few multi-dimensional arrays that I've run across when refactoring the code over the past couple of weeks - I'm having to jump back and forth to figure out what the array is supposed to look like.

On the flip side, this could be a sign we should be using a simple object representation instead of a complex array in those cases...

@jrushlow jrushlow requested a review from OskarStark May 19, 2022 14:44
@jrushlow jrushlow changed the title WIP - implement types and constructor property promotion for utilities implement types and constructor property promotion for utilities May 19, 2022
@jrushlow jrushlow added Status: Needs Review Needs to be reviewed and removed Status: Needs Work Additional work is needed labels May 19, 2022
{
$this->metadata = $metadata;
public function __construct(
private ClassMetadata|LegacyClassMetadata $metadata
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note to self: we may be able to remove the LegacyClassMetedata - depends on doctrine version constraints...

Co-authored-by: Ryan Weaver <weaverryan+github@gmail.com>
@jrushlow jrushlow added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels May 19, 2022
@jrushlow jrushlow merged commit 7362329 into symfony:main May 19, 2022
@jrushlow jrushlow deleted the minor/legacy-1 branch May 19, 2022 15:48
{
$this->phpCompatUtil = $phpCompatUtil;
public function __construct(
private PhpCompatUtil $phpCompatUtil
Copy link
Contributor

Choose a reason for hiding this comment

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

We should always end with a ,, it makes future diffs easier to read, also there is a PHP-CS-Fixer rule

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch! thanks Oskar. Done in #1127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Minor Minor Enhancement Status: Reviewed Has been reviewed by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants