diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 266c367d4..f1301ee12 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -63,7 +63,6 @@ - @@ -78,9 +77,13 @@ - + + + + + + - @@ -96,41 +99,16 @@ - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/GridFS/Bucket.php b/src/GridFS/Bucket.php index 96c858535..f571586ed 100644 --- a/src/GridFS/Bucket.php +++ b/src/GridFS/Bucket.php @@ -232,7 +232,7 @@ public function delete($id) */ public function downloadToStream($id, $destination) { - if (! is_resource($destination) || get_resource_type($destination) != "stream") { + if (! is_resource($destination) || get_resource_type($destination) != 'stream') { throw InvalidArgumentException::invalidType('$destination', $destination, 'resource'); } @@ -272,7 +272,7 @@ public function downloadToStream($id, $destination) */ public function downloadToStreamByName(string $filename, $destination, array $options = []) { - if (! is_resource($destination) || get_resource_type($destination) != "stream") { + if (! is_resource($destination) || get_resource_type($destination) != 'stream') { throw InvalidArgumentException::invalidType('$destination', $destination, 'resource'); } @@ -616,7 +616,7 @@ public function rename($id, string $newFilename) */ public function uploadFromStream(string $filename, $source, array $options = []) { - if (! is_resource($source) || get_resource_type($source) != "stream") { + if (! is_resource($source) || get_resource_type($source) != 'stream') { throw InvalidArgumentException::invalidType('$source', $source, 'resource'); } @@ -685,7 +685,7 @@ private function getFilesNamespace(): string */ private function getRawFileDocumentForStream($stream): object { - if (! is_resource($stream) || get_resource_type($stream) != "stream") { + if (! is_resource($stream) || get_resource_type($stream) != 'stream') { throw InvalidArgumentException::invalidType('$stream', $stream, 'resource'); } diff --git a/tests/DocumentationExamplesTest.php b/tests/DocumentationExamplesTest.php index 5f3d96aba..d15e01d83 100644 --- a/tests/DocumentationExamplesTest.php +++ b/tests/DocumentationExamplesTest.php @@ -1403,7 +1403,7 @@ private function commitWithRetry3(\MongoDB\Driver\Session $session): void private function updateEmployeeInfo3(\MongoDB\Client $client, \MongoDB\Driver\Session $session): void { $session->startTransaction([ - 'readConcern' => new \MongoDB\Driver\ReadConcern("snapshot"), + 'readConcern' => new \MongoDB\Driver\ReadConcern('snapshot'), 'readPrefernece' => new \MongoDB\Driver\ReadPreference(\MongoDB\Driver\ReadPreference::PRIMARY), 'writeConcern' => new \MongoDB\Driver\WriteConcern(\MongoDB\Driver\WriteConcern::MAJORITY), ]); diff --git a/tests/FunctionalTestCase.php b/tests/FunctionalTestCase.php index 3f02148e7..2a79e6b19 100644 --- a/tests/FunctionalTestCase.php +++ b/tests/FunctionalTestCase.php @@ -534,7 +534,7 @@ public static function isCryptSharedLibAvailable(): bool /** @see https://www.mongodb.com/docs/manual/core/queryable-encryption/reference/mongocryptd/ */ public static function isMongocryptdAvailable(): bool { - $paths = explode(PATH_SEPARATOR, getenv("PATH")); + $paths = explode(PATH_SEPARATOR, getenv('PATH')); foreach ($paths as $path) { if (is_executable($path . DIRECTORY_SEPARATOR . 'mongocryptd')) { diff --git a/tests/GridFS/BucketFunctionalTest.php b/tests/GridFS/BucketFunctionalTest.php index 9de4479ac..ebeb4d6c2 100644 --- a/tests/GridFS/BucketFunctionalTest.php +++ b/tests/GridFS/BucketFunctionalTest.php @@ -140,7 +140,7 @@ public function testDeleteStillRemovesChunksIfFileDoesNotExist($input, $expected public function testDownloadingFileWithMissingChunk(): void { - $id = $this->bucket->uploadFromStream("filename", $this->createStream("foobar")); + $id = $this->bucket->uploadFromStream('filename', $this->createStream('foobar')); $this->chunksCollection->deleteOne(['files_id' => $id, 'n' => 0]); @@ -151,7 +151,7 @@ public function testDownloadingFileWithMissingChunk(): void public function testDownloadingFileWithUnexpectedChunkIndex(): void { - $id = $this->bucket->uploadFromStream("filename", $this->createStream("foobar")); + $id = $this->bucket->uploadFromStream('filename', $this->createStream('foobar')); $this->chunksCollection->updateOne( ['files_id' => $id, 'n' => 0], @@ -165,7 +165,7 @@ public function testDownloadingFileWithUnexpectedChunkIndex(): void public function testDownloadingFileWithUnexpectedChunkSize(): void { - $id = $this->bucket->uploadFromStream("filename", $this->createStream("foobar")); + $id = $this->bucket->uploadFromStream('filename', $this->createStream('foobar')); $this->chunksCollection->updateOne( ['files_id' => $id, 'n' => 0], diff --git a/tests/PedantryTest.php b/tests/PedantryTest.php index d0068d527..5c45b09b1 100644 --- a/tests/PedantryTest.php +++ b/tests/PedantryTest.php @@ -32,10 +32,8 @@ public function testMethodsAreOrderedAlphabeticallyByVisibility($className): voi $methods = array_filter( $methods, - function (ReflectionMethod $method) use ($class) { - return $method->getDeclaringClass() == $class // Exclude inherited methods - && $method->getFileName() === $class->getFileName(); // Exclude methods inherited from traits - }, + fn (ReflectionMethod $method) => $method->getDeclaringClass() == $class // Exclude inherited methods + && $method->getFileName() === $class->getFileName(), // Exclude methods inherited from traits ); $getSortValue = function (ReflectionMethod $method) { diff --git a/tools/detect-extension.php b/tools/detect-extension.php index 4b599fd4b..13eabb5c0 100644 --- a/tools/detect-extension.php +++ b/tools/detect-extension.php @@ -85,7 +85,7 @@ function grepIniFile(string $filename, string $extension): int if (defined('PHP_WINDOWS_VERSION_BUILD')) { $zts = PHP_ZTS ? 'Thread Safe (TS)' : 'Non Thread Safe (NTS)'; $arch = PHP_INT_SIZE === 8 ? 'x64' : 'x86'; - $dll = sprintf("%d.%d %s %s", PHP_MAJOR_VERSION, PHP_MINOR_VERSION, $zts, $arch); + $dll = sprintf('%d.%d %s %s', PHP_MAJOR_VERSION, PHP_MINOR_VERSION, $zts, $arch); printf("You likely need to download a Windows DLL for: %s\n", $dll); printf("Windows DLLs should be available from: https://pecl.php.net/package/%s\n", $extension);