Skip to content

Commit e114b25

Browse files
committed
Merge branch 'cs' into development
# Conflicts: # composer.json
2 parents bcda539 + 33f47e3 commit e114b25

File tree

8 files changed

+29
-29
lines changed

8 files changed

+29
-29
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
},
6464
"require-dev": {
6565
"ext-xdebug": "*",
66-
"aplus/coding-standard": "^1.15",
66+
"aplus/coding-standard": "^2.0",
6767
"ergebnis/composer-normalize": "^2.35",
6868
"jetbrains/phpstorm-attributes": "^1.0",
6969
"phpmd/phpmd": "^2.13",

src/App.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function __construct(Config | array | string $config = null, bool $debug
118118
if (isset(static::$config)) {
119119
throw new LogicException('App already initialized');
120120
}
121-
if ( ! $config instanceof Config) {
121+
if (!$config instanceof Config) {
122122
$config = new Config($config);
123123
}
124124
static::$config = $config;
@@ -179,7 +179,7 @@ protected function loadExceptionHandler() : void
179179
if ($config->getDir() !== null) {
180180
$exceptionHandlerConfigs ??= $this->loadConfigs('exceptionHandler');
181181
}
182-
if ( ! isset($exceptionHandlerConfigs['default'])) {
182+
if (!isset($exceptionHandlerConfigs['default'])) {
183183
$environment = static::isDebugging()
184184
? ExceptionHandler::DEVELOPMENT
185185
: ExceptionHandler::PRODUCTION;
@@ -231,8 +231,8 @@ protected function debugEnd() : void
231231
{
232232
static::$debugCollector->setEndTime()->setEndMemory();
233233
$response = static::router()->getResponse();
234-
if ( ! $response->hasDownload()
235-
&& ! $response->getRequest()->isAjax()
234+
if (!$response->hasDownload()
235+
&& !$response->getRequest()->isAjax()
236236
&& \str_contains(
237237
(string) $response->getHeader('Content-Type'),
238238
'text/html'
@@ -493,7 +493,7 @@ protected static function addCommand(string $file, Console $console, Locator $lo
493493
if ($className === null) {
494494
return false;
495495
}
496-
if ( ! \class_exists($className)) {
496+
if (!\class_exists($className)) {
497497
Isolation::require($file);
498498
}
499499
$class = new ReflectionClass($className); // @phpstan-ignore-line
@@ -1037,7 +1037,7 @@ protected static function setRouter(string $instance, array $config = null) : Ro
10371037
if (isset($config['auto_methods']) && $config['auto_methods'] === true) {
10381038
$service->setAutoMethods();
10391039
}
1040-
if ( ! empty($config['placeholders'])) {
1040+
if (!empty($config['placeholders'])) {
10411041
$service->addPlaceholder($config['placeholders']);
10421042
}
10431043
if ($requireFiles && isset($config['files'])) {
@@ -1058,7 +1058,7 @@ protected static function setRouter(string $instance, array $config = null) : Ro
10581058
protected static function requireRouterFiles(array $files, Router $router) : void
10591059
{
10601060
foreach ($files as $file) {
1061-
if ( ! \is_file($file)) {
1061+
if (!\is_file($file)) {
10621062
throw new LogicException('Invalid router file: ' . $file);
10631063
}
10641064
Isolation::require($file, ['router' => $router]);
@@ -1166,10 +1166,10 @@ protected static function setResponse(string $instance) : Response
11661166
{
11671167
$config = static::config()->get('response', $instance);
11681168
$service = new Response(static::request($config['request_instance'] ?? 'default'));
1169-
if ( ! empty($config['headers'])) {
1169+
if (!empty($config['headers'])) {
11701170
$service->setHeaders($config['headers']);
11711171
}
1172-
if ( ! empty($config['auto_etag'])) {
1172+
if (!empty($config['auto_etag'])) {
11731173
$service->setAutoEtag(
11741174
$config['auto_etag']['active'] ?? true,
11751175
$config['auto_etag']['hash_algo'] ?? null

src/Debug/AppCollector.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ class AppCollector extends Collector
3131
public function setApp(App $app) : static
3232
{
3333
$this->app = $app;
34-
if ( ! isset($this->startTime)) {
34+
if (!isset($this->startTime)) {
3535
$this->setStartTime();
3636
}
37-
if ( ! isset($this->startMemory)) {
37+
if (!isset($this->startMemory)) {
3838
$this->setStartMemory();
3939
}
4040
return $this;
@@ -90,10 +90,10 @@ public function getActivities() : array
9090

9191
public function getContents() : string
9292
{
93-
if ( ! isset($this->endTime)) {
93+
if (!isset($this->endTime)) {
9494
$this->setEndTime(\microtime(true));
9595
}
96-
if ( ! isset($this->endMemory)) {
96+
if (!isset($this->endMemory)) {
9797
$this->setEndMemory(\memory_get_usage());
9898
}
9999
\ob_start(); ?>
@@ -161,7 +161,7 @@ protected function getServices() : array
161161
{
162162
$result = [];
163163
foreach ($this->getData() as $data) {
164-
if ( ! isset($result[$data['service']])) {
164+
if (!isset($result[$data['service']])) {
165165
$result[$data['service']] = [];
166166
}
167167
$result[$data['service']][] = [
@@ -180,7 +180,7 @@ protected function renderAvailableServices() : string
180180
$class = new ReflectionClass($this->app);
181181
$methods = $class->getMethods(ReflectionMethod::IS_STATIC);
182182
foreach ($methods as $method) {
183-
if ( ! $method->isPublic()) {
183+
if (!$method->isPublic()) {
184184
continue;
185185
}
186186
$name = $method->getName();
@@ -196,7 +196,7 @@ protected function renderAvailableServices() : string
196196
continue;
197197
}
198198
$param = $method->getParameters()[0] ?? null;
199-
if ( ! $param || $param->getName() !== 'instance') {
199+
if (!$param || $param->getName() !== 'instance') {
200200
continue;
201201
}
202202
if ($param->getType()?->getName() !== 'string') { // @phpstan-ignore-line

src/Debug/ViewCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function getContents() : string
7373

7474
protected function renderRenderedViews() : string
7575
{
76-
if ( ! $this->hasData()) {
76+
if (!$this->hasData()) {
7777
return '<p>No view has been rendered.</p>';
7878
}
7979
$data = $this->getSortedData();

src/Entity.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ protected function populate(array $properties) : void
140140

141141
protected function setProperty(string $name, mixed $value) : void
142142
{
143-
if ( ! \property_exists($this, $name)) {
143+
if (!\property_exists($this, $name)) {
144144
throw $this->propertyNotDefined($name);
145145
}
146146
if ($value !== null) {
@@ -251,7 +251,7 @@ public function toModel() : array
251251

252252
public function jsonSerialize() : stdClass
253253
{
254-
if ( ! $this->getJsonVars()) {
254+
if (!$this->getJsonVars()) {
255255
return new stdClass();
256256
}
257257
$allowed = \array_flip($this->getJsonVars());
@@ -268,7 +268,7 @@ protected function getObjectVars() : array
268268
{
269269
$result = [];
270270
foreach (\get_object_vars($this) as $key => $value) {
271-
if ( ! \str_starts_with($key, '_')) {
271+
if (!\str_starts_with($key, '_')) {
272272
$result[$key] = $value;
273273
}
274274
}

src/Model.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,7 @@ public function getValidationMessages() : array
12301230
*/
12311231
protected function getValidationRules() : array
12321232
{
1233-
if ( ! isset($this->validationRules)) {
1233+
if (!isset($this->validationRules)) {
12341234
throw new RuntimeException('Validation rules are not set');
12351235
}
12361236
return $this->validationRules;

src/Validator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static function notUnique(
3939
int | string $ignoreValue = '',
4040
string $connection = 'default'
4141
) : bool {
42-
return ! static::unique(
42+
return !static::unique(
4343
$field,
4444
$data,
4545
$tableColumn,
@@ -91,7 +91,7 @@ public static function unique(
9191
->expressions(['count' => static fn () => 'COUNT(*)'])
9292
->from($table)
9393
->whereEqual($column, $value);
94-
if ($ignoreColumn !== '' && ! \preg_match('#^{(\w+)}$#', $ignoreValue)) {
94+
if ($ignoreColumn !== '' && !\preg_match('#^{(\w+)}$#', $ignoreValue)) {
9595
$statement->whereNotEqual($ignoreColumn, $ignoreValue);
9696
}
9797
return $statement->limit(1)->run()->fetch()->count < 1; // @phpstan-ignore-line

src/View.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function __destruct()
6767
public function setBaseDir(string $baseDir) : static
6868
{
6969
$real = \realpath($baseDir);
70-
if ( ! $real || ! \is_dir($real)) {
70+
if (!$real || !\is_dir($real)) {
7171
throw new InvalidArgumentException("View base dir is not a valid directory: {$baseDir} ");
7272
}
7373
$this->baseDir = \rtrim($real, '\\/ ') . \DIRECTORY_SEPARATOR;
@@ -151,10 +151,10 @@ protected function getFilepath(string $view) : string
151151
}
152152
$view = $this->getBaseDir() . $view . $this->getExtension();
153153
$real = \realpath($view);
154-
if ( ! $real || ! \is_file($real)) {
154+
if (!$real || !\is_file($real)) {
155155
throw new InvalidArgumentException("View path does not match a file: {$view}");
156156
}
157-
if ($this->getBaseDir() && ! \str_starts_with($real, $this->getBaseDir())) {
157+
if ($this->getBaseDir() && !\str_starts_with($real, $this->getBaseDir())) {
158158
throw new InvalidArgumentException("View path out of base directory: {$real}");
159159
}
160160
return $real;
@@ -258,7 +258,7 @@ public function endBlock() : static
258258
echo \PHP_EOL . '<!-- Block end: ' . $block . ' -->' . \PHP_EOL;
259259
}
260260
$contents = \ob_get_clean();
261-
if ( ! isset($this->blocks[$name])) {
261+
if (!isset($this->blocks[$name])) {
262262
$this->blocks[$name] = $contents; // @phpstan-ignore-line
263263
}
264264
return $this;
@@ -373,7 +373,7 @@ protected function getContents(string $view, array $data) : string
373373
$data['view'] = $this;
374374
\ob_start();
375375
Isolation::require($this->getFilepath($view), $data);
376-
if (isset($this->openBlock) && ! $this->inInclude) {
376+
if (isset($this->openBlock) && !$this->inInclude) {
377377
$this->openBlock = null;
378378
$this->endBlock();
379379
}

0 commit comments

Comments
 (0)