Skip to content

Commit

Permalink
refactor: re-run rector
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Dec 28, 2024
1 parent 095aea9 commit db363a7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion system/CLI/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ public static function promptByMultipleKeys(string $text, array $options): array
// return the prompt again if $input contain(s) non-numeric character, except a comma.
// And if max from $options less than max from input,
// it means user tried to access null value in $options
if (! $pattern || $maxOptions < $maxInput) {
if ($pattern === 0 || $pattern === false || $maxOptions < $maxInput) {
static::error('Please select correctly.');
CLI::newLine();

Expand Down
2 changes: 1 addition & 1 deletion system/Database/MigrationRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ protected function migrationFromFile(string $path, string $namespace)

$filename = basename($path, '.php');

if (! preg_match($this->regex, $filename)) {
if (preg_match($this->regex, $filename) !== 1) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion system/Helpers/form_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function form_open(string $action = '', $attributes = [], array $hidden = []): s
// Add CSRF field if enabled, but leave it out for GET requests and requests to external websites
$before = service('filters')->getFilters()['before'];

if ((in_array('csrf', $before, true) || array_key_exists('csrf', $before)) && str_contains($action, base_url()) && ! stripos($form, 'method="get"')) {
if ((in_array('csrf', $before, true) || array_key_exists('csrf', $before)) && str_contains($action, base_url()) && stripos($form, 'method="get"') === false) {
$form .= csrf_field($csrfId ?? null);
}

Expand Down
4 changes: 2 additions & 2 deletions system/Router/RouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ protected function fillRouteParams(string $from, ?array $params = null): string
$patterns = $matches[0];

foreach ($patterns as $index => $pattern) {
if (! preg_match('#^' . $pattern . '$#u', $params[$index])) {
if (preg_match('#^' . $pattern . '$#u', $params[$index]) !== 1) {
throw RouterException::forInvalidParameterType();
}

Expand Down Expand Up @@ -1391,7 +1391,7 @@ protected function buildReverseRoute(string $from, array $params): string
// or maybe $placeholder is not a placeholder, but a regex.
$pattern = $this->placeholders[$placeholderName] ?? $placeholder;

if (! preg_match('#^' . $pattern . '$#u', (string) $params[$index])) {
if (preg_match('#^' . $pattern . '$#u', (string) $params[$index]) !== 1) {
throw RouterException::forInvalidParameterType();
}

Expand Down

0 comments on commit db363a7

Please sign in to comment.