Skip to content
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

Run new phpstorm inspections #18

Merged
merged 20 commits into from
Apr 17, 2019
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
5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

186 changes: 186 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/irc-messages.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
}
},
"require-dev": {
"phpunit/phpunit": "^7"
"phpunit/phpunit": "^7",
"squizlabs/php_codesniffer": "^3.0"
}
}
53 changes: 52 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 13 additions & 6 deletions src/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
* See the LICENSE file for more information.
*/

declare(strict_types=1);

namespace WildPHP\Messages;

use InvalidArgumentException;
use WildPHP\Messages\Generics\BaseIRCMessageImplementation;
use WildPHP\Messages\Generics\Prefix;
use WildPHP\Messages\Interfaces\IncomingMessageInterface;
Expand Down Expand Up @@ -36,7 +39,7 @@ class Account extends BaseIRCMessageImplementation implements IncomingMessageInt
*
* @param string $accountName
*/
function __construct(string $accountName)
public function __construct(string $accountName)
{
$this->setAccountName($accountName);
}
Expand All @@ -45,15 +48,19 @@ function __construct(string $accountName)
* @param IrcMessageInterface $incomingMessage
*
* @return self
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
*/
public static function fromIncomingMessage(IrcMessageInterface $incomingMessage): self
{
if ($incomingMessage->getVerb() != self::getVerb()) {
throw new \InvalidArgumentException('Expected incoming ' . self::getVerb() . '; got ' . $incomingMessage->getVerb());
if ($incomingMessage->getVerb() !== self::getVerb()) {
throw new InvalidArgumentException(sprintf(
'Expected incoming %s; got %s',
self::getVerb(),
$incomingMessage->getVerb()
));
}

$accountName = $incomingMessage->getArgs()[0];
[$accountName] = $incomingMessage->getArgs();
$prefix = Prefix::fromIncomingMessage($incomingMessage);

$object = new self($accountName);
Expand All @@ -78,4 +85,4 @@ public function setAccountName(string $accountName)
{
$this->accountName = $accountName;
}
}
}
Loading