CS and fixes

This commit is contained in:
Nyholm 2019-01-12 10:09:22 +01:00 committed by David Garcia
parent 2ec2c16227
commit 0f54332d0e
8 changed files with 20 additions and 28 deletions

View File

@ -30,7 +30,7 @@ matrix:
script: ./vendor/bin/roave-backward-compatibility-check || true script: ./vendor/bin/roave-backward-compatibility-check || true
- name: PHPStan - name: PHPStan
php: 7.2 php: 7.2
env: DEPENDENCIES="phpstan/phpstan phpstan/phpstan-webmozart-assert" env: DEPENDENCIES="phpstan/phpstan"
script: ./vendor/bin/phpstan analyse src script: ./vendor/bin/phpstan analyse src
before_install: before_install:

View File

@ -1,5 +1,3 @@
parameters: parameters:
level: 5 level: 5
includes:
- vendor/phpstan/phpstan-webmozart-assert/extension.neon

View File

@ -70,7 +70,7 @@ class EmailValidation extends HttpApi
* This operation is only accessible with the private API key and not subject to the daily usage limits. * This operation is only accessible with the private API key and not subject to the daily usage limits.
* *
* @param string $addresses A delimiter separated list of addresses. Maximum: 8000 characters. * @param string $addresses A delimiter separated list of addresses. Maximum: 8000 characters.
* @param bool| $syntaxOnly Perform only syntax checks or DNS and ESP specific validation as well. * @param bool $syntaxOnly Perform only syntax checks or DNS and ESP specific validation as well.
* The default is True. * The default is True.
* *
* @throws InvalidArgumentException Thrown when local validation returns an error * @throws InvalidArgumentException Thrown when local validation returns an error

View File

@ -1,5 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* Copyright (C) 2013 Mailgun * Copyright (C) 2013 Mailgun
* *
@ -29,17 +31,11 @@ final class Parts
*/ */
private $localPart; private $localPart;
/**
*
*/
private function __construct() private function __construct()
{ {
} }
/** /**
* @param array $data
*
* @return Parts * @return Parts
*/ */
public static function create(array $data) public static function create(array $data)
@ -52,25 +48,16 @@ final class Parts
return $model; return $model;
} }
/**
* @return null|string
*/
public function getDisplayName(): ?string public function getDisplayName(): ?string
{ {
return $this->displayName; return $this->displayName;
} }
/**
* @return null|string
*/
public function getDomain(): ?string public function getDomain(): ?string
{ {
return $this->domain; return $this->domain;
} }
/**
* @return null|string
*/
public function getLocalPart(): ?string public function getLocalPart(): ?string
{ {
return $this->localPart; return $this->localPart;

View File

@ -12,7 +12,6 @@ declare(strict_types=1);
namespace Mailgun\Model\EmailValidation; namespace Mailgun\Model\EmailValidation;
use Mailgun\Model\ApiResponse; use Mailgun\Model\ApiResponse;
use Mailgun\Model\EmailValidation\EmailValidation;
/** /**
* @author David Garcia <me@davidgarcia.cat> * @author David Garcia <me@davidgarcia.cat>

View File

@ -2,10 +2,16 @@
declare(strict_types=1); declare(strict_types=1);
/*
* Copyright (C) 2013 Mailgun
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
namespace Mailgun\Tests\Model\EmailValidation; namespace Mailgun\Tests\Model\EmailValidation;
use Mailgun\Model\EmailValidation\ParseResponse; use Mailgun\Model\EmailValidation\ParseResponse;
use Mailgun\Model\EmailValidation\ValidateResponse;
use Mailgun\Tests\Model\BaseModelTest; use Mailgun\Tests\Model\BaseModelTest;
class ParseResponseTest extends BaseModelTest class ParseResponseTest extends BaseModelTest
@ -31,7 +37,6 @@ JSON;
public function testParseConstructorWithValidData() public function testParseConstructorWithValidData()
{ {
$data = [ $data = [
'parsed' => ['parsed data'], 'parsed' => ['parsed data'],
'unparseable' => ['unparseable data'], 'unparseable' => ['unparseable data'],
@ -45,7 +50,6 @@ JSON;
public function testParseConstructorWithInvalidData() public function testParseConstructorWithInvalidData()
{ {
$data = [ $data = [
'parsed' => null, 'parsed' => null,
'unparseable' => null, 'unparseable' => null,
@ -56,5 +60,4 @@ JSON;
$this->assertEquals([], $parts->getParsed()); $this->assertEquals([], $parts->getParsed());
$this->assertEquals([], $parts->getUnparseable()); $this->assertEquals([], $parts->getUnparseable());
} }
} }

View File

@ -1,5 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* Copyright (C) 2013 Mailgun * Copyright (C) 2013 Mailgun
* *
@ -16,7 +18,6 @@ class PartsTest extends BaseModelTest
{ {
public function testPartsConstructor() public function testPartsConstructor()
{ {
$data = [ $data = [
'display_name' => ' Display name', 'display_name' => ' Display name',
'domain' => 'Domain', 'domain' => 'Domain',

View File

@ -2,6 +2,13 @@
declare(strict_types=1); declare(strict_types=1);
/*
* Copyright (C) 2013 Mailgun
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
namespace Mailgun\Tests\Model\EmailValidation; namespace Mailgun\Tests\Model\EmailValidation;
use Mailgun\Model\EmailValidation\Parts; use Mailgun\Model\EmailValidation\Parts;
@ -30,7 +37,6 @@ class ValidateResponseTest extends BaseModelTest
JSON; JSON;
$model = ValidateResponse::create(json_decode($json, true)); $model = ValidateResponse::create(json_decode($json, true));
$this->assertTrue($model->isMailboxVerification()); $this->assertTrue($model->isMailboxVerification());
} }
public function testCreateWithoutMailboxVerification() public function testCreateWithoutMailboxVerification()
@ -54,12 +60,10 @@ JSON;
JSON; JSON;
$model = ValidateResponse::create(json_decode($json, true)); $model = ValidateResponse::create(json_decode($json, true));
$this->assertFalse($model->isMailboxVerification()); $this->assertFalse($model->isMailboxVerification());
} }
public function testEmailValidation() public function testEmailValidation()
{ {
$data = [ $data = [
'address' => 'foo@mailgun.net', 'address' => 'foo@mailgun.net',
'did_you_mean' => null, 'did_you_mean' => null,