Skip to content

Commit 7b9417c

Browse files
committed
Upgrade Coding Standard
1 parent 7642cd5 commit 7b9417c

File tree

6 files changed

+31
-31
lines changed

6 files changed

+31
-31
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
},
4141
"require-dev": {
4242
"ext-xdebug": "*",
43-
"aplus/coding-standard": "^1.14",
43+
"aplus/coding-standard": "^2.0",
4444
"ergebnis/composer-normalize": "^2.25",
4545
"jetbrains/phpstorm-attributes": "^1.0",
4646
"phpmd/phpmd": "^2.13",

src/Debug/RoutingCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function getActivities() : array
6666

6767
public function getContents() : string
6868
{
69-
if ( ! isset($this->router)) {
69+
if (!isset($this->router)) {
7070
return '<p>A Router instance has not been set on this collector.</p>';
7171
}
7272
\ob_start(); ?>

src/Reflector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function getRoutes() : array
9696
$origins = $this->getObjectOrigins($this->reflection);
9797
$result = [];
9898
foreach ($this->reflection->getMethods() as $method) {
99-
if ( ! $method->isPublic()) {
99+
if (!$method->isPublic()) {
100100
continue;
101101
}
102102
$routes = $this->getMethodRoutes($method->getName());
@@ -146,7 +146,7 @@ public function getRoutesNotFound() : array
146146
$origins = $this->getObjectOrigins($this->reflection);
147147
$result = [];
148148
foreach ($this->reflection->getMethods() as $method) {
149-
if ( ! $method->isPublic()) {
149+
if (!$method->isPublic()) {
150150
continue;
151151
}
152152
$routes = $this->getMethodRoutesNotFound($method->getName());

src/Route.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,24 +275,24 @@ public function run(mixed ...$construct) : Response
275275
}
276276
return $response;
277277
}
278-
if ( ! \str_contains($action, '::')) {
278+
if (!\str_contains($action, '::')) {
279279
$action .= '::' . $this->router->getDefaultRouteActionMethod();
280280
}
281281
[$classname, $action] = \explode('::', $action, 2);
282282
[$method, $arguments] = $this->extractMethodAndArguments($action);
283-
if ( ! \class_exists($classname)) {
283+
if (!\class_exists($classname)) {
284284
throw new RoutingException("Class not exists: {$classname}");
285285
}
286286
/**
287287
* @var RouteActions $class
288288
*/
289289
$class = new $classname(...$construct);
290-
if ( ! $class instanceof RouteActions) {
290+
if (!$class instanceof RouteActions) {
291291
throw new RoutingException(
292292
'Class ' . $class::class . ' is not an instance of ' . RouteActions::class
293293
);
294294
}
295-
if ( ! \method_exists($class, $method)) {
295+
if (!\method_exists($class, $method)) {
296296
throw new RoutingException(
297297
"Class action method not exists: {$classname}::{$method}"
298298
);
@@ -373,7 +373,7 @@ protected function makeResponseBodyPart(mixed $result) : string
373373
protected function extractMethodAndArguments(
374374
string $part
375375
) : array {
376-
if ( ! \str_contains($part, '/')) {
376+
if (!\str_contains($part, '/')) {
377377
return [$part, []];
378378
}
379379
$arguments = \explode('/', $part);

src/RouteCollection.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ protected function getRouteName(string $name) : string
151151
protected function addRoute(string $httpMethod, Route $route) : static
152152
{
153153
$method = \strtoupper($httpMethod);
154-
if ( ! \in_array($method, [
154+
if (!\in_array($method, [
155155
'DELETE',
156156
'GET',
157157
'OPTIONS',
@@ -281,10 +281,10 @@ protected function makeRouteActionFromArray(array $action) : string
281281
'When adding a route action as array, the index 0 must be a FQCN'
282282
);
283283
}
284-
if ( ! isset($action[1])) {
284+
if (!isset($action[1])) {
285285
$action[1] = $this->router->getDefaultRouteActionMethod();
286286
}
287-
if ( ! isset($action[2])) {
287+
if (!isset($action[2])) {
288288
$action[2] = '*';
289289
}
290290
if ($action[2] !== '') {
@@ -508,42 +508,42 @@ public function resource(
508508
$except = \array_flip($except);
509509
}
510510
$routes = [];
511-
if ( ! isset($except['index'])) {
511+
if (!isset($except['index'])) {
512512
$routes[] = $this->get(
513513
$path,
514514
$class . 'index/*',
515515
$baseName . '.index'
516516
);
517517
}
518-
if ( ! isset($except['create'])) {
518+
if (!isset($except['create'])) {
519519
$routes[] = $this->post(
520520
$path,
521521
$class . 'create/*',
522522
$baseName . '.create'
523523
);
524524
}
525-
if ( ! isset($except['show'])) {
525+
if (!isset($except['show'])) {
526526
$routes[] = $this->get(
527527
$path . $placeholder,
528528
$class . 'show/*',
529529
$baseName . '.show'
530530
);
531531
}
532-
if ( ! isset($except['update'])) {
532+
if (!isset($except['update'])) {
533533
$routes[] = $this->patch(
534534
$path . $placeholder,
535535
$class . 'update/*',
536536
$baseName . '.update'
537537
);
538538
}
539-
if ( ! isset($except['replace'])) {
539+
if (!isset($except['replace'])) {
540540
$routes[] = $this->put(
541541
$path . $placeholder,
542542
$class . 'replace/*',
543543
$baseName . '.replace'
544544
);
545545
}
546-
if ( ! isset($except['delete'])) {
546+
if (!isset($except['delete'])) {
547547
$routes[] = $this->delete(
548548
$path . $placeholder,
549549
$class . 'delete/*',
@@ -581,56 +581,56 @@ public function presenter(
581581
$except = \array_flip($except);
582582
}
583583
$routes = [];
584-
if ( ! isset($except['index'])) {
584+
if (!isset($except['index'])) {
585585
$routes[] = $this->get(
586586
$path,
587587
$class . 'index/*',
588588
$baseName . '.index'
589589
);
590590
}
591-
if ( ! isset($except['new'])) {
591+
if (!isset($except['new'])) {
592592
$routes[] = $this->get(
593593
$path . 'new',
594594
$class . 'new/*',
595595
$baseName . '.new'
596596
);
597597
}
598-
if ( ! isset($except['create'])) {
598+
if (!isset($except['create'])) {
599599
$routes[] = $this->post(
600600
$path,
601601
$class . 'create/*',
602602
$baseName . '.create'
603603
);
604604
}
605-
if ( ! isset($except['show'])) {
605+
if (!isset($except['show'])) {
606606
$routes[] = $this->get(
607607
$path . $placeholder,
608608
$class . 'show/*',
609609
$baseName . '.show'
610610
);
611611
}
612-
if ( ! isset($except['edit'])) {
612+
if (!isset($except['edit'])) {
613613
$routes[] = $this->get(
614614
$path . $placeholder . '/edit',
615615
$class . 'edit/*',
616616
$baseName . '.edit'
617617
);
618618
}
619-
if ( ! isset($except['update'])) {
619+
if (!isset($except['update'])) {
620620
$routes[] = $this->post(
621621
$path . $placeholder . '/update',
622622
$class . 'update/*',
623623
$baseName . '.update'
624624
);
625625
}
626-
if ( ! isset($except['remove'])) {
626+
if (!isset($except['remove'])) {
627627
$routes[] = $this->get(
628628
$path . $placeholder . '/remove',
629629
$class . 'remove/*',
630630
$baseName . '.remove'
631631
);
632632
}
633-
if ( ! isset($except['delete'])) {
633+
if (!isset($except['delete'])) {
634634
$routes[] = $this->post(
635635
$path . $placeholder . '/delete',
636636
$class . 'delete/*',

src/Router.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function setLanguage(Language $language = null) : static
117117

118118
public function getLanguage() : Language
119119
{
120-
if ( ! isset($this->language)) {
120+
if (!isset($this->language)) {
121121
$this->setLanguage();
122122
}
123123
return $this->language;
@@ -311,10 +311,10 @@ public function fillPlaceholders(string $string, string ...$arguments) : string
311311
return $string;
312312
}
313313
foreach ($matches[0] as $index => $pattern) {
314-
if ( ! isset($arguments[$index])) {
314+
if (!isset($arguments[$index])) {
315315
throw new InvalidArgumentException("Placeholder argument is not set: {$index}");
316316
}
317-
if ( ! \preg_match('#' . $pattern . '#', $arguments[$index])) {
317+
if (!\preg_match('#' . $pattern . '#', $arguments[$index])) {
318318
throw new InvalidArgumentException("Placeholder argument is invalid: {$index}");
319319
}
320320
$string = \substr_replace(
@@ -572,7 +572,7 @@ protected function makeMatchedRoute() : Route
572572
$this->setMatchedPath($path);
573573
$this->setMatchedOrigin($url->getOrigin());
574574
$this->matchedCollection = $this->matchCollection($url->getOrigin());
575-
if ( ! $this->matchedCollection) {
575+
if (!$this->matchedCollection) {
576576
return $this->matchedRoute = $this->getDefaultRouteNotFound();
577577
}
578578
return $this->matchedRoute = $this->matchRoute(
@@ -607,7 +607,7 @@ protected function getAlternativeRoute(string $method, RouteCollection $collecti
607607
Status::METHOD_NOT_ALLOWED
608608
);
609609
}
610-
if ( ! isset($route)) {
610+
if (!isset($route)) {
611611
// @phpstan-ignore-next-line
612612
$route = $collection->getRouteNotFound() ?? $this->getDefaultRouteNotFound();
613613
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy