Skip to content

Commit

Permalink
Merge pull request #542 from FriendsOfCake/phpstan
Browse files Browse the repository at this point in the history
Bump up phpstan level.
  • Loading branch information
ADmad authored Aug 11, 2017
2 parents 5b4bbae + 09ef0e5 commit 7c149b5
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 12 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ script:
- if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.0 ]]; then vendor/bin/phpunit --coverage-clover=clover.xml; fi

- if [[ $PHPCS = 1 ]]; then vendor/bin/phpcs -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi
- if [[ $PHPSTAN = 1 ]]; then vendor/bin/phpstan analyse -c phpstan.neon -l 1 src; fi
- if [[ $PHPSTAN = 1 ]]; then vendor/bin/phpstan analyse -c phpstan.neon -l 3 src; fi

after_success:
- if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.0 ]]; then bash <(curl -s https://codecov.io/bash); fi

notifications:
email: false

9 changes: 9 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
parameters:
excludes_analyse:
- */src/TestSuite/*
universalObjectCratesClasses:
- Crud\Event\Subject
ignoreErrors:
- '#Access to an undefined property Exception::\$response#'
- '#Access to an undefined property Cake\\Controller\\Controller::\$dispatchComponents#'
- '#Access to an undefined property Cake\\Controller\\Controller::\$Crud#'
- '#Call to an undefined method Crud\\Action\\BaseAction::view\(\)#'
- '#Call to an undefined method Crud\\Action\\BaseAction::viewVar\(\)#'
- '#Call to an undefined method Crud\\Action\\BaseAction::findMethod\(\)#'
2 changes: 1 addition & 1 deletion src/Action/Bulk/DeleteAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ protected function _bulk(Query $query = null)
$statement = $query->execute();
$statement->closeCursor();

return $statement->rowCount();
return (bool)$statement->rowCount();
}
}
2 changes: 1 addition & 1 deletion src/Action/Bulk/SetValueAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ protected function _bulk(Query $query = null)
$statement = $query->execute();
$statement->closeCursor();

return $statement->rowCount();
return (bool)$statement->rowCount();
}
}
2 changes: 1 addition & 1 deletion src/Action/Bulk/ToggleAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ protected function _bulk(Query $query = null)
$statement = $query->execute();
$statement->closeCursor();

return $statement->rowCount();
return (bool)$statement->rowCount();
}
}
4 changes: 2 additions & 2 deletions src/Controller/Component/CrudComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function initialize(array $config)
{
parent::initialize($config);

$this->_action = $this->_controller->request->action;
$this->_action = $this->_controller->request->param('action');
$this->_request = $this->_controller->request;

if (!isset($this->_controller->dispatchComponents)) {
Expand Down Expand Up @@ -600,7 +600,7 @@ public function table()
* Returns new entity
*
* @param array $data Data
* @return \Cake\ORM\Entity
* @return \Cake\Datasource\EntityInterface
*/
public function entity(array $data = [])
{
Expand Down
2 changes: 0 additions & 2 deletions src/Event/Subject.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
*
* @property string $action
*/
class Subject
{
Expand Down
4 changes: 2 additions & 2 deletions src/Listener/ApiPaginationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ class ApiPaginationListener extends BaseListener
*
* We attach at priority 10 so normal bound events can run before us
*
* @return array|void
* @return array|null
*/
public function implementedEvents()
{
if (!$this->_checkRequestType('api')) {
return;
return null;
}

return [
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Controller/Component/CrudComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ public function testIsActionMappedYes()
$result = $this->Crud->isActionMapped('index');
$this->assertTrue($result);

$this->controller->request->action = 'edit';
$this->controller->request->param('action', 'edit');
$this->Crud->initialize([]);
$result = $this->Crud->isActionMapped();
$this->assertTrue($result);
Expand Down

0 comments on commit 7c149b5

Please sign in to comment.