Skip to content

Commit

Permalink
fix snippet tests, throw exception in ServiceBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer committed Dec 11, 2024
1 parent 7f55d28 commit c3190f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 31 deletions.
27 changes: 12 additions & 15 deletions Core/src/ServiceBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
use Google\Cloud\Storage\StorageClient;
use Google\Cloud\Trace\TraceClient;
use Google\Cloud\Translate\V2\TranslateClient;
use Google\Cloud\Vision\VisionClient;
use Google\Cloud\Vision\V1\Client\ImageAnnotatorClient;
use Google\Cloud\Vision\VisionClient as DeprecatedVisionClient;
use Psr\Cache\CacheItemPoolInterface;

/**
Expand Down Expand Up @@ -336,23 +337,19 @@ public function trace(array $config = [])
}

/**
* Google Cloud Vision allows you to understand the content of an image,
* classify images into categories, detect text, objects, faces and more.
* Find more information at the
* [Google Cloud Vision docs](https://cloud.google.com/vision/docs/).
*
* Example:
* ```
* $vision = $cloud->vision();
* ```
*
* @param array $config [optional] Configuration options. See
* {@see \Google\Cloud\Core\ServiceBuilder::__construct()} for the available options.
* @return VisionClient
* @deprecated
* @see ImageAnnotatorClient
* @throws \BadMethodCallException
*/
public function vision(array $config = [])
{
return $this->createClient(VisionClient::class, 'vision', $config);
if (class_exists(DeprecatedVisionClient::class)) {
return $this->createClient(DeprecatedVisionClient::class, 'vision', $config);
}
throw new \BadMethodCallException(sprintf(

Check failure on line 349 in Core/src/ServiceBuilder.php

View workflow job for this annotation

GitHub Actions / PHPStan Static Analysis

Call to sprintf contains 1 placeholder, 0 values given.
'This method is no longer supported, create %s directly instead.'.
ImageAnnotatorClient::class
));
}

/**
Expand Down
16 changes: 0 additions & 16 deletions Vision/phpunit-snippets.xml.dist

This file was deleted.

0 comments on commit c3190f2

Please sign in to comment.