Skip to content

Commit 16fabd3

Browse files
authored
Merge pull request #4 from LordSimal/master
update to PHPStan 1.0 and fix new errors
2 parents 9fda0d6 + 95648ec commit 16fabd3

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
"minimum-stability": "dev",
1414
"require": {
1515
"php": ">=7.2.0",
16-
"phpstan/phpstan": "^0.12",
16+
"phpstan/phpstan": "^1.0",
1717
"cakephp/cakephp": "^4.0.0"
1818
},
1919
"require-dev": {
20-
"phpstan/phpstan-phpunit": "^0.12",
20+
"phpstan/phpstan-phpunit": "^1.0",
2121
"phpunit/phpunit": "^8.5",
2222
"squizlabs/php_codesniffer": "3.*"
2323
},

src/Traits/BaseCakeRegistryReturnTrait.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ protected function getRegistryReturnType(
3737
string $defaultClass,
3838
string $namespaceFormat
3939
) {
40-
if (\count($methodCall->args) === 0) {
40+
if (\count($methodCall->getArgs()) === 0) {
4141
return ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType();
4242
}
4343

44-
$argType = $scope->getType($methodCall->args[0]->value);
44+
$argType = $scope->getType($methodCall->getArgs()[0]->value);
4545
if (!method_exists($argType, 'getValue')) {
4646
return new ObjectType($defaultClass);
4747
}

tests/test_app/Command/MyTestLoadCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ public function execute(Arguments $args, ConsoleIo $io)
2626
$article = $this->loadModel('VeryCustomize00009Articles')
2727
->newSample();
2828

29-
$io->out($article->get('title'));
29+
$io->out(strval($article->get('title')));
3030
}
3131
}

tests/test_plugin/Model/Table/HelloWorld101010ArticlesTable.php

+3-8
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,10 @@ public function clearArticle($article)
3535
}
3636

3737
/**
38-
* @return \Cake\Datasource\EntityInterface
38+
* @return \Cake\Datasource\EntityInterface|array<string, mixed>
3939
*/
40-
public function getLatestOne(): EntityInterface
40+
public function getLatestOne()
4141
{
42-
/**
43-
* @var \Cake\Datasource\EntityInterface $entity
44-
*/
45-
$entity = $this->find()->orderDesc('created')->firstOrFail();
46-
47-
return $entity;
42+
return $this->find()->orderDesc('created')->firstOrFail();
4843
}
4944
}

0 commit comments

Comments
 (0)