Skip to content

Commit 4c788c1

Browse files
committed
Integrate marwa-support library and fix PHPStan errors
- Extend Str, Arr, Collection from marwa-support classes - Use Date::format() in Helpers::now() - Replace json_encode/decode with Json class - Replace number_format with Number::format() - Add EagerLoads trait to Model - Fix PHPStan: null checks in aggregate methods, return types - Fix foreach.emptyArray by assigning to variable first Reduces PHPStan errors from 68 to 62
1 parent 5dea6ef commit 4c788c1

24 files changed

Lines changed: 310 additions & 193 deletions

bin/lint

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__ . '/../src', RecursiveDirectoryIterator::SKIP_DOTS));
5+
$exitCode = 0;
6+
7+
foreach ($it as $file) {
8+
if ($file->getExtension() !== 'php') {
9+
continue;
10+
}
11+
12+
$pathname = $file->getPathname();
13+
$output = [];
14+
$return = 0;
15+
exec("php -l " . escapeshellarg($pathname) . " 2>&1", $output, $return);
16+
17+
if ($return !== 0) {
18+
echo implode("\n", $output) . "\n";
19+
$exitCode = 1;
20+
}
21+
}
22+
23+
exit($exitCode);

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"ext-json": "*",
99
"ext-pdo": "*",
1010
"fakerphp/faker": "^1.23",
11+
"memran/marwa-support": "1.3.1",
1112
"psr/log": "^3.0",
1213
"symfony/console": "^7.0",
1314
"symfony/string": "^7.3"
@@ -35,7 +36,7 @@
3536
"test:coverage": "XDEBUG_MODE=coverage phpunit -c phpunit.xml.dist --coverage-text",
3637
"test:unit": "phpunit -c phpunit.xml.dist --testsuite Unit",
3738
"test:integration": "phpunit -c phpunit.xml.dist --testsuite Integration",
38-
"lint": "php -l $(git ls-files '*.php')",
39+
"lint": "php bin/lint",
3940
"analyse": "phpstan analyse --configuration=phpstan.neon --memory-limit=512M",
4041
"analyze": "@analyse",
4142
"ci": [

0 commit comments

Comments
 (0)