style: fix cs and type in SSH2::get_stream_timeout()

This commit is contained in:
Simon Podlipsky 2024-07-09 09:17:13 +03:00
parent cdd87934cc
commit 6b960902a0
No known key found for this signature in database
GPG Key ID: 9EEEDB31F3A8D760
4 changed files with 10 additions and 3 deletions

View File

@ -3,7 +3,10 @@
declare(strict_types=1); declare(strict_types=1);
return (new PhpCsFixer\Config()) return (new PhpCsFixer\Config())
->setFinder(PhpCsFixer\Finder::create()->in(__DIR__ . '/..')) ->setFinder(PhpCsFixer\Finder::create()
->in(__DIR__ . '/..')
// https://github.com/phpseclib/phpseclib/pull/2016#discussion_r1691282898
->notPath('phpseclib/Crypt/Blowfish.php'))
->setCacheFile(__DIR__ . '/php-cs-fixer.cache') ->setCacheFile(__DIR__ . '/php-cs-fixer.cache')
->setRiskyAllowed(true) ->setRiskyAllowed(true)
// https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/rules/index.rst // https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/rules/index.rst

View File

@ -3134,7 +3134,7 @@ class SSH2
*/ */
private function get_stream_timeout() private function get_stream_timeout()
{ {
$sec = ini_get('default_socket_timeout'); $sec = (int) ini_get('default_socket_timeout');
$usec = 0; $usec = 0;
if ($this->curTimeout > 0) { if ($this->curTimeout > 0) {
$sec = (int) floor($this->curTimeout); $sec = (int) floor($this->curTimeout);

View File

@ -1,5 +1,7 @@
<?php <?php
declare(strict_types=1);
/** @var iterable<SplFileInfo> $files */ /** @var iterable<SplFileInfo> $files */
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__)); $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__));
foreach ($files as $file) { foreach ($files as $file) {
@ -17,7 +19,7 @@ foreach ($files as $file) {
'~ function assertIsObject\(\$actual, \$message = \'\'\)~' => ' function _assertIsObject($actual, string $message = \'\')', '~ function assertIsObject\(\$actual, \$message = \'\'\)~' => ' function _assertIsObject($actual, string $message = \'\')',
'~ function assertIsString\(\$actual, \$message = \'\'\)~' => ' function _assertIsString($actual, string $message = \'\')', '~ function assertIsString\(\$actual, \$message = \'\'\)~' => ' function _assertIsString($actual, string $message = \'\')',
'~ function assertStringContainsString\(\$needle, \$haystack, \$message = \'\'\)~' => ' function _assertStringContainsString(string $needle, string $haystack, string $message = \'\')', '~ function assertStringContainsString\(\$needle, \$haystack, \$message = \'\'\)~' => ' function _assertStringContainsString(string $needle, string $haystack, string $message = \'\')',
'~ function assertStringNotContainsString\(\$needle, \$haystack, \$message = \'\'\)~' => ' function _assertStringNotContainsString(string $needle, string $haystack, string $message = \'\')' '~ function assertStringNotContainsString\(\$needle, \$haystack, \$message = \'\'\)~' => ' function _assertStringNotContainsString(string $needle, string $haystack, string $message = \'\')',
]; ];
$updatedFileContents = preg_replace( $updatedFileContents = preg_replace(
array_keys($patternToReplacementMap), array_keys($patternToReplacementMap),

View File

@ -1,5 +1,7 @@
<?php <?php
declare(strict_types=1);
/** @var iterable<SplFileInfo> $files */ /** @var iterable<SplFileInfo> $files */
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__)); $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__));
foreach ($files as $file) { foreach ($files as $file) {