@@ -16,16 +16,16 @@ |
||
16 | 16 | use ReflectionMethod; |
17 | 17 | |
18 | 18 | if (!class_exists(AbstractReflectionMacro::class, false)) { |
19 | - abstract class AbstractReflectionMacro extends AbstractMacro |
|
20 | - { |
|
21 | - /** |
|
22 | - * {@inheritdoc} |
|
23 | - */ |
|
24 | - public function getReflection(): ?ReflectionMethod |
|
25 | - { |
|
26 | - return $this->reflectionFunction instanceof ReflectionMethod |
|
27 | - ? $this->reflectionFunction |
|
28 | - : null; |
|
29 | - } |
|
30 | - } |
|
19 | + abstract class AbstractReflectionMacro extends AbstractMacro |
|
20 | + { |
|
21 | + /** |
|
22 | + * {@inheritdoc} |
|
23 | + */ |
|
24 | + public function getReflection(): ?ReflectionMethod |
|
25 | + { |
|
26 | + return $this->reflectionFunction instanceof ReflectionMethod |
|
27 | + ? $this->reflectionFunction |
|
28 | + : null; |
|
29 | + } |
|
30 | + } |
|
31 | 31 | } |
@@ -14,36 +14,36 @@ |
||
14 | 14 | namespace Carbon\PHPStan; |
15 | 15 | |
16 | 16 | if (!class_exists(LazyMacro::class, false)) { |
17 | - abstract class LazyMacro extends AbstractReflectionMacro |
|
18 | - { |
|
19 | - /** |
|
20 | - * {@inheritdoc} |
|
21 | - * |
|
22 | - * @return string|false |
|
23 | - */ |
|
24 | - public function getFileName() |
|
25 | - { |
|
26 | - return $this->reflectionFunction->getFileName(); |
|
27 | - } |
|
17 | + abstract class LazyMacro extends AbstractReflectionMacro |
|
18 | + { |
|
19 | + /** |
|
20 | + * {@inheritdoc} |
|
21 | + * |
|
22 | + * @return string|false |
|
23 | + */ |
|
24 | + public function getFileName() |
|
25 | + { |
|
26 | + return $this->reflectionFunction->getFileName(); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * {@inheritdoc} |
|
31 | - * |
|
32 | - * @return int|false |
|
33 | - */ |
|
34 | - public function getStartLine() |
|
35 | - { |
|
36 | - return $this->reflectionFunction->getStartLine(); |
|
37 | - } |
|
29 | + /** |
|
30 | + * {@inheritdoc} |
|
31 | + * |
|
32 | + * @return int|false |
|
33 | + */ |
|
34 | + public function getStartLine() |
|
35 | + { |
|
36 | + return $this->reflectionFunction->getStartLine(); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * {@inheritdoc} |
|
41 | - * |
|
42 | - * @return int|false |
|
43 | - */ |
|
44 | - public function getEndLine() |
|
45 | - { |
|
46 | - return $this->reflectionFunction->getEndLine(); |
|
47 | - } |
|
48 | - } |
|
39 | + /** |
|
40 | + * {@inheritdoc} |
|
41 | + * |
|
42 | + * @return int|false |
|
43 | + */ |
|
44 | + public function getEndLine() |
|
45 | + { |
|
46 | + return $this->reflectionFunction->getEndLine(); |
|
47 | + } |
|
48 | + } |
|
49 | 49 | } |
@@ -14,30 +14,30 @@ |
||
14 | 14 | namespace Carbon\PHPStan; |
15 | 15 | |
16 | 16 | if (!class_exists(LazyMacro::class, false)) { |
17 | - abstract class LazyMacro extends AbstractReflectionMacro |
|
18 | - { |
|
19 | - /** |
|
20 | - * {@inheritdoc} |
|
21 | - */ |
|
22 | - public function getFileName(): ?string |
|
23 | - { |
|
24 | - return $this->reflectionFunction->getFileName(); |
|
25 | - } |
|
17 | + abstract class LazyMacro extends AbstractReflectionMacro |
|
18 | + { |
|
19 | + /** |
|
20 | + * {@inheritdoc} |
|
21 | + */ |
|
22 | + public function getFileName(): ?string |
|
23 | + { |
|
24 | + return $this->reflectionFunction->getFileName(); |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * {@inheritdoc} |
|
29 | - */ |
|
30 | - public function getStartLine(): ?int |
|
31 | - { |
|
32 | - return $this->reflectionFunction->getStartLine(); |
|
33 | - } |
|
27 | + /** |
|
28 | + * {@inheritdoc} |
|
29 | + */ |
|
30 | + public function getStartLine(): ?int |
|
31 | + { |
|
32 | + return $this->reflectionFunction->getStartLine(); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * {@inheritdoc} |
|
37 | - */ |
|
38 | - public function getEndLine(): ?int |
|
39 | - { |
|
40 | - return $this->reflectionFunction->getEndLine(); |
|
41 | - } |
|
42 | - } |
|
35 | + /** |
|
36 | + * {@inheritdoc} |
|
37 | + */ |
|
38 | + public function getEndLine(): ?int |
|
39 | + { |
|
40 | + return $this->reflectionFunction->getEndLine(); |
|
41 | + } |
|
42 | + } |
|
43 | 43 | } |
@@ -17,25 +17,25 @@ |
||
17 | 17 | use ReflectionMethod; |
18 | 18 | |
19 | 19 | if (!class_exists(AbstractReflectionMacro::class, false)) { |
20 | - abstract class AbstractReflectionMacro extends AbstractMacro |
|
21 | - { |
|
22 | - /** |
|
23 | - * {@inheritdoc} |
|
24 | - */ |
|
25 | - public function getReflection(): ?Reflection\Adapter\ReflectionMethod |
|
26 | - { |
|
27 | - if ($this->reflectionFunction instanceof Reflection\Adapter\ReflectionMethod) { |
|
28 | - return $this->reflectionFunction; |
|
29 | - } |
|
20 | + abstract class AbstractReflectionMacro extends AbstractMacro |
|
21 | + { |
|
22 | + /** |
|
23 | + * {@inheritdoc} |
|
24 | + */ |
|
25 | + public function getReflection(): ?Reflection\Adapter\ReflectionMethod |
|
26 | + { |
|
27 | + if ($this->reflectionFunction instanceof Reflection\Adapter\ReflectionMethod) { |
|
28 | + return $this->reflectionFunction; |
|
29 | + } |
|
30 | 30 | |
31 | - return $this->reflectionFunction instanceof ReflectionMethod |
|
32 | - ? new Reflection\Adapter\ReflectionMethod( |
|
33 | - Reflection\ReflectionMethod::createFromName( |
|
34 | - $this->reflectionFunction->getDeclaringClass()->getName(), |
|
35 | - $this->reflectionFunction->getName() |
|
36 | - ) |
|
37 | - ) |
|
38 | - : null; |
|
39 | - } |
|
40 | - } |
|
31 | + return $this->reflectionFunction instanceof ReflectionMethod |
|
32 | + ? new Reflection\Adapter\ReflectionMethod( |
|
33 | + Reflection\ReflectionMethod::createFromName( |
|
34 | + $this->reflectionFunction->getDeclaringClass()->getName(), |
|
35 | + $this->reflectionFunction->getName() |
|
36 | + ) |
|
37 | + ) |
|
38 | + : null; |
|
39 | + } |
|
40 | + } |
|
41 | 41 | } |
@@ -14,39 +14,39 @@ |
||
14 | 14 | use Symfony\Component\Translation\MessageCatalogueInterface; |
15 | 15 | |
16 | 16 | if (!class_exists(LazyTranslator::class, false)) { |
17 | - class LazyTranslator extends AbstractTranslator implements TranslatorStrongTypeInterface |
|
18 | - { |
|
19 | - public function trans(?string $id, array $parameters = [], ?string $domain = null, ?string $locale = null): string |
|
20 | - { |
|
21 | - return $this->translate($id, $parameters, $domain, $locale); |
|
22 | - } |
|
23 | - |
|
24 | - public function getFromCatalogue(MessageCatalogueInterface $catalogue, string $id, string $domain = 'messages') |
|
25 | - { |
|
26 | - $messages = $this->getPrivateProperty($catalogue, 'messages'); |
|
27 | - |
|
28 | - if (isset($messages[$domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX][$id])) { |
|
29 | - return $messages[$domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX][$id]; |
|
30 | - } |
|
31 | - |
|
32 | - if (isset($messages[$domain][$id])) { |
|
33 | - return $messages[$domain][$id]; |
|
34 | - } |
|
35 | - |
|
36 | - $fallbackCatalogue = $this->getPrivateProperty($catalogue, 'fallbackCatalogue'); |
|
37 | - |
|
38 | - if ($fallbackCatalogue !== null) { |
|
39 | - return $this->getFromCatalogue($fallbackCatalogue, $id, $domain); |
|
40 | - } |
|
41 | - |
|
42 | - return $id; |
|
43 | - } |
|
44 | - |
|
45 | - private function getPrivateProperty($instance, string $field) |
|
46 | - { |
|
47 | - return (function (string $field) { |
|
48 | - return $this->$field; |
|
49 | - })->call($instance, $field); |
|
50 | - } |
|
51 | - } |
|
17 | + class LazyTranslator extends AbstractTranslator implements TranslatorStrongTypeInterface |
|
18 | + { |
|
19 | + public function trans(?string $id, array $parameters = [], ?string $domain = null, ?string $locale = null): string |
|
20 | + { |
|
21 | + return $this->translate($id, $parameters, $domain, $locale); |
|
22 | + } |
|
23 | + |
|
24 | + public function getFromCatalogue(MessageCatalogueInterface $catalogue, string $id, string $domain = 'messages') |
|
25 | + { |
|
26 | + $messages = $this->getPrivateProperty($catalogue, 'messages'); |
|
27 | + |
|
28 | + if (isset($messages[$domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX][$id])) { |
|
29 | + return $messages[$domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX][$id]; |
|
30 | + } |
|
31 | + |
|
32 | + if (isset($messages[$domain][$id])) { |
|
33 | + return $messages[$domain][$id]; |
|
34 | + } |
|
35 | + |
|
36 | + $fallbackCatalogue = $this->getPrivateProperty($catalogue, 'fallbackCatalogue'); |
|
37 | + |
|
38 | + if ($fallbackCatalogue !== null) { |
|
39 | + return $this->getFromCatalogue($fallbackCatalogue, $id, $domain); |
|
40 | + } |
|
41 | + |
|
42 | + return $id; |
|
43 | + } |
|
44 | + |
|
45 | + private function getPrivateProperty($instance, string $field) |
|
46 | + { |
|
47 | + return (function (string $field) { |
|
48 | + return $this->$field; |
|
49 | + })->call($instance, $field); |
|
50 | + } |
|
51 | + } |
|
52 | 52 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | |
45 | 45 | private function getPrivateProperty($instance, string $field) |
46 | 46 | { |
47 | - return (function (string $field) { |
|
47 | + return (function(string $field) { |
|
48 | 48 | return $this->$field; |
49 | 49 | })->call($instance, $field); |
50 | 50 | } |
@@ -15,5 +15,5 @@ |
||
15 | 15 | |
16 | 16 | interface CarbonConverterInterface |
17 | 17 | { |
18 | - public function convertDate(DateTimeInterface $dateTime, bool $negated = false): CarbonInterface; |
|
18 | + public function convertDate(DateTimeInterface $dateTime, bool $negated = false): CarbonInterface; |
|
19 | 19 | } |
@@ -17,83 +17,83 @@ |
||
17 | 17 | |
18 | 18 | class TranslatorImmutable extends Translator |
19 | 19 | { |
20 | - /** @var bool */ |
|
21 | - private $constructed = false; |
|
22 | - |
|
23 | - public function __construct($locale, MessageFormatterInterface $formatter = null, $cacheDir = null, $debug = false) |
|
24 | - { |
|
25 | - parent::__construct($locale, $formatter, $cacheDir, $debug); |
|
26 | - $this->constructed = true; |
|
27 | - } |
|
28 | - |
|
29 | - /** |
|
30 | - * @codeCoverageIgnore |
|
31 | - */ |
|
32 | - public function setDirectories(array $directories) |
|
33 | - { |
|
34 | - $this->disallowMutation(__METHOD__); |
|
35 | - |
|
36 | - return parent::setDirectories($directories); |
|
37 | - } |
|
38 | - |
|
39 | - public function setLocale($locale) |
|
40 | - { |
|
41 | - $this->disallowMutation(__METHOD__); |
|
42 | - |
|
43 | - return parent::setLocale($locale); |
|
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * @codeCoverageIgnore |
|
48 | - */ |
|
49 | - public function setMessages($locale, $messages) |
|
50 | - { |
|
51 | - $this->disallowMutation(__METHOD__); |
|
52 | - |
|
53 | - return parent::setMessages($locale, $messages); |
|
54 | - } |
|
55 | - |
|
56 | - /** |
|
57 | - * @codeCoverageIgnore |
|
58 | - */ |
|
59 | - public function setTranslations($messages) |
|
60 | - { |
|
61 | - $this->disallowMutation(__METHOD__); |
|
62 | - |
|
63 | - return parent::setTranslations($messages); |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * @codeCoverageIgnore |
|
68 | - */ |
|
69 | - public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory) |
|
70 | - { |
|
71 | - $this->disallowMutation(__METHOD__); |
|
72 | - |
|
73 | - parent::setConfigCacheFactory($configCacheFactory); |
|
74 | - } |
|
75 | - |
|
76 | - public function resetMessages($locale = null) |
|
77 | - { |
|
78 | - $this->disallowMutation(__METHOD__); |
|
79 | - |
|
80 | - return parent::resetMessages($locale); |
|
81 | - } |
|
82 | - |
|
83 | - /** |
|
84 | - * @codeCoverageIgnore |
|
85 | - */ |
|
86 | - public function setFallbackLocales(array $locales) |
|
87 | - { |
|
88 | - $this->disallowMutation(__METHOD__); |
|
89 | - |
|
90 | - parent::setFallbackLocales($locales); |
|
91 | - } |
|
92 | - |
|
93 | - private function disallowMutation($method) |
|
94 | - { |
|
95 | - if ($this->constructed) { |
|
96 | - throw new ImmutableException($method.' not allowed on '.static::class); |
|
97 | - } |
|
98 | - } |
|
20 | + /** @var bool */ |
|
21 | + private $constructed = false; |
|
22 | + |
|
23 | + public function __construct($locale, MessageFormatterInterface $formatter = null, $cacheDir = null, $debug = false) |
|
24 | + { |
|
25 | + parent::__construct($locale, $formatter, $cacheDir, $debug); |
|
26 | + $this->constructed = true; |
|
27 | + } |
|
28 | + |
|
29 | + /** |
|
30 | + * @codeCoverageIgnore |
|
31 | + */ |
|
32 | + public function setDirectories(array $directories) |
|
33 | + { |
|
34 | + $this->disallowMutation(__METHOD__); |
|
35 | + |
|
36 | + return parent::setDirectories($directories); |
|
37 | + } |
|
38 | + |
|
39 | + public function setLocale($locale) |
|
40 | + { |
|
41 | + $this->disallowMutation(__METHOD__); |
|
42 | + |
|
43 | + return parent::setLocale($locale); |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * @codeCoverageIgnore |
|
48 | + */ |
|
49 | + public function setMessages($locale, $messages) |
|
50 | + { |
|
51 | + $this->disallowMutation(__METHOD__); |
|
52 | + |
|
53 | + return parent::setMessages($locale, $messages); |
|
54 | + } |
|
55 | + |
|
56 | + /** |
|
57 | + * @codeCoverageIgnore |
|
58 | + */ |
|
59 | + public function setTranslations($messages) |
|
60 | + { |
|
61 | + $this->disallowMutation(__METHOD__); |
|
62 | + |
|
63 | + return parent::setTranslations($messages); |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * @codeCoverageIgnore |
|
68 | + */ |
|
69 | + public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory) |
|
70 | + { |
|
71 | + $this->disallowMutation(__METHOD__); |
|
72 | + |
|
73 | + parent::setConfigCacheFactory($configCacheFactory); |
|
74 | + } |
|
75 | + |
|
76 | + public function resetMessages($locale = null) |
|
77 | + { |
|
78 | + $this->disallowMutation(__METHOD__); |
|
79 | + |
|
80 | + return parent::resetMessages($locale); |
|
81 | + } |
|
82 | + |
|
83 | + /** |
|
84 | + * @codeCoverageIgnore |
|
85 | + */ |
|
86 | + public function setFallbackLocales(array $locales) |
|
87 | + { |
|
88 | + $this->disallowMutation(__METHOD__); |
|
89 | + |
|
90 | + parent::setFallbackLocales($locales); |
|
91 | + } |
|
92 | + |
|
93 | + private function disallowMutation($method) |
|
94 | + { |
|
95 | + if ($this->constructed) { |
|
96 | + throw new ImmutableException($method.' not allowed on '.static::class); |
|
97 | + } |
|
98 | + } |
|
99 | 99 | } |
@@ -11,14 +11,14 @@ |
||
11 | 11 | |
12 | 12 | class DateTimeImmutableType extends VarDateTimeImmutableType implements CarbonDoctrineType |
13 | 13 | { |
14 | - /** @use CarbonTypeConverter<CarbonImmutable> */ |
|
15 | - use CarbonTypeConverter; |
|
14 | + /** @use CarbonTypeConverter<CarbonImmutable> */ |
|
15 | + use CarbonTypeConverter; |
|
16 | 16 | |
17 | - /** |
|
18 | - * @return class-string<CarbonImmutable> |
|
19 | - */ |
|
20 | - protected function getCarbonClassName(): string |
|
21 | - { |
|
22 | - return CarbonImmutable::class; |
|
23 | - } |
|
17 | + /** |
|
18 | + * @return class-string<CarbonImmutable> |
|
19 | + */ |
|
20 | + protected function getCarbonClassName(): string |
|
21 | + { |
|
22 | + return CarbonImmutable::class; |
|
23 | + } |
|
24 | 24 | } |
@@ -11,6 +11,6 @@ |
||
11 | 11 | |
12 | 12 | class DateTimeType extends VarDateTimeType implements CarbonDoctrineType |
13 | 13 | { |
14 | - /** @use CarbonTypeConverter<Carbon> */ |
|
15 | - use CarbonTypeConverter; |
|
14 | + /** @use CarbonTypeConverter<Carbon> */ |
|
15 | + use CarbonTypeConverter; |
|
16 | 16 | } |