diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 8a49014..89f9198 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -74,7 +74,7 @@ jobs:
cs-stan:
name: Coding Standard & Static Analysis
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
@@ -85,18 +85,21 @@ jobs:
php-version: '8.1'
extensions: mbstring, intl
coverage: none
- tools: cs2pr, vimeo/psalm:4, phpstan:1
+ tools: phive, cs2pr
+
+ - name: Composer install
+ uses: ramsey/composer-install@v2
- - name: Composer Install
- run: composer install
+ - name: Install PHP tools with phive.
+ run: "phive install --trust-gpg-keys 'CF1A108D0E7AE720,51C67305FFC2E5C0,12CE0F1D262429A5'"
- name: Run phpcs
run: vendor/bin/phpcs --report=checkstyle src/ tests/ | cs2pr
- name: Run psalm
if: always()
- run: psalm --output-format=github
+ run: tools/psalm --output-format=github
- - name: Run psalm
+ - name: Run phpstan
if: always()
- run: phpstan analyse
+ run: tools/phpstan analyse --error-format=github
diff --git a/.gitignore b/.gitignore
index c99e558..5964e8e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
/.phpunit.cache
/.idea/
/config/Migrations/schema-dump-default.lock
+/tools
diff --git a/.phive/phars.xml b/.phive/phars.xml
new file mode 100644
index 0000000..17093fd
--- /dev/null
+++ b/.phive/phars.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/composer.json b/composer.json
index d3225bc..79bf4bd 100644
--- a/composer.json
+++ b/composer.json
@@ -25,7 +25,17 @@
"license": "MIT",
"scripts": {
"cs-check": "phpcs --colors -p ./src ./tests",
- "cs-fix": "phpcbf --colors -p ./src ./tests"
+ "cs-fix": "phpcbf --colors -p ./src ./tests",
+ "test": "phpunit",
+ "phpstan": "tools/phpstan analyse",
+ "psalm": "tools/psalm --show-info=false",
+ "stan": [
+ "@phpstan",
+ "@psalm"
+ ],
+ "phpstan-baseline": "tools/phpstan --generate-baseline",
+ "psalm-baseline": "tools/psalm --set-baseline=psalm-baseline.xml",
+ "stan-setup": "phive install"
},
"config": {
"allow-plugins": {
diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
new file mode 100644
index 0000000..3192ef8
--- /dev/null
+++ b/phpstan-baseline.neon
@@ -0,0 +1,11 @@
+parameters:
+ ignoreErrors:
+ -
+ message: "#^Parameter \\#1 \\$callback of function call_user_func expects callable\\(\\)\\: mixed, array\\{Cake\\\\ORM\\\\Table, mixed\\} given\\.$#"
+ count: 1
+ path: src/Middleware/SocialAuthMiddleware.php
+
+ -
+ message: "#^Method ADmad\\\\SocialAuth\\\\Plugin\\:\\:bootstrap\\(\\) has parameter \\$app with generic interface Cake\\\\Core\\\\PluginApplicationInterface but does not specify its types\\: TSubject$#"
+ count: 1
+ path: src/Plugin.php
diff --git a/phpstan.neon b/phpstan.neon
index 19914e0..8cdbddf 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -1,3 +1,6 @@
+includes:
+ - phpstan-baseline.neon
+
parameters:
level: 8
checkMissingIterableValueType: false
@@ -5,8 +8,3 @@ parameters:
- tests/bootstrap.php
paths:
- src/
- ignoreErrors:
- -
- message: "#^Parameter \\#1 \\$function of function call_user_func expects callable\\(\\)\\: mixed, array\\{Cake\\\\ORM\\\\Table, mixed\\} given\\.$#"
- count: 1
- path: src/Middleware/SocialAuthMiddleware.php
diff --git a/psalm.xml b/psalm.xml
index 5359f52..b538299 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -1,5 +1,8 @@
+ */
class SocialAuthMiddleware implements MiddlewareInterface, EventDispatcherInterface
{
+ /**
+ * @use \Cake\Event\EventDispatcherTrait<\ADmad\SocialAuth\Middleware\SocialAuthMiddleware>
+ */
use EventDispatcherTrait;
use InstanceConfigTrait;
use LocatorAwareTrait;
@@ -562,7 +568,6 @@ protected function _getService(ServerRequest $request): Service
$serviceConfig = Configure::consume('SocialAuth');
}
- /** @psalm-suppress PossiblyInvalidArrayOffset */
if (!isset($serviceConfig['redirectUri'])) {
$serviceConfig['redirectUri'] = Router::url([
'plugin' => 'ADmad/SocialAuth',
@@ -580,7 +585,6 @@ protected function _getService(ServerRequest $request): Service
new StreamFactory()
);
- /** @psalm-suppress PossiblyNullArgument */
$this->_service = new Service(
$httpStack,
$this->_session ?: new SocialConnectSession(),
diff --git a/src/Model/Table/SocialProfilesTable.php b/src/Model/Table/SocialProfilesTable.php
index a083ce0..54ffd66 100644
--- a/src/Model/Table/SocialProfilesTable.php
+++ b/src/Model/Table/SocialProfilesTable.php
@@ -16,16 +16,16 @@
* @method \ADmad\SocialAuth\Model\Entity\SocialProfile newEmptyEntity()
* @method \ADmad\SocialAuth\Model\Entity\SocialProfile newEntity(array $data, array $options = [])
* @method \ADmad\SocialAuth\Model\Entity\SocialProfile[] newEntities(array $data, array $options = [])
- * @method \ADmad\SocialAuth\Model\Entity\SocialProfile get($primaryKey, $options = [])
+ * @method \ADmad\SocialAuth\Model\Entity\SocialProfile get(mixed $primaryKey, array|string $finder = 'all', \Psr\SimpleCache\CacheInterface|string|null $cache = null, \Closure|string|null $cacheKey = null, mixed ...$args)
* @method \ADmad\SocialAuth\Model\Entity\SocialProfile findOrCreate($search, ?callable $callback = null, $options = [])
* @method \ADmad\SocialAuth\Model\Entity\SocialProfile patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \ADmad\SocialAuth\Model\Entity\SocialProfile[] patchEntities(iterable $entities, array $data, array $options = [])
* @method \ADmad\SocialAuth\Model\Entity\SocialProfile|false save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \ADmad\SocialAuth\Model\Entity\SocialProfile saveOrFail(\Cake\Datasource\EntityInterface $entity, $options = [])
- * @method \ADmad\SocialAuth\Model\Entity\SocialProfile[]|\Cake\Datasource\ResultSetInterface|false saveMany(iterable $entities, $options = [])
- * @method \ADmad\SocialAuth\Model\Entity\SocialProfile[]|\Cake\Datasource\ResultSetInterface saveManyOrFail(iterable $entities, $options = [])
- * @method \ADmad\SocialAuth\Model\Entity\SocialProfile[]|\Cake\Datasource\ResultSetInterface|false deleteMany(iterable $entities, $options = [])
- * @method \ADmad\SocialAuth\Model\Entity\SocialProfile[]|\Cake\Datasource\ResultSetInterface deleteManyOrFail(iterable $entities, $options = [])
+ * @method \ADmad\SocialAuth\Model\Entity\SocialProfile[]|false saveMany(iterable $entities, $options = [])
+ * @method \ADmad\SocialAuth\Model\Entity\SocialProfile[] saveManyOrFail(iterable $entities, $options = [])
+ * @method \ADmad\SocialAuth\Model\Entity\SocialProfile[]|false deleteMany(iterable $entities, $options = [])
+ * @method \ADmad\SocialAuth\Model\Entity\SocialProfile[] deleteManyOrFail(iterable $entities, $options = [])
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
class SocialProfilesTable extends Table