Skip to content

Commit

Permalink
Merge pull request #5545 from derrabus/improvement/set-accessible
Browse files Browse the repository at this point in the history
Remove calls to setAccessible()
  • Loading branch information
derrabus authored Jul 28, 2022
2 parents 7e084b9 + fa23ebe commit ad18cf7
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 8 deletions.
1 change: 0 additions & 1 deletion src/Driver/Mysqli/Exception/ConnectionError.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public static function new(mysqli $connection): self
public static function upcast(mysqli_sql_exception $exception): self
{
$p = new ReflectionProperty(mysqli_sql_exception::class, 'sqlstate');
$p->setAccessible(true);

return new self($exception->getMessage(), $p->getValue($exception), (int) $exception->getCode(), $exception);
}
Expand Down
1 change: 0 additions & 1 deletion src/Driver/Mysqli/Exception/ConnectionFailed.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public static function new(mysqli $connection): self
public static function upcast(mysqli_sql_exception $exception): self
{
$p = new ReflectionProperty(mysqli_sql_exception::class, 'sqlstate');
$p->setAccessible(true);

return new self($exception->getMessage(), $p->getValue($exception), (int) $exception->getCode(), $exception);
}
Expand Down
1 change: 0 additions & 1 deletion src/Driver/Mysqli/Exception/InvalidCharset.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public static function fromCharset(mysqli $connection, string $charset): self
public static function upcast(mysqli_sql_exception $exception, string $charset): self
{
$p = new ReflectionProperty(mysqli_sql_exception::class, 'sqlstate');
$p->setAccessible(true);

return new self(
sprintf('Failed to set charset "%s": %s', $charset, $exception->getMessage()),
Expand Down
1 change: 0 additions & 1 deletion src/Driver/Mysqli/Exception/StatementError.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public static function new(mysqli_stmt $statement): self
public static function upcast(mysqli_sql_exception $exception): self
{
$p = new ReflectionProperty(mysqli_sql_exception::class, 'sqlstate');
$p->setAccessible(true);

return new self($exception->getMessage(), $p->getValue($exception), (int) $exception->getCode(), $exception);
}
Expand Down
3 changes: 1 addition & 2 deletions tests/Functional/Ticket/DBAL461Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ public function testIssue(): void
$schemaManager = new SQLServerSchemaManager($conn, $platform);

$reflectionMethod = new ReflectionMethod($schemaManager, '_getPortableTableColumnDefinition');
$reflectionMethod->setAccessible(true);
$column = $reflectionMethod->invoke($schemaManager, [
$column = $reflectionMethod->invoke($schemaManager, [
'type' => 'numeric(18,0)',
'length' => null,
'default' => null,
Expand Down
2 changes: 0 additions & 2 deletions tests/Schema/SQLiteSchemaManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public function testParseColumnCollation(?string $collation, string $column, str

$manager = new SQLiteSchemaManager($conn, new SQLitePlatform());
$ref = new ReflectionMethod($manager, 'parseColumnCollationFromSQL');
$ref->setAccessible(true);

self::assertSame($collation, $ref->invoke($manager, $column, $sql));
}
Expand Down Expand Up @@ -137,7 +136,6 @@ public function testParseColumnCommentFromSQL(string $comment, string $column, s

$manager = new SQLiteSchemaManager($conn, new SQLitePlatform());
$ref = new ReflectionMethod($manager, 'parseColumnCommentFromSQL');
$ref->setAccessible(true);

self::assertSame($comment, $ref->invoke($manager, $column, $sql));
}
Expand Down

0 comments on commit ad18cf7

Please sign in to comment.