-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Symfony; | ||
|
||
use function count; | ||
|
||
final class Message | ||
{ | ||
/** @var string */ | ||
private $class; | ||
|
||
/** @var array */ | ||
private $returnTypes; | ||
|
||
public function __construct(string $class, array $returnTypes) | ||
{ | ||
$this->class = $class; | ||
$this->returnTypes = $returnTypes; | ||
} | ||
|
||
public function getClass(): string | ||
{ | ||
return $this->class; | ||
} | ||
|
||
public function getReturnTypes(): array | ||
{ | ||
return $this->returnTypes; | ||
} | ||
|
||
public function countReturnTypes(): int | ||
{ | ||
return count($this->returnTypes); | ||
} | ||
|
||
/** @var string */ | ||
private $class; | ||
|
||
/** @var array */ | ||
private $returnTypes; | ||
Check failure on line 14 in src/Symfony/Message.php GitHub Actions / PHPStan (8.0, lowest)
Check failure on line 14 in src/Symfony/Message.php GitHub Actions / PHPStan (8.2, lowest)
Check failure on line 14 in src/Symfony/Message.php GitHub Actions / PHPStan (7.3, highest)
Check failure on line 14 in src/Symfony/Message.php GitHub Actions / PHPStan (7.3, lowest)
Check failure on line 14 in src/Symfony/Message.php GitHub Actions / PHPStan (7.2, highest)
Check failure on line 14 in src/Symfony/Message.php GitHub Actions / PHPStan (8.1, highest)
Check failure on line 14 in src/Symfony/Message.php GitHub Actions / PHPStan (8.2, highest)
Check failure on line 14 in src/Symfony/Message.php GitHub Actions / PHPStan (8.0, highest)
Check failure on line 14 in src/Symfony/Message.php GitHub Actions / PHPStan (7.4, lowest)
Check failure on line 14 in src/Symfony/Message.php GitHub Actions / PHPStan (7.2, lowest)
Check failure on line 14 in src/Symfony/Message.php GitHub Actions / PHPStan (8.1, lowest)
|
||
|
||
public function __construct(string $class, array $returnTypes) | ||
Check failure on line 16 in src/Symfony/Message.php GitHub Actions / PHPStan (8.0, lowest)
Check failure on line 16 in src/Symfony/Message.php GitHub Actions / PHPStan (8.2, lowest)
Check failure on line 16 in src/Symfony/Message.php GitHub Actions / PHPStan (7.3, highest)
Check failure on line 16 in src/Symfony/Message.php GitHub Actions / PHPStan (7.3, lowest)
Check failure on line 16 in src/Symfony/Message.php GitHub Actions / PHPStan (7.2, highest)
Check failure on line 16 in src/Symfony/Message.php GitHub Actions / PHPStan (8.1, highest)
Check failure on line 16 in src/Symfony/Message.php GitHub Actions / PHPStan (8.2, highest)
Check failure on line 16 in src/Symfony/Message.php GitHub Actions / PHPStan (8.0, highest)
Check failure on line 16 in src/Symfony/Message.php GitHub Actions / PHPStan (7.4, lowest)
Check failure on line 16 in src/Symfony/Message.php GitHub Actions / PHPStan (7.2, lowest)
Check failure on line 16 in src/Symfony/Message.php GitHub Actions / PHPStan (8.1, lowest)
|
||
{ | ||
$this->class = $class; | ||
$this->returnTypes = $returnTypes; | ||
} | ||
|
||
public function getClass(): string | ||
{ | ||
return $this->class; | ||
} | ||
|
||
public function getReturnTypes(): array | ||
Check failure on line 27 in src/Symfony/Message.php GitHub Actions / PHPStan (8.0, lowest)
Check failure on line 27 in src/Symfony/Message.php GitHub Actions / PHPStan (8.2, lowest)
Check failure on line 27 in src/Symfony/Message.php GitHub Actions / PHPStan (7.3, highest)
Check failure on line 27 in src/Symfony/Message.php GitHub Actions / PHPStan (7.3, lowest)
Check failure on line 27 in src/Symfony/Message.php GitHub Actions / PHPStan (7.2, highest)
Check failure on line 27 in src/Symfony/Message.php GitHub Actions / PHPStan (8.1, highest)
Check failure on line 27 in src/Symfony/Message.php GitHub Actions / PHPStan (8.2, highest)
Check failure on line 27 in src/Symfony/Message.php GitHub Actions / PHPStan (8.0, highest)
Check failure on line 27 in src/Symfony/Message.php GitHub Actions / PHPStan (7.4, lowest)
Check failure on line 27 in src/Symfony/Message.php GitHub Actions / PHPStan (7.2, lowest)
Check failure on line 27 in src/Symfony/Message.php GitHub Actions / PHPStan (8.1, lowest)
|
||
{ | ||
return $this->returnTypes; | ||
} | ||
|
||
public function countReturnTypes(): int | ||
{ | ||
return count($this->returnTypes); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Symfony; | ||
|
||
use function array_key_exists; | ||
|
||
final class MessageMap | ||
{ | ||
/** @var Message[] */ | ||
private $messages = []; | ||
|
||
/** | ||
* @param Message[] $messages | ||
*/ | ||
public function __construct(array $messages) | ||
{ | ||
foreach ($messages as $message) { | ||
$this->messages[$message->getClass()] = $message; | ||
} | ||
} | ||
|
||
public function getMessageForClass(string $class): ?Message | ||
{ | ||
return $this->messages[$class] ?? null; | ||
} | ||
|
||
public function hasMessageForClass(string $class): bool | ||
{ | ||
return array_key_exists($class, $this->messages); | ||
} | ||
|
||
/** @var Message[] */ | ||
private $messages = []; | ||
|
||
/** | ||
* @param Message[] $messages | ||
*/ | ||
public function __construct(array $messages) | ||
{ | ||
foreach ($messages as $message) { | ||
$this->messages[$message->getClass()] = $message; | ||
} | ||
} | ||
|
||
public function getMessageForClass(string $class): ?Message | ||
{ | ||
return $this->messages[$class] ?? null; | ||
} | ||
|
||
public function hasMessageForClass(string $class): bool | ||
{ | ||
return array_key_exists($class, $this->messages); | ||
} | ||
|
||
} |