-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Improve consistency of exception message formatting. #3536
Conversation
ed00719
to
012c657
Compare
@jwage please see the comments above. I haven't reviewed the entire patch yet. |
012c657
to
63f36a2
Compare
4c23709
to
6eba870
Compare
6eba870
to
0ac207b
Compare
0ac207b
to
5ba53f9
Compare
1858e72
to
2bbc38e
Compare
@@ -48,7 +49,7 @@ public function __construct(array $data) | |||
*/ | |||
public function closeCursor() : void | |||
{ | |||
unset($this->data); | |||
$this->data = null; |
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 was adding tests for ArrayStatement and this seemed wrong since it can result in PHP errors if you call other public methods after closeCursor()
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.
Makes perfect sense.
2bbc38e
to
623623a
Compare
} | ||
|
||
if (! is_numeric($shard['id']) || $shard['id'] < 1) { | ||
throw new InvalidArgumentException('Shard Id has to be a non-negative number.'); | ||
} | ||
|
||
if (isset($this->connectionParameters[$shard['id']])) { | ||
throw new InvalidArgumentException('Shard ' . $shard['id'] . ' is duplicated in the configuration.'); | ||
throw new InvalidArgumentException(sprintf('Shard "%s" is duplicated in the configuration.', $shard['id'])); |
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.
Is $shard['id']
a string?
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.
It's annotated as int|string
in most places but looks like it's a numeric string (or an integer):
dbal/lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php
Lines 94 to 96 in 82f5fe3
if (! is_numeric($shard['id']) || $shard['id'] < 1) { | |
throw new InvalidArgumentException('Shard Id has to be a non-negative number.'); | |
} |
Also, the id
comes from sys.federation_member_distributions.member_id
:
dbal/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureShardManager.php
Lines 158 to 164 in 68e48e8
$sql = 'SELECT member_id as id, | |
distribution_name as distribution_key, | |
CAST(range_low AS CHAR) AS rangeLow, | |
CAST(range_high AS CHAR) AS rangeHigh | |
FROM sys.federation_member_distributions d | |
INNER JOIN sys.federations f ON f.federation_id = d.federation_id | |
WHERE f.name = ' . $this->conn->quote($this->federationName); |
which according to this article is INT
.
These details are mostly for myself, I'll need this info later to finish the work on strict types.
46809de
to
13820a6
Compare
@jwage I rebased |
3124f44
to
10b09e1
Compare
@morozov Done! |
@@ -30,9 +29,9 @@ public static function new($invalidPlatform) : self | |||
|
|||
return new self( | |||
sprintf( | |||
"Option 'platform' must be an object and subtype of '%s'. Got '%s'", | |||
'Option "platform" must be an object and subtype of %s. Got "%s".', |
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.
No quotes around type needed.
@@ -828,7 +829,10 @@ private function convertSingleBooleanValue($value, $callback) | |||
return $callback(true); | |||
} | |||
|
|||
throw new UnexpectedValueException("Unrecognized boolean literal '${value}'"); | |||
throw new UnexpectedValueException(sprintf( | |||
'Unrecognized boolean literal, "%s" given.', |
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.
No quotes around type needed. Or… most likely it will be a printable scalar value. Let's leave it without the GetVariableType
.
@jwage thanks. Could you look at the build failure and the new comments? Looks like we're really close to finishing it. |
10b09e1
to
67ebcf6
Compare
Fixed latest feedback and fixed the tests. |
Thank you 🚢 |
Cool! Thanks! |
Improve consistency of exception message formatting.
Improve consistency of exception message formatting.
Improve consistency of exception message formatting.
Improve consistency of exception message formatting.
Improve consistency of exception message formatting.
Improve consistency of exception message formatting.
Improve consistency of exception message formatting.
Improve consistency of exception message formatting.
Improve consistency of exception message formatting.
Improve consistency of exception message formatting.
Summary
Improve consistency of exception message formatting. See #3531 for details.
TODO