Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[TypeInfo] use an EOL-agnostic approach to parse class uses #60909

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

Open
wants to merge 1 commit into
base: 7.2
Choose a base branch
from

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Jun 26, 2025

Q A
Branch? 7.2
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #60906
License MIT

@carsonbot

This comment was marked as outdated.

@carsonbot carsonbot added this to the 7.4 milestone Jun 26, 2025
@xabbuh xabbuh changed the base branch from 7.4 to 7.2 June 26, 2025 09:35
@@ -82,6 +83,22 @@ public function testCollectUses()
$this->assertEquals($uses, $this->typeContextFactory->createFromReflection(new \ReflectionParameter([DummyWithUses::class, 'setCreatedAt'], 'createdAt'))->uses);
}

public function testCollectUsesWindowsLineEndings()
{
Copy link
Member

Choose a reason for hiding this comment

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

I suggest adding an assertion that the DummyWithUsesWindowsLineEndings.php file contains \r\n, to avoid having someone changing the line endings (by mistake or intentionally) and making this test useless.
This could happen for instance for contributors on Windows using git's newline conversion features (maybe we could even avoid that specific case with a .gitattributes telling git we want Windows line endings in this specific file)

Copy link
Member Author

Choose a reason for hiding this comment

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

I added both the assertion inside the test as well as entries to the relevant .gitattributes files

@xabbuh xabbuh force-pushed the issue-60906 branch 4 times, most recently from e803276 to 76ad82b Compare June 26, 2025 11:08
.gitattributes Outdated
@@ -7,5 +7,6 @@
/src/Symfony/Component/Translation/Bridge export-ignore
/src/Symfony/Component/Emoji/Resources/data/* linguist-generated=true
/src/Symfony/Component/Intl/Resources/data/*/* linguist-generated=true
/src/Symfony/Component/TypeInfo/Tests/Fixtures/DummyWithUsesWindowsLineEndings.php text eol=crlf
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need this if src/Symfony/Component/TypeInfo/.gitattributes already defines it

Copy link
Member Author

Choose a reason for hiding this comment

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

Are you sure that src/Symfony/Component/TypeInfo/.gitattributes is evaluated when the mono-repo is checked out?

Copy link
Member

Choose a reason for hiding this comment

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

yes. git respects all .gitattributes files, not just the file at the root of the repo (same for .gitignore files)

Copy link
Member Author

Choose a reason for hiding this comment

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

alright 👍 I reverted this change

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

Successfully merging this pull request may close these issues.

[TypeInfo] TypeContextFactory::collectUses returns values with ;
3 participants