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

Skip to content

refactor(metadata): replace HttpOperation constants by raw strings#5494

Merged
soyuka merged 1 commit into
api-platform:mainfrom
helyakin:chore/refactoConstOperation
Apr 21, 2023
Merged

refactor(metadata): replace HttpOperation constants by raw strings#5494
soyuka merged 1 commit into
api-platform:mainfrom
helyakin:chore/refactoConstOperation

Conversation

@helyakin
Copy link
Copy Markdown
Contributor

@helyakin helyakin commented Mar 23, 2023

As spoken with @chalasr there are string hardcoded operation request which could be replaced with the HttpOperation request const

Maybe this isn't what you want but I thought this would be good to replace those.
I'll gladly take any advice.

I don't know to which branch this should be merged so I'd like your advice.

@helyakin helyakin changed the title chore(refacto): replace request operation hard string with const chore: replace request operation hard string with const Mar 23, 2023
@soyuka
Copy link
Copy Markdown
Member

soyuka commented Mar 24, 2023

Indeed this is a good change, you should change your commit though:

refactor(metadata): use HttpOperation constants for methods

chore is used for cleanup or things you can't categorize.

@helyakin helyakin changed the title chore: replace request operation hard string with const refactor(metadata): use HttpOperation constants for methods Mar 24, 2023
@helyakin
Copy link
Copy Markdown
Contributor Author

Indeed this is a good change, you should change your commit though:

refactor(metadata): use HttpOperation constants for methods

chore is used for cleanup or things you can't categorize.

Sur thing ! it's done !

Comment thread src/Symfony/Bundle/DependencyInjection/Configuration.php
@soyuka
Copy link
Copy Markdown
Member

soyuka commented Mar 27, 2023

@MarvinCourcier the commit should be changed, not the Pull Request title which is unrelated after merging except for github.

@dunglas
Copy link
Copy Markdown
Member

dunglas commented Mar 27, 2023

Could you do a profile please? IIRC resolving the constants has a runtime cost that can be significant and it's why we do not use them at least on the hot path.

@chalasr
Copy link
Copy Markdown
Contributor

chalasr commented Mar 27, 2023

Indeed, Symfony inlines the Response::HTTP_* internally for this reason. Either way, making it consistent across the board would make sense IMO

@dunglas
Copy link
Copy Markdown
Member

dunglas commented Mar 27, 2023

👍 for consistency, but let's use a raw string everywhere then.

@helyakin helyakin force-pushed the chore/refactoConstOperation branch from 11bb434 to 7c8586d Compare March 29, 2023 11:45
@helyakin helyakin changed the title refactor(metadata): use HttpOperation constants for methods refactor(metadata): replace HttpOperation constants by raw strings Mar 29, 2023
@helyakin helyakin force-pushed the chore/refactoConstOperation branch from 7c8586d to 5ce9ed4 Compare March 29, 2023 11:55
@helyakin
Copy link
Copy Markdown
Contributor Author

So @soyuka based on what I have understood, I've replaced all the const by raw string.

Hence I've changed the name of the PR since this is going in the total opposite direction 🤣

Thank you @dunglas Hahaha !

Hopefully I've done what was expected

Comment thread src/Metadata/HttpOperation.php
@helyakin helyakin force-pushed the chore/refactoConstOperation branch from 5ce9ed4 to 599d514 Compare April 3, 2023 10:51
@soyuka soyuka merged commit 26cd25c into api-platform:main Apr 21, 2023
@soyuka
Copy link
Copy Markdown
Member

soyuka commented Apr 21, 2023

thanks

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.

4 participants