diff --git a/.gitignore b/.gitignore
index a7892c57..6dc83e8f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,5 @@ vendor/
var/
.idea/
composer.lock
-.php-cs-fixer.cache
\ No newline at end of file
+.php-cs-fixer.cache
+web
\ No newline at end of file
diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php
index 00be7cee..c457240a 100644
--- a/.php-cs-fixer.php
+++ b/.php-cs-fixer.php
@@ -1,6 +1,6 @@
@@ -9,7 +9,8 @@
$finder = \PhpCsFixer\Finder::create()
->name('*.php')
->in([
- 'src',
+ __DIR__ . '/src',
+ __DIR__ . '/tests',
])
;
diff --git a/composer.json b/composer.json
index 37873b87..e8a77f51 100644
--- a/composer.json
+++ b/composer.json
@@ -35,17 +35,24 @@
"Dbout\\WpOrm\\": "src/"
}
},
+ "autoload-dev": {
+ "psr-4": {
+ "Dbout\\WpOrm\\Tests\\": "tests/"
+ }
+ },
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.28",
- "phpstan/phpstan": "^1.10",
- "rector/rector": "^0.18.4",
+ "phpstan/phpstan": ">=1.10.59",
"phpunit/phpunit": "^10.5",
"phpstan/phpstan-phpunit": "^1.3",
- "phpstan/extension-installer": "^1.3"
+ "phpstan/extension-installer": "^1.3",
+ "roots/wordpress": "6.4",
+ "rector/rector": "1.0.2"
},
"config": {
"allow-plugins": {
- "phpstan/extension-installer": true
+ "phpstan/extension-installer": true,
+ "roots/wordpress-core-installer": true
}
},
"extra": {
@@ -53,7 +60,8 @@
"includes": [
"extension.neon"
]
- }
+ },
+ "wordpress-install-dir": "web/wordpress"
},
"scripts": {
"rector": "vendor/bin/rector process src --dry-run",
diff --git a/phpstan.neon b/phpstan.neon
index 3dfb5991..b6b9ba0b 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -2,5 +2,6 @@ parameters:
level: 5
paths:
- src
+ - tests
excludePaths:
- src/Orm/Database.php
diff --git a/phpunit.xml b/phpunit.xml
index 5c4a3d31..7bc65e8d 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -2,7 +2,7 @@
- src/
+ tests/
\ No newline at end of file
diff --git a/rector.php b/rector.php
index 876d6fef..9e3df776 100644
--- a/rector.php
+++ b/rector.php
@@ -1,6 +1,6 @@
@@ -10,14 +10,17 @@
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector;
-return static function (RectorConfig $rectorConfig): void {
- // register single rule
- $rectorConfig->rule(TypedPropertyFromStrictConstructorRector::class);
-
- // here we can define, what sets of rules will be applied
- // tip: use "SetList" class to autocomplete sets with your IDE
- $rectorConfig->sets([
- SetList::CODE_QUALITY,
+return RectorConfig::configure()
+ ->withPaths([
+ __DIR__ . '/src',
+ __DIR__ . '/tests',
+ ])
+ ->withRules([
+ TypedPropertyFromStrictConstructorRector::class,
+ ])
+ ->withPreparedSets(
+ codeQuality: true,
+ )
+ ->withSets([
SetList::PHP_81,
]);
-};
diff --git a/renovate.json b/renovate.json
new file mode 100644
index 00000000..d6cd351c
--- /dev/null
+++ b/renovate.json
@@ -0,0 +1,12 @@
+{
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
+ "extends": [
+ "config:base",
+ ":disableDependencyDashboard"
+ ],
+ "minimumReleaseAge": "30 days",
+ "labels": ["dependencies"],
+ "prConcurrentLimit": 5,
+ "baseBranches": ["develop"],
+ "assignees": ["dimitriBouteille"]
+}
\ No newline at end of file
diff --git a/src/Models/TermTaxonomy.php b/src/Models/TermTaxonomy.php
index 5137eb22..fefac9fa 100644
--- a/src/Models/TermTaxonomy.php
+++ b/src/Models/TermTaxonomy.php
@@ -55,7 +55,7 @@ class TermTaxonomy extends AbstractModel
];
/**
- * @var string[]
+ * @inheritDoc
*/
protected $fillable = [
self::TERM_TAXONOMY_ID,
diff --git a/src/Orm/AbstractModel.php b/src/Orm/AbstractModel.php
index 62bcf1d3..4d934589 100644
--- a/src/Orm/AbstractModel.php
+++ b/src/Orm/AbstractModel.php
@@ -101,7 +101,7 @@ public function __call($method, $parameters)
$type = $matchGetter[1];
$attribute = $matchGetter[2];
- $attribute = strtolower(preg_replace('/(?getAttribute($attribute);
diff --git a/src/Tests/Unit/Builders/WithMetaBuilderTest.php b/tests/Builders/WithMetaBuilderTest.php
similarity index 99%
rename from src/Tests/Unit/Builders/WithMetaBuilderTest.php
rename to tests/Builders/WithMetaBuilderTest.php
index d7230b8d..ebdc3da0 100644
--- a/src/Tests/Unit/Builders/WithMetaBuilderTest.php
+++ b/tests/Builders/WithMetaBuilderTest.php
@@ -6,7 +6,7 @@
* Author: Dimitri BOUTEILLE
*/
-namespace Dbout\WpOrm\Tests\Unit\Builders;
+namespace Dbout\WpOrm\Tests\Builders;
use Dbout\WpOrm\Builders\PostBuilder;
use Dbout\WpOrm\Exceptions\WpOrmException;
diff --git a/src/Tests/Unit/Models/CustomPostTypeTest.php b/tests/Models/CustomPostTypeTest.php
similarity index 96%
rename from src/Tests/Unit/Models/CustomPostTypeTest.php
rename to tests/Models/CustomPostTypeTest.php
index ec158be2..a157ce5b 100644
--- a/src/Tests/Unit/Models/CustomPostTypeTest.php
+++ b/tests/Models/CustomPostTypeTest.php
@@ -6,7 +6,7 @@
* Author: Dimitri BOUTEILLE
*/
-namespace Dbout\WpOrm\Tests\Unit\Models;
+namespace Dbout\WpOrm\Tests\Models;
use Dbout\WpOrm\Exceptions\CannotOverrideCustomTypeException;
use Dbout\WpOrm\Models\Attachment;
diff --git a/src/Tests/Unit/Scopes/CustomModelTypeScopeTest.php b/tests/Scopes/CustomModelTypeScopeTest.php
similarity index 97%
rename from src/Tests/Unit/Scopes/CustomModelTypeScopeTest.php
rename to tests/Scopes/CustomModelTypeScopeTest.php
index c704453d..4abba9e8 100644
--- a/src/Tests/Unit/Scopes/CustomModelTypeScopeTest.php
+++ b/tests/Scopes/CustomModelTypeScopeTest.php
@@ -6,7 +6,7 @@
* Author: Dimitri BOUTEILLE
*/
-namespace Dbout\WpOrm\Tests\Unit\Scopes;
+namespace Dbout\WpOrm\Tests\Scopes;
use Dbout\WpOrm\Builders\OptionBuilder;
use Dbout\WpOrm\Builders\PostBuilder;