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

Document MySQL error codes #3795

Merged
merged 1 commit into from
Dec 29, 2019
Merged

Document MySQL error codes #3795

merged 1 commit into from
Dec 29, 2019

Conversation

BenMorel
Copy link
Contributor

Q A
Type improvement
BC Break no
Fixed issues none

Summary

Documents mysql error codes for easier reading.

References:

@BenMorel
Copy link
Contributor Author

Not sure how to fix the phpcs issue:

  • when I don't put an empty line before the return statement, I get:

Expected 1 lines before "return", found 0.

  • when I do put an empty line before it, I get:

The CASE body must start on the line following the statement

This contradiction only occurs when a comment is on the same line as the case.

@morozov
Copy link
Member

morozov commented Dec 23, 2019

Why not define the codes as constants instead of comments?

@BenMorel
Copy link
Contributor Author

It's a possibility, it just adds a bit of burden for something that's not going to be reused anywhere IMHO.

If you wish to proceed this way, please tell me where they should go:

  • as constants in the AbstractMySQLDriver class
  • or as constants in the Doctrine\DBAL\Driver namespace (and in which file then?)

@lcobucci
Copy link
Member

@BenMorel I'd suggest private constants in AbstractMySQLDriver.

@BenMorel
Copy link
Contributor Author

Here you are!

@morozov
Copy link
Member

morozov commented Dec 24, 2019

It's a possibility, it just adds a bit of burden for something that's not going to be reused anywhere IMHO.

It's not about reuse. It's about self-documenting code.

Here you are!

Thank you.

Could you please also move the @link annotations from convertException() to the group block around the newly declared constants like here?

/**#@+
* Quote characters within string literals can be preceded by a backslash.
*
* @deprecated Will be removed as internal implementation details.
*/
public const ESCAPED_SINGLE_QUOTED_TEXT = "(?:'(?:\\\\)+'|'(?:[^'\\\\]|\\\\'?|'')*')";
public const ESCAPED_DOUBLE_QUOTED_TEXT = '(?:"(?:\\\\)+"|"(?:[^"\\\\]|\\\\"?)*")';
public const ESCAPED_BACKTICK_QUOTED_TEXT = '(?:`(?:\\\\)+`|`(?:[^`\\\\]|\\\\`?)*`)';
/**#@-*/

And then squash.

@BenMorel
Copy link
Contributor Author

Is this /**#@+ ... */ ... /**#@-*/ a PHPdoc standard of some sort? I've never come across this one.

@morozov
Copy link
Member

morozov commented Dec 25, 2019

Is this /**#@+ ... */ ... /**#@-*/ a PHPdoc standard of some sort? I've never come across this one.

This is/was actively used in PEAR, athough I'm not sure if it's part of the phpDoc standard.

UPD: it's called a DocBlock template.

@BenMorel
Copy link
Contributor Author

@morozov All done!

@morozov morozov self-assigned this Dec 29, 2019
@morozov morozov added this to the 3.0.0 milestone Dec 29, 2019
@morozov morozov merged commit b706108 into doctrine:master Dec 29, 2019
@morozov
Copy link
Member

morozov commented Dec 29, 2019

Thanks @BenMorel! 🚢

@BenMorel BenMorel deleted the mysql-codes branch December 29, 2019 16:06
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants