Skip to content

Commit

Permalink
Merge pull request #4 from LordSimal/master
Browse files Browse the repository at this point in the history
update to PHPStan 1.0 and fix new errors
  • Loading branch information
steinkel authored Nov 2, 2021
2 parents 9fda0d6 + 95648ec commit 16fabd3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"minimum-stability": "dev",
"require": {
"php": ">=7.2.0",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan": "^1.0",
"cakephp/cakephp": "^4.0.0"
},
"require-dev": {
"phpstan/phpstan-phpunit": "^0.12",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^8.5",
"squizlabs/php_codesniffer": "3.*"
},
Expand Down
4 changes: 2 additions & 2 deletions src/Traits/BaseCakeRegistryReturnTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ protected function getRegistryReturnType(
string $defaultClass,
string $namespaceFormat
) {
if (\count($methodCall->args) === 0) {
if (\count($methodCall->getArgs()) === 0) {
return ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType();
}

$argType = $scope->getType($methodCall->args[0]->value);
$argType = $scope->getType($methodCall->getArgs()[0]->value);
if (!method_exists($argType, 'getValue')) {
return new ObjectType($defaultClass);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_app/Command/MyTestLoadCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ public function execute(Arguments $args, ConsoleIo $io)
$article = $this->loadModel('VeryCustomize00009Articles')
->newSample();

$io->out($article->get('title'));
$io->out(strval($article->get('title')));
}
}
11 changes: 3 additions & 8 deletions tests/test_plugin/Model/Table/HelloWorld101010ArticlesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,10 @@ public function clearArticle($article)
}

/**
* @return \Cake\Datasource\EntityInterface
* @return \Cake\Datasource\EntityInterface|array<string, mixed>
*/
public function getLatestOne(): EntityInterface
public function getLatestOne()
{
/**
* @var \Cake\Datasource\EntityInterface $entity
*/
$entity = $this->find()->orderDesc('created')->firstOrFail();

return $entity;
return $this->find()->orderDesc('created')->firstOrFail();
}
}

0 comments on commit 16fabd3

Please sign in to comment.