mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-21 20:16:03 +03:00
Added proper PHP CS fixer rules (#527)
* Added proper PHP CS fixer rules * Adding Symfony cs rules * Updated CS on tests
This commit is contained in:
parent
6aecbd5be4
commit
519fd7a674
37
.php_cs
37
.php_cs
@ -1,13 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* In order to make it work, fabpot/php-cs-fixer and sllh/php-cs-fixer-styleci-bridge must be installed globally
|
||||
* with composer.
|
||||
*
|
||||
* @link https://github.com/Soullivaneuh/php-cs-fixer-styleci-bridge
|
||||
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer
|
||||
*/
|
||||
$header = <<<TXT
|
||||
Copyright (C) 2013 Mailgun
|
||||
|
||||
use SLLH\StyleCIBridge\ConfigBridge;
|
||||
This software may be modified and distributed under the terms
|
||||
of the MIT license. See the LICENSE file for details.
|
||||
TXT;
|
||||
|
||||
return ConfigBridge::create();
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->in('src')
|
||||
->in('tests');
|
||||
|
||||
return PhpCsFixer\Config::create()
|
||||
->setRiskyAllowed(true)
|
||||
->setRules([
|
||||
'@PSR2' => true,
|
||||
'@Symfony' => true,
|
||||
'strict_param' => true,
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'declare_strict_types' => false, // true
|
||||
'no_empty_phpdoc' => true,
|
||||
'no_superfluous_phpdoc_tags' => false, // true
|
||||
'header_comment' => [
|
||||
'commentType' => 'comment',
|
||||
'header' => $header,
|
||||
'location' => 'after_declare_strict',
|
||||
'separate' => 'both',
|
||||
],
|
||||
])
|
||||
->setFinder($finder)
|
||||
;
|
||||
|
@ -56,7 +56,7 @@ class Domain extends HttpApi
|
||||
/**
|
||||
* Returns a single domain.
|
||||
*
|
||||
* @param string $domain Name of the domain.
|
||||
* @param string $domain name of the domain
|
||||
*
|
||||
* @return ShowResponse|array|ResponseInterface
|
||||
*/
|
||||
@ -76,10 +76,10 @@ class Domain extends HttpApi
|
||||
*
|
||||
* @see https://documentation.mailgun.com/en/latest/api-domains.html#domains
|
||||
*
|
||||
* @param string $domain Name of the domain.
|
||||
* @param string $smtpPass Password for SMTP authentication.
|
||||
* @param string $spamAction `disable` or `tag` - inbound spam filtering.
|
||||
* @param bool $wildcard Domain will accept email for subdomains.
|
||||
* @param string $domain name of the domain
|
||||
* @param string $smtpPass password for SMTP authentication
|
||||
* @param string $spamAction `disable` or `tag` - inbound spam filtering
|
||||
* @param bool $wildcard domain will accept email for subdomains
|
||||
*
|
||||
* @return CreateResponse|array|ResponseInterface
|
||||
*/
|
||||
@ -108,7 +108,7 @@ class Domain extends HttpApi
|
||||
* Removes a domain from the account.
|
||||
* WARNING: This action is irreversible! Be cautious!
|
||||
*
|
||||
* @param string $domain Name of the domain.
|
||||
* @param string $domain name of the domain
|
||||
*
|
||||
* @return DeleteResponse|array|ResponseInterface
|
||||
*/
|
||||
@ -124,7 +124,7 @@ class Domain extends HttpApi
|
||||
/**
|
||||
* Returns a list of SMTP credentials for the specified domain.
|
||||
*
|
||||
* @param string $domain Name of the domain.
|
||||
* @param string $domain name of the domain
|
||||
* @param int $limit Number of credentials to return
|
||||
* @param int $skip Number of credentials to omit from the list
|
||||
*
|
||||
@ -149,8 +149,8 @@ class Domain extends HttpApi
|
||||
/**
|
||||
* Create a new SMTP credential pair for the specified domain.
|
||||
*
|
||||
* @param string $domain Name of the domain.
|
||||
* @param string $login SMTP Username.
|
||||
* @param string $domain name of the domain
|
||||
* @param string $login SMTP Username
|
||||
* @param string $password SMTP Password. Length min 5, max 32.
|
||||
*
|
||||
* @return CreateCredentialResponse|array|ResponseInterface
|
||||
@ -175,8 +175,8 @@ class Domain extends HttpApi
|
||||
/**
|
||||
* Update a set of SMTP credentials for the specified domain.
|
||||
*
|
||||
* @param string $domain Name of the domain.
|
||||
* @param string $login SMTP Username.
|
||||
* @param string $domain name of the domain
|
||||
* @param string $login SMTP Username
|
||||
* @param string $pass New SMTP Password. Length min 5, max 32.
|
||||
*
|
||||
* @return UpdateCredentialResponse|array|ResponseInterface
|
||||
@ -200,8 +200,8 @@ class Domain extends HttpApi
|
||||
/**
|
||||
* Remove a set of SMTP credentials from the specified domain.
|
||||
*
|
||||
* @param string $domain Name of the domain.
|
||||
* @param string $login SMTP Username.
|
||||
* @param string $domain name of the domain
|
||||
* @param string $login SMTP Username
|
||||
*
|
||||
* @return DeleteCredentialResponse|array|ResponseInterface
|
||||
*/
|
||||
@ -224,7 +224,7 @@ class Domain extends HttpApi
|
||||
/**
|
||||
* Returns delivery connection settings for the specified domain.
|
||||
*
|
||||
* @param string $domain Name of the domain.
|
||||
* @param string $domain name of the domain
|
||||
*
|
||||
* @return ConnectionResponse|ResponseInterface
|
||||
*/
|
||||
@ -241,9 +241,9 @@ class Domain extends HttpApi
|
||||
* Updates the specified delivery connection settings for the specified domain.
|
||||
* If a parameter is passed in as null, it will not be updated.
|
||||
*
|
||||
* @param string $domain Name of the domain.
|
||||
* @param bool|null $requireTLS Enforces that messages are sent only over a TLS connection.
|
||||
* @param bool|null $noVerify Disables TLS certificate and hostname verification.
|
||||
* @param string $domain name of the domain
|
||||
* @param bool|null $requireTLS enforces that messages are sent only over a TLS connection
|
||||
* @param bool|null $noVerify disables TLS certificate and hostname verification
|
||||
*
|
||||
* @return UpdateConnectionResponse|array|ResponseInterface
|
||||
*/
|
||||
@ -271,7 +271,7 @@ class Domain extends HttpApi
|
||||
/**
|
||||
* Returns a single domain.
|
||||
*
|
||||
* @param string $domain Name of the domain.
|
||||
* @param string $domain name of the domain
|
||||
*
|
||||
* @return VerifyResponse|array|ResponseInterface
|
||||
*/
|
||||
|
@ -122,7 +122,8 @@ class Member extends HttpApi
|
||||
|
||||
// workaround for webmozart/asserts <= 1.2
|
||||
if (count($members) > 1000) {
|
||||
throw new InvalidArgumentException(sprintf('Expected an Array to contain at most %2$d elements. Got: %d',
|
||||
throw new InvalidArgumentException(sprintf(
|
||||
'Expected an Array to contain at most %2$d elements. Got: %d',
|
||||
1000,
|
||||
count($members)
|
||||
));
|
||||
|
@ -78,7 +78,7 @@ class BatchMessage extends MessageBuilder
|
||||
protected function addRecipient($headerName, $address, array $variables)
|
||||
{
|
||||
if (array_key_exists($headerName, $this->counters['recipients'])) {
|
||||
if ($this->counters['recipients'][$headerName] === self::RECIPIENT_COUNT_LIMIT) {
|
||||
if (self::RECIPIENT_COUNT_LIMIT === $this->counters['recipients'][$headerName]) {
|
||||
if (false === $this->autoSend) {
|
||||
throw TooManyRecipients::whenAutoSendDisabled();
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ class MessageBuilder
|
||||
$this->message[$headerName] = [$compiledAddress];
|
||||
}
|
||||
if (array_key_exists($headerName, $this->counters['recipients'])) {
|
||||
$this->counters['recipients'][$headerName] += 1;
|
||||
++$this->counters['recipients'][$headerName];
|
||||
}
|
||||
|
||||
return $this;
|
||||
@ -383,7 +383,7 @@ class MessageBuilder
|
||||
} else {
|
||||
$this->message['o:campaign'] = [(string) $campaignId];
|
||||
}
|
||||
$this->counters['attributes']['campaign_id'] += 1;
|
||||
++$this->counters['attributes']['campaign_id'];
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -406,7 +406,7 @@ class MessageBuilder
|
||||
} else {
|
||||
$this->message['o:tag'] = [$tag];
|
||||
}
|
||||
$this->counters['attributes']['tag'] += 1;
|
||||
++$this->counters['attributes']['tag'];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ final class DnsRecord
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $name Name of the record, as used in CNAME, etc.
|
||||
* @param string|null $name name of the record, as used in CNAME, etc
|
||||
* @param string $type DNS record type
|
||||
* @param string $value DNS record value
|
||||
* @param string|null $priority Record priority, used for MX
|
||||
|
@ -243,7 +243,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* @param mixed|callable $property Example $this->requestMethod
|
||||
* @param mixed $value The actual value from the user.
|
||||
* @param mixed $value the actual value from the user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
namespace Mailgun\Tests\Model\Domain;
|
||||
|
||||
use Mailgun\Model\Domain\Domain;
|
||||
use Mailgun\Model\Domain\UpdateConnectionResponse;
|
||||
use Mailgun\Tests\Model\BaseModelTest;
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
namespace Mailgun\Tests\Model\Domain;
|
||||
|
||||
use Mailgun\Model\Domain\Domain;
|
||||
use Mailgun\Model\Domain\VerifyResponse;
|
||||
use Mailgun\Tests\Model\BaseModelTest;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user