@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | // When PHP 7.1 is no longer supported, change to using spl_object_id. |
| 29 | - $hash = spl_object_hash($charTree) . ';' . $position; |
|
| 29 | + $hash = spl_object_hash($charTree).';'.$position; |
|
| 30 | 30 | |
| 31 | 31 | if (!isset(self::$memoization[$hash])) { |
| 32 | 32 | self::$memoization[$hash] = $this->cutInternal($charTree, $position); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $rootLength = mb_strlen($root); |
| 52 | - $branchPosition = $position - $rootLength; |
|
| 52 | + $branchPosition = $position-$rootLength; |
|
| 53 | 53 | |
| 54 | 54 | if ($branchPosition < 0) { |
| 55 | 55 | return [['', $charTree]]; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | assert(is_string($branchRoot)); |
| 66 | 66 | assert(is_object($branchTree)); |
| 67 | 67 | |
| 68 | - $cutCharTrees[] = [$root . $branchRoot, $branchTree]; |
|
| 68 | + $cutCharTrees[] = [$root.$branchRoot, $branchTree]; |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | if ($constraint->getMax() === null) { |
| 18 | 18 | return $translator->trans( |
| 19 | - 'The password must contain at least one symbol (%characters%).|' . |
|
| 19 | + 'The password must contain at least one symbol (%characters%).|'. |
|
| 20 | 20 | 'The password must contain at least %count% symbols (%characters%).', |
| 21 | 21 | [ |
| 22 | 22 | '%count%' => $constraint->getMin(), |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | if ($constraint->getMin() === 0) { |
| 36 | 36 | return $translator->trans( |
| 37 | - 'The password must contain at most one symbol (%characters%).|' . |
|
| 37 | + 'The password must contain at most one symbol (%characters%).|'. |
|
| 38 | 38 | 'The password must contain at most %count% symbols (%characters%).', |
| 39 | 39 | [ |
| 40 | 40 | '%count%' => $constraint->getMax(), |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | if ($constraint->getMin() === $constraint->getMax()) { |
| 47 | 47 | return $translator->trans( |
| 48 | - 'The password must contain exactly one symbol (%characters%).|' . |
|
| 48 | + 'The password must contain exactly one symbol (%characters%).|'. |
|
| 49 | 49 | 'The password must contain exactly %count% symbols (%characters%).', |
| 50 | 50 | [ |
| 51 | 51 | '%count%' => $constraint->getMin(), |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | return true; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - $word = $this->getDictionaryWord((string)$password); |
|
| 63 | + $word = $this->getDictionaryWord((string) $password); |
|
| 64 | 64 | |
| 65 | 65 | return $word === null; |
| 66 | 66 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function validate($password, TranslatorInterface $translator): ?ValidationError |
| 72 | 72 | { |
| 73 | - $word = $this->getDictionaryWord((string)$password); |
|
| 73 | + $word = $this->getDictionaryWord((string) $password); |
|
| 74 | 74 | |
| 75 | 75 | if ($word !== null) { |
| 76 | 76 | return new ValidationError( |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | } catch (RuntimeException $exception) { |
| 100 | 100 | throw new CouldNotUseRuleException( |
| 101 | 101 | $this, |
| 102 | - 'An error occurred while using the word list: ' . $exception->getMessage(), |
|
| 102 | + 'An error occurred while using the word list: '.$exception->getMessage(), |
|
| 103 | 103 | $exception |
| 104 | 104 | ); |
| 105 | 105 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | if ($constraint->getMax() === null) { |
| 28 | 28 | return $translator->trans( |
| 29 | - 'The password must contain at least one digit.|' . |
|
| 29 | + 'The password must contain at least one digit.|'. |
|
| 30 | 30 | 'The password must contain at least %count% digits.', |
| 31 | 31 | ['%count%' => $constraint->getMin()] |
| 32 | 32 | ); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | if ($constraint->getMin() === 0) { |
| 42 | 42 | return $translator->trans( |
| 43 | - 'The password must contain at most one digit.|' . |
|
| 43 | + 'The password must contain at most one digit.|'. |
|
| 44 | 44 | 'The password must contain at most %count% digits.', |
| 45 | 45 | ['%count%' => $constraint->getMax()] |
| 46 | 46 | ); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | if ($constraint->getMin() === $constraint->getMax()) { |
| 50 | 50 | return $translator->trans( |
| 51 | - 'The password must contain exactly one digit.|' . |
|
| 51 | + 'The password must contain exactly one digit.|'. |
|
| 52 | 52 | 'The password must contain exactly %count% digits.', |
| 53 | 53 | ['%count%' => $constraint->getMin()] |
| 54 | 54 | ); |
@@ -96,8 +96,8 @@ |
||
| 96 | 96 | if ($this->translator === null) { |
| 97 | 97 | $this->translator = new Translator('en_US'); |
| 98 | 98 | $this->translator->addLoader('mo', new MoFileLoader()); |
| 99 | - $this->translator->addResource('mo', __DIR__ . '/../translations/messages.nn_NO.mo', 'nn_NO'); |
|
| 100 | - $this->translator->addResource('mo', __DIR__ . '/../translations/messages.nb_NO.mo', 'nb_NO'); |
|
| 99 | + $this->translator->addResource('mo', __DIR__.'/../translations/messages.nn_NO.mo', 'nn_NO'); |
|
| 100 | + $this->translator->addResource('mo', __DIR__.'/../translations/messages.nb_NO.mo', 'nb_NO'); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | return $this->translator; |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | |
| 47 | 47 | $this->constraints[] = new DateConstraint($start, $end, $weight); |
| 48 | 48 | |
| 49 | - StableSort::usort($this->constraints, static function (DateConstraint $a, DateConstraint $b): int { |
|
| 49 | + StableSort::usort($this->constraints, static function(DateConstraint $a, DateConstraint $b): int { |
|
| 50 | 50 | return $b->getWeight() <=> $a->getWeight(); |
| 51 | 51 | }); |
| 52 | 52 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | $this->constraints[] = new CountConstraint($min, $max, $weight); |
| 41 | 41 | |
| 42 | - StableSort::usort($this->constraints, static function (CountConstraint $a, CountConstraint $b): int { |
|
| 42 | + StableSort::usort($this->constraints, static function(CountConstraint $a, CountConstraint $b): int { |
|
| 43 | 43 | return $b->getWeight() <=> $a->getWeight(); |
| 44 | 44 | }); |
| 45 | 45 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function test($password, ?int $weight = null): bool |
| 57 | 57 | { |
| 58 | - $count = $this->getCount((string)$password); |
|
| 58 | + $count = $this->getCount((string) $password); |
|
| 59 | 59 | $constraint = $this->getViolation($count, $weight); |
| 60 | 60 | |
| 61 | 61 | return $constraint === null; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function validate($password, TranslatorInterface $translator): ?ValidationError |
| 72 | 72 | { |
| 73 | - $count = $this->getCount((string)$password); |
|
| 73 | + $count = $this->getCount((string) $password); |
|
| 74 | 74 | $constraint = $this->getViolation($count); |
| 75 | 75 | |
| 76 | 76 | if ($constraint !== null) { |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | assert(count($passwordCharacters) === count($upperCaseCharacters)); |
| 118 | 118 | |
| 119 | 119 | $count = 0; |
| 120 | - for ($i = count($passwordCharacters) - 1; $i >= 0; --$i) { |
|
| 120 | + for ($i = count($passwordCharacters)-1; $i >= 0; --$i) { |
|
| 121 | 121 | if ($passwordCharacters[$i] !== $upperCaseCharacters[$i]) { |
| 122 | 122 | ++$count; |
| 123 | 123 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | { |
| 149 | 149 | if ($constraint->getMax() === null) { |
| 150 | 150 | return $translator->trans( |
| 151 | - 'The password must contain at least one lower case letter.|' . |
|
| 151 | + 'The password must contain at least one lower case letter.|'. |
|
| 152 | 152 | 'The password must contain at least %count% lower case letters.', |
| 153 | 153 | ['%count%' => $constraint->getMin()] |
| 154 | 154 | ); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | if ($constraint->getMin() === 0) { |
| 164 | 164 | return $translator->trans( |
| 165 | - 'The password must contain at most one lower case letter.|' . |
|
| 165 | + 'The password must contain at most one lower case letter.|'. |
|
| 166 | 166 | 'The password must contain at most %count% lower case letters.', |
| 167 | 167 | ['%count%' => $constraint->getMax()] |
| 168 | 168 | ); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | if ($constraint->getMin() === $constraint->getMax()) { |
| 172 | 172 | return $translator->trans( |
| 173 | - 'The password must contain exactly one lower case letter.|' . |
|
| 173 | + 'The password must contain exactly one lower case letter.|'. |
|
| 174 | 174 | 'The password must contain exactly %count% lower case letters.', |
| 175 | 175 | ['%count%' => $constraint->getMin()] |
| 176 | 176 | ); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | $this->constraints[] = new CountConstraint($min, $max, $weight); |
| 41 | 41 | |
| 42 | - StableSort::usort($this->constraints, static function (CountConstraint $a, CountConstraint $b): int { |
|
| 42 | + StableSort::usort($this->constraints, static function(CountConstraint $a, CountConstraint $b): int { |
|
| 43 | 43 | return $b->getWeight() <=> $a->getWeight(); |
| 44 | 44 | }); |
| 45 | 45 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function test($password, ?int $weight = null): bool |
| 57 | 57 | { |
| 58 | - $count = $this->getCount((string)$password); |
|
| 58 | + $count = $this->getCount((string) $password); |
|
| 59 | 59 | $constraint = $this->getViolation($count, $weight); |
| 60 | 60 | |
| 61 | 61 | return $constraint === null; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function validate($password, TranslatorInterface $translator): ?ValidationError |
| 72 | 72 | { |
| 73 | - $count = $this->getCount((string)$password); |
|
| 73 | + $count = $this->getCount((string) $password); |
|
| 74 | 74 | $constraint = $this->getViolation($count); |
| 75 | 75 | |
| 76 | 76 | if ($constraint !== null) { |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | { |
| 124 | 124 | if ($constraint->getMax() === null) { |
| 125 | 125 | return $translator->trans( |
| 126 | - 'The password must contain at least one character.|' . |
|
| 126 | + 'The password must contain at least one character.|'. |
|
| 127 | 127 | 'The password must contain at least %count% characters.', |
| 128 | 128 | ['%count%' => $constraint->getMin()] |
| 129 | 129 | ); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | if ($constraint->getMin() === 0) { |
| 139 | 139 | return $translator->trans( |
| 140 | - 'The password must contain at most one character.|' . |
|
| 140 | + 'The password must contain at most one character.|'. |
|
| 141 | 141 | 'The password must contain at most %count% characters.', |
| 142 | 142 | ['%count%' => $constraint->getMax()] |
| 143 | 143 | ); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | if ($constraint->getMin() === $constraint->getMax()) { |
| 147 | 147 | return $translator->trans( |
| 148 | - 'The password must contain exactly one character.|' . |
|
| 148 | + 'The password must contain exactly one character.|'. |
|
| 149 | 149 | 'The password must contain exactly %count% characters.', |
| 150 | 150 | ['%count%' => $constraint->getMin()] |
| 151 | 151 | ); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | $this->constraints[] = new CountConstraint($min, $max, $weight); |
| 53 | 53 | |
| 54 | - StableSort::usort($this->constraints, static function (CountConstraint $a, CountConstraint $b): int { |
|
| 54 | + StableSort::usort($this->constraints, static function(CountConstraint $a, CountConstraint $b): int { |
|
| 55 | 55 | return $b->getWeight() <=> $a->getWeight(); |
| 56 | 56 | }); |
| 57 | 57 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function test($password, ?int $weight = null): bool |
| 77 | 77 | { |
| 78 | - $count = $this->getCount((string)$password); |
|
| 78 | + $count = $this->getCount((string) $password); |
|
| 79 | 79 | $constraint = $this->getViolation($count, $weight); |
| 80 | 80 | |
| 81 | 81 | return $constraint === null; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function validate($password, TranslatorInterface $translator): ?ValidationError |
| 92 | 92 | { |
| 93 | - $count = $this->getCount((string)$password); |
|
| 93 | + $count = $this->getCount((string) $password); |
|
| 94 | 94 | $constraint = $this->getViolation($count); |
| 95 | 95 | |
| 96 | 96 | if ($constraint !== null) { |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | private function getCount(string $password): int |
| 132 | 132 | { |
| 133 | 133 | $escapedCharacters = preg_quote($this->characters); |
| 134 | - $count = preg_match_all('{[' . $escapedCharacters . ']}u', $password); |
|
| 134 | + $count = preg_match_all('{['.$escapedCharacters.']}u', $password); |
|
| 135 | 135 | assert($count !== false); |
| 136 | 136 | |
| 137 | 137 | return $count; |