Skip to content

Fix PHP 8.4 deprecation warnings #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading