From e9bcb211f4a83ffad3679a23317f625a29936c6c Mon Sep 17 00:00:00 2001 From: William Desportes Date: Thu, 19 Dec 2024 00:10:11 +0100 Subject: [PATCH 1/3] Make phpcs reports relative and ignore revision-info.php Signed-off-by: William Desportes --- phpcs.xml.dist | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index c4fc632988..c9944016b5 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -8,6 +8,8 @@ . + + */build/* */config.inc.php @@ -15,6 +17,7 @@ */libraries/language_stats.inc.php */node_modules/* */test/doctum-config.php + */revision-info.php */tmp/* */twig-templates/* */vendor/* From b950c49a772a50a3f7cb872d4a7d0a41e16320f7 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Thu, 19 Dec 2024 00:08:06 +0100 Subject: [PATCH 2/3] Fix #19455 - Support reading all the commit info from revision-info.php Signed-off-by: William Desportes --- .../Command/WriteGitRevisionCommand.php | 33 ++- libraries/classes/Git.php | 43 +++- .../Command/WriteGitRevisionCommandTest.php | 51 +++- test/classes/GitTest.php | 225 +++++++++++++++--- 4 files changed, 312 insertions(+), 40 deletions(-) diff --git a/libraries/classes/Command/WriteGitRevisionCommand.php b/libraries/classes/Command/WriteGitRevisionCommand.php index 52eaf5d9b2..2a6ebc22e1 100644 --- a/libraries/classes/Command/WriteGitRevisionCommand.php +++ b/libraries/classes/Command/WriteGitRevisionCommand.php @@ -4,11 +4,13 @@ declare(strict_types=1); namespace PhpMyAdmin\Command; +use PhpMyAdmin\Git; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use function explode; use function file_put_contents; use function is_string; use function shell_exec; @@ -34,9 +36,21 @@ declare(strict_types=1); */ return [ 'revision' => '%s', + 'revisionHash' => '%s', 'revisionUrl' => '%s', 'branch' => '%s', 'branchUrl' => '%s', + 'message' => '%s', + 'author' => [ + 'name' => '%s', + 'email' => '%s', + 'date' => '%s', + ], + 'committer' => [ + 'name' => '%s', + 'email' => '%s', + 'date' => '%s', + ], ]; PHP; @@ -101,14 +115,31 @@ PHP; return null; } + $commitDetails = $this->gitCli( + 'show -s --pretty=\'tree %T%nparent %P%nauthor %an <%ae> %at%ncommitter %cn <%ce> %ct%n%B\'' + ); + if ($commitDetails === null) { + return null; + } + $branchName = trim(str_replace('refs/heads/', '', $branchName)); + [$author, $committer, $message] = Git::extractDataFormTextBody(explode("\n", $commitDetails)); + return sprintf( self::$generatedClassTemplate, trim($revisionText), + trim($commitHash), sprintf($commitUrlFormat, trim($commitHash)), trim($branchName), - sprintf($branchUrlFormat, $branchName) + sprintf($branchUrlFormat, $branchName), + trim($message), // Commit message + trim($author['name']), // Author name + trim($author['email']), // Author email + trim($author['date']), // Author date + trim($committer['name']), // Committer name + trim($committer['email']), // Committer email + trim($committer['date']) // Committer date ); } diff --git a/libraries/classes/Git.php b/libraries/classes/Git.php index 07eeab7a3d..4208465c60 100644 --- a/libraries/classes/Git.php +++ b/libraries/classes/Git.php @@ -27,6 +27,7 @@ use function gzuncompress; use function implode; use function in_array; use function intval; +use function is_array; use function is_bool; use function is_dir; use function is_file; @@ -104,7 +105,9 @@ class Git // find out if there is a .git folder // or a .git file (--separate-git-dir) $git = $this->baseDir . '.git'; - if (is_dir($git)) { + if (file_exists($this->baseDir . 'revision-info.php')) { + $git_location = 'revision-info.php'; + } elseif (is_dir($git)) { if (! @is_file($git . '/config')) { $_SESSION['git_location'] = null; $_SESSION['is_git_revision'] = false; @@ -367,11 +370,11 @@ class Git /** * Extract committer, author and message from commit body * - * @param array $commit The commit body + * @param string[] $commit The commit body * * @return array|string> */ - private function extractDataFormTextBody(array $commit): array + public static function extractDataFormTextBody(array $commit): array { $author = [ 'name' => '', @@ -557,6 +560,38 @@ class Git return null; } + // Special name to indicate the use of the config file + if ($gitFolder === 'revision-info.php') { + /** @psalm-suppress MissingFile,UnresolvableInclude */ + $info = include $this->baseDir . 'revision-info.php'; + + if (! is_array($info)) { + return null; + } + + $this->hasGit = true; + + return [ + 'hash' => $info['revisionHash'], + 'branch' => $info['branch'], + 'message' => $info['message'], + 'author' => [ + 'name' => $info['author']['name'], + 'email' => $info['author']['email'], + 'date' => $info['author']['date'], + ], + 'committer' => [ + 'name' => $info['committer']['name'], + 'email' => $info['committer']['email'], + 'date' => $info['committer']['date'], + ], + // Let's make the guess that the data is remote + // The write script builds a remote commit url without checking that it exists + 'is_remote_commit' => true, + 'is_remote_branch' => true, + ]; + } + $ref_head = @file_get_contents($gitFolder . '/HEAD'); if (! $ref_head) { @@ -616,7 +651,7 @@ class Git } if ($commit !== false) { - [$author, $committer, $message] = $this->extractDataFormTextBody($commit); + [$author, $committer, $message] = self::extractDataFormTextBody($commit); } elseif (isset($commit_json->author, $commit_json->committer, $commit_json->message)) { $author = [ 'name' => $commit_json->author->name, diff --git a/test/classes/Command/WriteGitRevisionCommandTest.php b/test/classes/Command/WriteGitRevisionCommandTest.php index fd61b2d156..189d1a5e9c 100644 --- a/test/classes/Command/WriteGitRevisionCommandTest.php +++ b/test/classes/Command/WriteGitRevisionCommandTest.php @@ -9,6 +9,7 @@ use PhpMyAdmin\Tests\AbstractTestCase; use Symfony\Component\Console\Command\Command; use function class_exists; +use function implode; use function sprintf; /** @@ -32,17 +33,35 @@ class WriteGitRevisionCommandTest extends AbstractTestCase ->onlyMethods(['gitCli']) ->getMock(); - $this->command->expects($this->exactly(3)) + $this->command->expects($this->exactly(4)) ->method('gitCli') ->withConsecutive( ['describe --always'], ['log -1 --format="%H"'], - ['symbolic-ref -q HEAD'] + ['symbolic-ref -q HEAD'], + ['show -s --pretty=\'tree %T%nparent %P%nauthor %an <%ae> %at%ncommitter %cn <%ce> %ct%n%B\''] ) ->willReturnOnConsecutiveCalls( 'RELEASE_5_1_0-638-g1c018e2a6c', '1c018e2a6c6d518c4a2dde059e49f33af67c4636', - 'refs/heads/cli-rev-info' + 'refs/heads/cli-rev-info', + implode("\n", [ + 'tree 6857f00bb50360825c7df2c40ad21006c30beca7', + 'parent 1634264816449dc42d17872174f3e8d73d4e36b2', + 'author John Doe 1734427284', + 'committer Hosted Weblate 1734516032', + '', + 'Translated using Weblate (Finnish)', + '', + 'Currently translated at 61.4% (2105 of 3428 strings)', + '', + '[ci skip]', + '', + 'Translation: phpMyAdmin/5.2', + 'Translate-URL: https://hosted.weblate.org/projects/phpmyadmin/5-2/fi/', + 'Signed-off-by: John Doe ', + '', + ]) ); $output = $this->callFunction( @@ -66,18 +85,42 @@ declare(strict_types=1); */ return [ 'revision' => '%s', + 'revisionHash' => '%s', 'revisionUrl' => '%s', 'branch' => '%s', 'branchUrl' => '%s', + 'message' => '%s', + 'author' => [ + 'name' => '%s', + 'email' => '%s', + 'date' => '%s', + ], + 'committer' => [ + 'name' => '%s', + 'email' => '%s', + 'date' => '%s', + ], ]; PHP; self::assertSame(sprintf( $template, 'RELEASE_5_1_0-638-g1c018e2a6c', + '1c018e2a6c6d518c4a2dde059e49f33af67c4636', 'https://github.com/phpmyadmin/phpmyadmin/commit/1c018e2a6c6d518c4a2dde059e49f33af67c4636', 'cli-rev-info', - 'https://github.com/phpmyadmin/phpmyadmin/tree/cli-rev-info' + 'https://github.com/phpmyadmin/phpmyadmin/tree/cli-rev-info', + 'Translated using Weblate (Finnish) ' + . ' Currently translated at 61.4% (2105 of 3428 strings) ' + . ' [ci skip] Translation: phpMyAdmin/5.2 ' + . 'Translate-URL: https://hosted.weblate.org/projects/phpmyadmin/5-2/fi/' + . ' Signed-off-by: John Doe ', // Commit message + 'John Doe', // Author name + 'john.doe@example.org', // Author email + '2024-12-17 09:21:24 +0000', // Author date + 'Hosted Weblate', // Committer name + 'hosted@weblate.org', // Committer email + '2024-12-18 10:00:32 +0000' // Committer date ), $output); } } diff --git a/test/classes/GitTest.php b/test/classes/GitTest.php index 7f81f65880..b6bc7e420f 100644 --- a/test/classes/GitTest.php +++ b/test/classes/GitTest.php @@ -150,6 +150,71 @@ class GitTest extends AbstractTestCase rmdir($this->testDir . '.customgitdir'); } + private function getRevisionInfoTestData(): string + { + // phpcs:disable Generic.Files.LineLength.TooLong + return <<<'PHP' + 'RELEASE_5_2_1-1086-g97b9895908', + 'revisionHash' => '97b9895908f281b62c985857798281a0b3e5d1e6', + 'revisionUrl' => 'https://github.com/phpmyadmin/phpmyadmin/commit/97b9895908f281b62c985857798281a0b3e5d1e6', + 'branch' => 'QA_5_2', + 'branchUrl' => 'https://github.com/phpmyadmin/phpmyadmin/tree/QA_5_2', + 'message' => 'Currently translated at 61.4% (2105 of 3428 strings) [ci skip] Translation: phpMyAdmin/5.2 Translate-URL: https://hosted.weblate.org/projects/phpmyadmin/5-2/fi/ Signed-off-by: John Doe ', + 'author' => [ + 'name' => 'John Doe', + 'email' => 'john.doe@example.org', + 'date' => '2024-12-17 09:21:24 +0000', + ], + 'committer' => [ + 'name' => 'Hosted Weblate', + 'email' => 'hosted@weblate.org', + 'date' => '2024-12-18 10:00:32 +0000', + ], +]; + +PHP; + // phpcs:enable + } + + /** + * Test for isGitRevision + * + * @group git-revision + */ + public function testIsGitRevisionRevisionInfo(): void + { + $gitLocation = ''; + self::assertFalse($this->object->hasGitInformation()); + self::assertFalse($this->object->isGitRevision($gitLocation)); + self::assertFalse($this->object->hasGitInformation()); + self::assertSame('', $gitLocation); + + unset($_SESSION['git_location']); + unset($_SESSION['is_git_revision']); + + file_put_contents( + $this->testDir . 'revision-info.php', + $this->getRevisionInfoTestData() + ); + + self::assertTrue($this->object->isGitRevision($gitLocation)); + self::assertSame('revision-info.php', $gitLocation); + self::assertNotNull($this->object->checkGitRevision()); + self::assertTrue($this->object->hasGitInformation()); + + unlink($this->testDir . 'revision-info.php'); + } + /** * Test for checkGitRevision packs folder * @@ -359,6 +424,65 @@ class GitTest extends AbstractTestCase self::assertIsString($commit['committer']['date']); } + /** + * Test for checkGitRevision with a revision-info.php file + * + * @group git-revision + */ + public function testCheckGitRevisionRevisionInfo(): void + { + file_put_contents( + $this->testDir . 'revision-info.php', + $this->getRevisionInfoTestData() + ); + + $gitLocation = ''; + self::assertFalse($this->object->hasGitInformation()); + self::assertNotNull($this->object->checkGitRevision()); + self::assertTrue($this->object->hasGitInformation()); + self::assertTrue($this->object->isGitRevision($gitLocation)); + self::assertSame('revision-info.php', $gitLocation); + + $commit = $this->object->checkGitRevision(); + // Delete the dataset + unlink($this->testDir . 'revision-info.php'); + + self::assertNotNull($commit); + self::assertIsArray($commit); + self::assertArrayHasKey('hash', $commit); + self::assertSame('97b9895908f281b62c985857798281a0b3e5d1e6', $commit['hash']); + + self::assertArrayHasKey('branch', $commit); + self::assertSame('QA_5_2', $commit['branch']); + + self::assertArrayHasKey('message', $commit); + self::assertIsString($commit['message']); + + self::assertArrayHasKey('is_remote_commit', $commit); + self::assertIsBool($commit['is_remote_commit']); + + self::assertArrayHasKey('is_remote_branch', $commit); + self::assertIsBool($commit['is_remote_branch']); + + self::assertArrayHasKey('author', $commit); + self::assertIsArray($commit['author']); + self::assertArrayHasKey('name', $commit['author']); + self::assertArrayHasKey('email', $commit['author']); + self::assertArrayHasKey('date', $commit['author']); + self::assertIsString($commit['author']['name']); + self::assertIsString($commit['author']['email']); + self::assertIsString($commit['author']['date']); + + self::assertArrayHasKey('committer', $commit); + self::assertIsArray($commit['committer']); + self::assertArrayHasKey('name', $commit['committer']); + self::assertArrayHasKey('email', $commit['committer']); + self::assertArrayHasKey('date', $commit['committer']); + self::assertIsString($commit['committer']['name']); + self::assertIsString($commit['committer']['email']); + self::assertIsString($commit['committer']['date']); + } + /** * Test for checkGitRevision */ @@ -418,38 +542,33 @@ class GitTest extends AbstractTestCase */ public function testExtractDataFormTextBody(): void { - $extractedData = $this->callFunction( - $this->object, - Git::class, - 'extractDataFormTextBody', + $extractedData = Git::extractDataFormTextBody( [ - [ - 'tree ed7fec263e1813887001855ddca9293479289180', - 'parent 90543399991cdb294185f90e8ae1a45e059c31ab', - 'author William Desportes 1657717000 +0200', - 'committer William Desportes 1657717000 +0200', - 'gpgsig -----BEGIN PGP SIGNATURE-----', - ' ', - ' iQIzBAABCgAdFiEExNkf3872tKPGU\/14kKDvG4JRqIkFAmLOwQgACgkQkKDvG4JR', - ' qIn8Kg\/+Os5e3bFLEtd3q\/w3e4IfvR64rdadA4IUugd4pJvGqJHleJNBQ8PNqwjR', - ' 9W0S9PQXAsul0XW5YtuLmBMGFFQDOab2ieix9CVA1w0D7quVQR8uLNb1Gln28NuS', - ' 6b24Q4cAQlp5uOoKT3ohRBUtGmu8SXF8Q\/5BwPY1AuL1LqY6w6EwSsInPXK1Yq3r', - ' RShxRXDhonKx3NqoCdRkWmAKkQrztWGGBI7mBG\/\/X0F4hSjsuwdpHBsl6yyri9p2', - ' bJbyAI+xQ+rBHb0iFIoLbxj6G1EkEmpISl+4980uef24SwMVk9ZOfH8cAgBZ62Mf', - ' xJ3f99ujhD9dvwCQivOwcEav+fPObiLC0EzfoqZgB7rTQdxUIu7WRpShZGwfuiEv', - ' sBmvQcnZptYHi0Kk78fdzISCQcPBgCw0gGcv+yLOE3HuQ24B+ncCusYdxyJQqMSc', - ' pm9vVHpwioufy5c7aBa05K7f2b1AhiZeVpT2t\/rboIYlIhQGY9uRNGX44Qtt6Oeb', - ' G6aU8O7gS5+Wsj00K+uSvUE\/znxx7Ad0zVuFQGUAhd3cDp9T09+FIr4TOE+3Z4Pk', - ' PlssVGVBdbaNaI0\/eV6fTa6B0hMH9mhmZhtHLXdsTw5xVySz7by5DZqZldydSFtk', - ' tVuUPxykK6F0qY79IPBH8Unx8egIlSzKWfP0JpRd+otemBnTKWg=', - ' =BVHc', - ' -----END PGP SIGNATURE-----', - '', - 'Remove ignore config.inc.php for psalm because it fails the CI', - '', - 'Signed-off-by: William Desportes ', - '', - ], + 'tree ed7fec263e1813887001855ddca9293479289180', + 'parent 90543399991cdb294185f90e8ae1a45e059c31ab', + 'author William Desportes 1657717000 +0200', + 'committer William Desportes 1657717000 +0200', + 'gpgsig -----BEGIN PGP SIGNATURE-----', + ' ', + ' iQIzBAABCgAdFiEExNkf3872tKPGU\/14kKDvG4JRqIkFAmLOwQgACgkQkKDvG4JR', + ' qIn8Kg\/+Os5e3bFLEtd3q\/w3e4IfvR64rdadA4IUugd4pJvGqJHleJNBQ8PNqwjR', + ' 9W0S9PQXAsul0XW5YtuLmBMGFFQDOab2ieix9CVA1w0D7quVQR8uLNb1Gln28NuS', + ' 6b24Q4cAQlp5uOoKT3ohRBUtGmu8SXF8Q\/5BwPY1AuL1LqY6w6EwSsInPXK1Yq3r', + ' RShxRXDhonKx3NqoCdRkWmAKkQrztWGGBI7mBG\/\/X0F4hSjsuwdpHBsl6yyri9p2', + ' bJbyAI+xQ+rBHb0iFIoLbxj6G1EkEmpISl+4980uef24SwMVk9ZOfH8cAgBZ62Mf', + ' xJ3f99ujhD9dvwCQivOwcEav+fPObiLC0EzfoqZgB7rTQdxUIu7WRpShZGwfuiEv', + ' sBmvQcnZptYHi0Kk78fdzISCQcPBgCw0gGcv+yLOE3HuQ24B+ncCusYdxyJQqMSc', + ' pm9vVHpwioufy5c7aBa05K7f2b1AhiZeVpT2t\/rboIYlIhQGY9uRNGX44Qtt6Oeb', + ' G6aU8O7gS5+Wsj00K+uSvUE\/znxx7Ad0zVuFQGUAhd3cDp9T09+FIr4TOE+3Z4Pk', + ' PlssVGVBdbaNaI0\/eV6fTa6B0hMH9mhmZhtHLXdsTw5xVySz7by5DZqZldydSFtk', + ' tVuUPxykK6F0qY79IPBH8Unx8egIlSzKWfP0JpRd+otemBnTKWg=', + ' =BVHc', + ' -----END PGP SIGNATURE-----', + '', + 'Remove ignore config.inc.php for psalm because it fails the CI', + '', + 'Signed-off-by: William Desportes ', + '', ] ); @@ -468,4 +587,48 @@ class GitTest extends AbstractTestCase . 'it fails the CI Signed-off-by: William Desportes ', ], $extractedData); } + + /** + * Test that we can extract values from Git CLI format + */ + public function testExtractDataFormTextBodySecondFormat(): void + { + $extractedData = Git::extractDataFormTextBody( + [ + 'tree 6857f00bb50360825c7df2c40ad21006c30beca7', + 'parent 1634264816449dc42d17872174f3e8d73d4e36b2', + 'author John Doe 1734427284', + 'committer Hosted Weblate 1734516032', + '', + 'Translated using Weblate (Finnish)', + '', + 'Currently translated at 61.4% (2105 of 3428 strings)', + '', + '[ci skip]', + '', + 'Translation: phpMyAdmin/5.2', + 'Translate-URL: https://hosted.weblate.org/projects/phpmyadmin/5-2/fi/', + 'Signed-off-by: John Doe ', + '', + ] + ); + + self::assertSame([ + [ + 'name' => 'John Doe', + 'email' => 'john.doe@example.org', + 'date' => '2024-12-17 09:21:24 +0000', + ], + [ + 'name' => 'Hosted Weblate', + 'email' => 'hosted@weblate.org', + 'date' => '2024-12-18 10:00:32 +0000', + ], + 'Translated using Weblate (Finnish) ' + . ' Currently translated at 61.4% (2105 of 3428 strings) ' + . ' [ci skip] Translation: phpMyAdmin/5.2 ' + . 'Translate-URL: https://hosted.weblate.org/projects/phpmyadmin/5-2/fi/' + . ' Signed-off-by: John Doe ', + ], $extractedData); + } } From a6642254f88553c25e96aed39695f9b2f743b024 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Thu, 19 Dec 2024 00:55:04 +0100 Subject: [PATCH 3/3] Update the phpstan and psalm baselines Signed-off-by: William Desportes --- phpstan-baseline.neon | 61 ++++++++++++++++++++++++++++++++++--------- psalm-baseline.xml | 60 ++++++++++++++++++++++++++++++++---------- 2 files changed, 94 insertions(+), 27 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index b1fb9df463..462384e1fd 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -780,11 +780,31 @@ parameters: count: 1 path: libraries/classes/Command/TwigLintCommand.php + - + message: "#^Offset 'date' does not exist on array\\\\|string\\.$#" + count: 2 + path: libraries/classes/Command/WriteGitRevisionCommand.php + + - + message: "#^Offset 'email' does not exist on array\\\\|string\\.$#" + count: 2 + path: libraries/classes/Command/WriteGitRevisionCommand.php + + - + message: "#^Offset 'name' does not exist on array\\\\|string\\.$#" + count: 2 + path: libraries/classes/Command/WriteGitRevisionCommand.php + - message: "#^PHPDoc type string of property PhpMyAdmin\\\\Command\\\\WriteGitRevisionCommand\\:\\:\\$defaultName is not the same as PHPDoc type string\\|null of overridden property Symfony\\\\Component\\\\Console\\\\Command\\\\Command\\:\\:\\$defaultName\\.$#" count: 1 path: libraries/classes/Command/WriteGitRevisionCommand.php + - + message: "#^Parameter \\#1 \\$str of function trim expects string, array\\\\|string given\\.$#" + count: 1 + path: libraries/classes/Command/WriteGitRevisionCommand.php + - message: "#^Cannot access offset 'Server' on mixed\\.$#" count: 1 @@ -15567,12 +15587,7 @@ parameters: - message: "#^Method PhpMyAdmin\\\\Dbal\\\\MysqliResult\\:\\:fetchAllKeyPair\\(\\) should return array\\ but returns array\\.$#" - count: 1 - path: libraries/classes/Dbal/MysqliResult.php - - - - message: "#^Method PhpMyAdmin\\\\Dbal\\\\MysqliResult\\:\\:fetchAllKeyPair\\(\\) should return array\\ but returns array\\\\.$#" - count: 1 + count: 2 path: libraries/classes/Dbal/MysqliResult.php - @@ -19455,6 +19470,21 @@ parameters: count: 1 path: libraries/classes/Git.php + - + message: "#^Cannot access offset 'date' on mixed\\.$#" + count: 2 + path: libraries/classes/Git.php + + - + message: "#^Cannot access offset 'email' on mixed\\.$#" + count: 2 + path: libraries/classes/Git.php + + - + message: "#^Cannot access offset 'name' on mixed\\.$#" + count: 2 + path: libraries/classes/Git.php + - message: "#^Cannot access offset 1 on array\\|false\\.$#" count: 2 @@ -19495,11 +19525,6 @@ parameters: count: 1 path: libraries/classes/Git.php - - - message: "#^Method PhpMyAdmin\\\\Git\\:\\:extractDataFormTextBody\\(\\) has parameter \\$commit with no value type specified in iterable type array\\.$#" - count: 1 - path: libraries/classes/Git.php - - message: "#^Method PhpMyAdmin\\\\Git\\:\\:getHashFromHeadRef\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -19551,7 +19576,7 @@ parameters: path: libraries/classes/Git.php - - message: "#^Parameter \\#1 \\$commit of method PhpMyAdmin\\\\Git\\:\\:extractDataFormTextBody\\(\\) expects array, mixed given\\.$#" + message: "#^Parameter \\#1 \\$commit of static method PhpMyAdmin\\\\Git\\:\\:extractDataFormTextBody\\(\\) expects array\\, mixed given\\.$#" count: 1 path: libraries/classes/Git.php @@ -19616,7 +19641,7 @@ parameters: path: libraries/classes/Git.php - - message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$str of function explode expects string, string\\|null given\\.$#" count: 1 path: libraries/classes/Git.php @@ -45090,6 +45115,16 @@ parameters: count: 1 path: test/classes/Gis/GisPolygonTest.php + - + message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertIsArray\\(\\) with array will always evaluate to true\\.$#" + count: 1 + path: test/classes/GitTest.php + + - + message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNotNull\\(\\) with array will always evaluate to true\\.$#" + count: 1 + path: test/classes/GitTest.php + - message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:markTestSkipped\\(\\)\\.$#" count: 2 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 461a1924a4..47ff2d32a5 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -266,9 +266,28 @@ + + $author['date'] + $author['email'] + $author['name'] + $committer['date'] + $committer['email'] + $committer['name'] + $defaultName + + $message + + + $author['date'] + $author['email'] + $author['name'] + $committer['date'] + $committer['email'] + $committer['name'] + @@ -6744,26 +6763,28 @@ $params + + is_array($info) ? $info : [] + + + array{revision: string, revisionUrl: string, branch: string, branchUrl: string}|[] + $db $table - - $info + $params['route'] $params['server'] $subObject - - array{revision: string, revisionUrl: string, branch: string, branchUrl: string}|[] - is_array($info) ? $info : [] - (string) $GLOBALS['db'] (string) $GLOBALS['table'] (string) $_REQUEST['no_history'] - + + is_array($info) is_scalar($GLOBALS['db']) is_scalar($GLOBALS['table']) isset($GLOBALS['db']) && is_scalar($GLOBALS['db']) @@ -6772,6 +6793,9 @@ ! isset($dbi) + + [] + @@ -7542,22 +7566,25 @@ - + $commit $commit_json->message - $dataline $hash $hash $hash $offset + ($position * 20) $offset + ($position * 4) - + + $info['author']['date'] + $info['author']['email'] + $info['author']['name'] + $info['committer']['date'] + $info['committer']['email'] + $info['committer']['name'] + + $commit - - - $commit - $dataline $end $git_location $isRemoteCommit @@ -15517,6 +15544,11 @@ $queryString + + + assertIsArray + + array