diff --git a/src/Client.php b/src/Client.php index 57ba90ba..1d0857e3 100644 --- a/src/Client.php +++ b/src/Client.php @@ -24,11 +24,6 @@ class Client { - /** - * @deprecated Use {@see Configuration::NOTIFY_ENDPOINT} instead - */ - const ENDPOINT = Configuration::NOTIFY_ENDPOINT; - /** * The config instance. * @@ -128,7 +123,7 @@ public function __construct( $this->resolver = $resolver ?: new BasicResolver(); $this->recorder = new Recorder(); $this->pipeline = new Pipeline(); - $this->http = new HttpClient($config, $guzzle ?: static::makeGuzzle()); + $this->http = new HttpClient($config, $guzzle ?: self::makeGuzzle()); $this->sessionTracker = new SessionTracker($config, $this->http); $this->registerMiddleware(new NotificationSkipper($config)); @@ -141,36 +136,17 @@ public function __construct( } /** - * Make a new guzzle client instance. - * - * @param string $base No longer used - * @param array $options - * * @return ClientInterface - * - * @deprecated Will be removed in a future release */ - public static function makeGuzzle($base = null, array $options = []) + private static function makeGuzzle() { - if ($path = static::getCaBundlePath()) { - $options['verify'] = $path; + if (version_compare(PHP_VERSION, '5.6.0') >= 0) { + return new GuzzleClient(); } - return new GuzzleClient($options); - } - - /** - * Get the ca bundle path if one exists. - * - * @return string|false - */ - protected static function getCaBundlePath() - { - if (version_compare(PHP_VERSION, '5.6.0') >= 0 || !class_exists(CaBundle::class)) { - return false; - } - - return realpath(CaBundle::getSystemCaRootBundlePath()); + return new GuzzleClient([ + 'verify' => realpath(CaBundle::getSystemCaRootBundlePath()), + ]); } /** @@ -332,22 +308,6 @@ public function notify(Report $report, callable $callback = null) } } - /** - * Notify Bugsnag of a deployment. - * - * @deprecated This function is being deprecated in favour of `build`. - * - * @param string|null $repository the repository from which you are deploying the code - * @param string|null $branch the source control branch from which you are deploying - * @param string|null $revision the source control revision you are currently deploying - * - * @return void - */ - public function deploy($repository = null, $branch = null, $revision = null) - { - $this->build($repository, $revision); - } - /** * Notify Bugsnag of a build. * @@ -849,7 +809,7 @@ public function getBuildEndpoint() } /** - * Set session tracking state and pass in optional guzzle. + * Set session tracking state. * * @param bool $track whether to track sessions * diff --git a/src/Configuration.php b/src/Configuration.php index f66e77f5..739bf25b 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -644,7 +644,7 @@ public function getBuildEndpoint() } /** - * Set session tracking state and pass in optional guzzle. + * Set session tracking state. * * @param bool $track whether to track sessions * diff --git a/src/HttpClient.php b/src/HttpClient.php index ca63eef4..68b614c2 100644 --- a/src/HttpClient.php +++ b/src/HttpClient.php @@ -13,15 +13,10 @@ class HttpClient */ const MAX_SIZE = 1048576; - /** - * @deprecated Use {@see HttpClient::NOTIFICATION_PAYLOAD_VERSION} instead - */ - const PAYLOAD_VERSION = self::NOTIFICATION_PAYLOAD_VERSION; - /** * The payload version for the error notification API. */ - const NOTIFICATION_PAYLOAD_VERSION = '4.0'; + const NOTIFY_PAYLOAD_VERSION = '4.0'; /** * The payload version for the session API. @@ -115,33 +110,6 @@ public function sendSessions(array $payload) ); } - /** - * Notify Bugsnag of a deployment. - * - * @deprecated This method should no longer be used in favour of sendBuildReport. - * - * @param array $data the deployment information - * - * @return void - */ - public function deploy(array $data) - { - $app = $this->config->getAppData(); - - $data['releaseStage'] = $app['releaseStage']; - - if (isset($app['version'])) { - $data['appVersion'] = $app['version']; - } - - $data['apiKey'] = $this->config->getApiKey(); - - $this->post( - $this->config->getNotifyEndpoint().'deploy', - ['json' => $data] - ); - } - /** * Notify Bugsnag of a build. * @@ -231,7 +199,7 @@ protected function deliverEvents(array $data) $this->config->getNotifyEndpoint(), [ 'json' => $normalized, - 'headers' => $this->getHeaders(self::NOTIFICATION_PAYLOAD_VERSION), + 'headers' => $this->getHeaders(self::NOTIFY_PAYLOAD_VERSION), ] ); } catch (Exception $e) { diff --git a/src/Report.php b/src/Report.php index 3debabf6..b231cfaa 100644 --- a/src/Report.php +++ b/src/Report.php @@ -9,15 +9,10 @@ class Report { - /** - * @deprecated Use {@see HttpClient::NOTIFICATION_PAYLOAD_VERSION} instead - */ - const PAYLOAD_VERSION = HttpClient::NOTIFICATION_PAYLOAD_VERSION; - /** * The config object. * - * @var \Bugsnag\Config + * @var Configuration */ protected $config; @@ -650,7 +645,7 @@ public function toArray() 'device' => array_merge(['time' => $this->time], $this->config->getDeviceData()), 'user' => $this->getUser(), 'context' => $this->getContext(), - 'payloadVersion' => HttpClient::NOTIFICATION_PAYLOAD_VERSION, + 'payloadVersion' => HttpClient::NOTIFY_PAYLOAD_VERSION, 'severity' => $this->getSeverity(), 'exceptions' => $this->exceptionArray(), 'breadcrumbs' => $this->breadcrumbs, diff --git a/src/SessionTracker.php b/src/SessionTracker.php index ad9cede0..dc2451c0 100644 --- a/src/SessionTracker.php +++ b/src/SessionTracker.php @@ -17,11 +17,6 @@ class SessionTracker */ protected static $MAX_SESSION_COUNT = 50; - /** - * @deprecated Use {@see HttpClient::NOTIFICATION_PAYLOAD_VERSION} instead - */ - protected static $SESSION_PAYLOAD_VERSION = HttpClient::SESSION_PAYLOAD_VERSION; - /** * The key for storing session counts. */ diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 7eeeeee6..5092beac 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -480,99 +480,6 @@ public function testCanManuallyFlush() $this->client->flush(); } - public function testDeployWorksOutOfTheBox() - { - $this->guzzlePostWith( - 'https://build.bugsnag.com', - ['json' => ['releaseStage' => 'production', 'apiKey' => 'example-api-key', 'buildTool' => 'bugsnag-php', 'builderName' => exec('whoami'), 'appVersion' => '1.3.1']] - ); - - $this->client = new Client($this->config = new Configuration('example-api-key'), null, $this->guzzle); - $this->config->setAppVersion('1.3.1'); - - $this->client->deploy(); - } - - public function testDeployWorksWithReleaseStage() - { - $this->guzzlePostWith( - 'https://build.bugsnag.com', - ['json' => ['releaseStage' => 'staging', 'apiKey' => 'example-api-key', 'buildTool' => 'bugsnag-php', 'builderName' => exec('whoami'), 'appVersion' => '1.3.1']] - ); - - $this->client = new Client($this->config = new Configuration('example-api-key'), null, $this->guzzle); - $this->config->setAppVersion('1.3.1'); - $this->config->setReleaseStage('staging'); - - $this->client->deploy(); - } - - public function testDeployWorksWithAppVersion() - { - $this->guzzlePostWith( - 'https://build.bugsnag.com', - ['json' => ['releaseStage' => 'production', 'appVersion' => '1.1.0', 'apiKey' => 'example-api-key', 'buildTool' => 'bugsnag-php', 'builderName' => exec('whoami'), 'appVersion' => '1.3.1']] - ); - - $this->client = new Client($this->config = new Configuration('example-api-key'), null, $this->guzzle); - $this->config->setAppVersion('1.3.1'); - - $this->client->deploy(); - } - - public function testDeployWorksWithRepository() - { - $this->guzzlePostWith( - 'https://build.bugsnag.com', - ['json' => ['sourceControl' => ['repository' => 'foo'], 'releaseStage' => 'production', 'apiKey' => 'example-api-key', 'buildTool' => 'bugsnag-php', 'builderName' => exec('whoami'), 'appVersion' => '1.3.1']] - ); - - $this->client = new Client($this->config = new Configuration('example-api-key'), null, $this->guzzle); - $this->config->setAppVersion('1.3.1'); - - $this->client->deploy('foo'); - } - - public function testDeployWorksWithBranch() - { - $this->guzzlePostWith( - 'https://build.bugsnag.com', - ['json' => ['releaseStage' => 'production', 'apiKey' => 'example-api-key', 'buildTool' => 'bugsnag-php', 'builderName' => exec('whoami'), 'appVersion' => '1.3.1']] - ); - - $this->client = new Client($this->config = new Configuration('example-api-key'), null, $this->guzzle); - $this->config->setAppVersion('1.3.1'); - - $this->client->deploy(null, 'master'); - } - - public function testDeployWorksWithRevision() - { - $this->guzzlePostWith( - 'https://build.bugsnag.com', - ['json' => ['sourceControl' => ['revision' => 'bar'], 'releaseStage' => 'production', 'apiKey' => 'example-api-key', 'buildTool' => 'bugsnag-php', 'builderName' => exec('whoami'), 'appVersion' => '1.3.1']] - ); - - $this->client = new Client($this->config = new Configuration('example-api-key'), null, $this->guzzle); - $this->config->setAppVersion('1.3.1'); - - $this->client->deploy(null, null, 'bar'); - } - - public function testDeployWorksWithEverything() - { - $this->guzzlePostWith( - 'https://build.bugsnag.com', - ['json' => ['sourceControl' => ['repository' => 'baz', 'revision' => 'foo'], 'releaseStage' => 'development', 'appVersion' => '1.3.1', 'apiKey' => 'example-api-key', 'buildTool' => 'bugsnag-php', 'builderName' => exec('whoami'), 'appVersion' => '1.3.1']] - ); - - $this->client = new Client($this->config = new Configuration('example-api-key'), null, $this->guzzle); - $this->config->setReleaseStage('development'); - $this->config->setAppVersion('1.3.1'); - - $this->client->deploy('baz', 'develop', 'foo'); - } - public function testBuildWorksOutOfTheBox() { $this->guzzlePostWith(