Skip to content

Commit

Permalink
Fix PHP 8.4 deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
avsej committed Dec 5, 2024
1 parent 3afcfcc commit 9e3f387
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
8 changes: 3 additions & 5 deletions bin/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
require "fileutils"
require "rbconfig"
require "shellwords"
require 'optparse'
require "optparse"

DEFAULT_PHP_NAME = "php"
CB_PHP_NAME = ENV.fetch("CB_PHP_NAME", DEFAULT_PHP_NAME)
Expand Down Expand Up @@ -130,7 +130,7 @@ def find_extension(name_pattern, project_root, module_location_candidates)

php_unit_phar = File.join(build_root, "phpunit.phar")
unless File.file?(php_unit_phar)
php_unit_version = "9.5"
php_unit_version = "10.5.38"
php_unit_url = "https://phar.phpunit.de/phpunit-#{php_unit_version}.phar"
FileUtils.mkdir_p(File.dirname(php_unit_phar))
run("curl -L -o #{php_unit_phar.shellescape} #{php_unit_url}")
Expand Down Expand Up @@ -159,9 +159,7 @@ def find_extension(name_pattern, project_root, module_location_candidates)
end
end

if extra_php_args.empty?
abort "Unable to find the module. Candidates: #{module_location_candidates.inspect}"
end
abort "Unable to find the module. Candidates: #{module_location_candidates.inspect}" if extra_php_args.empty?

tests = ARGV.to_a
tests << File.join(project_root, "tests") if tests.empty?
Expand Down
4 changes: 2 additions & 2 deletions tests/Helpers/ConsistencyUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public function waitUntilCollectionDropped(string $bucketName, string $scopeName
);
}

public function waitUntilBucketUpdated(string $bucketName, callable $predicate, string $errorMsg = null): void
public function waitUntilBucketUpdated(string $bucketName, callable $predicate, ?string $errorMsg = null): void
{
fprintf(STDERR, "waiting until bucket %s has been updated\n", $bucketName);

Expand All @@ -267,7 +267,7 @@ public function waitUntilBucketUpdated(string $bucketName, callable $predicate,
);
}

public function waitUntilCollectionUpdated(string $bucketName, string $scopeName, string $collectionName, callable $predicate, string $errorMsg = null): void
public function waitUntilCollectionUpdated(string $bucketName, string $scopeName, string $collectionName, callable $predicate, ?string $errorMsg = null): void
{
fprintf(STDERR, "waiting until collection %s on scope %s on bucket %s has updated\n", $collectionName, $scopeName, $bucketName);

Expand Down
6 changes: 3 additions & 3 deletions tests/Helpers/CouchbaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ public function connectClusterUnique(?ClusterOptions $options = null): ClusterIn
return Cluster::connect($connstr, $options);
}

public function openBucket(string $name = null): BucketInterface
public function openBucket(?string $name = null): BucketInterface
{
if ($name == null) {
$name = self::env()->bucketName();
}
return $this->connectCluster()->bucket($name);
}

public function defaultCollection(string $bucketName = null): CollectionInterface
public function defaultCollection(?string $bucketName = null): CollectionInterface
{
if ($bucketName == null) {
$bucketName = self::env()->bucketName();
Expand All @@ -121,7 +121,7 @@ public function consistencyUtil(): ConsistencyUtils
return self::env()->consistencyUtil();
}

public function uniqueId(string $prefix = null): string
public function uniqueId(?string $prefix = null): string
{
if ($prefix != null) {
return sprintf("%s_%s", $prefix, self::env()::randomId());
Expand Down

0 comments on commit 9e3f387

Please sign in to comment.