diff --git a/.travis.yml b/.travis.yml index 3a7b4cf0..ee9e3ae0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,14 +26,14 @@ before_script: - composer install --prefer-dist --no-interaction - if [[ $PHPCS = 1 ]]; then composer require cakephp/cakephp-codesniffer:dev-master; fi - - if [[ $PHPSTAN = 1 ]]; then composer require phpstan/phpstan:^0.8; fi + - if [[ $PHPSTAN = 1 ]]; then composer require phpstan/phpstan:^0.9; fi script: - if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION != 7.0 ]]; then vendor/bin/phpunit; fi - 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/ config/; fi - - if [[ $PHPSTAN = 1 ]]; then vendor/bin/phpstan analyse -l 5 src; fi + - if [[ $PHPSTAN = 1 ]]; then vendor/bin/phpstan analyse -c phpstan.neon -l 5 src; fi after_success: - if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.0 ]]; then bash <(curl -s https://codecov.io/bash); fi diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 00000000..f8f597a8 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,10 @@ +parameters: + universalObjectCratesClasses: + - Crud\Event\Subject + ignoreErrors: + - '#Access to an undefined property object::\$element#' + - '#Access to an undefined property object::\$params#' + - '#Access to an undefined property object::\$query#' + - '#Access to an undefined property object::\$type#' + - '#Parameter \#1 $dateTime of method Cake\\View\\Helper\\TimeHelper::timeAgoInWords\(\) expects Cake\\Chronos\\ChronosInterface|DateTime|int|string, DateTime|DateTimeImmutable|int|string given#' + - '#Parameter \#1 $dateString of method Cake\\View\\Helper\\TimeHelper::nice() expects DateTime|int|string|null, DateTime|DateTimeImmutable|int|string given#' diff --git a/src/Breadcrumb/Breadcrumb.php b/src/Breadcrumb/Breadcrumb.php index d579efe1..e01fc8aa 100644 --- a/src/Breadcrumb/Breadcrumb.php +++ b/src/Breadcrumb/Breadcrumb.php @@ -54,7 +54,7 @@ public function __construct($title, $url = null, array $options = []) /** * Returns the menu item title * - * @return string + * @return string|array */ public function getTitle() { diff --git a/src/Listener/ViewListener.php b/src/Listener/ViewListener.php index 581fdd31..abc08d42 100644 --- a/src/Listener/ViewListener.php +++ b/src/Listener/ViewListener.php @@ -574,7 +574,7 @@ protected function _primaryKeyValue() * * If no value can be found, NULL is returned * - * @return string + * @return string|null */ protected function _displayFieldValue() { @@ -582,7 +582,7 @@ protected function _displayFieldValue() } /** - * Extract a field value from a either the CakeRequest::getData() + * Extract a field value from a either ServerRequest::getData() * or Controller::$viewVars for the current model + the supplied field * * @param string $field Name of field. diff --git a/src/View/Helper/CrudViewHelper.php b/src/View/Helper/CrudViewHelper.php index 7d5b7ed8..3868bbe0 100644 --- a/src/View/Helper/CrudViewHelper.php +++ b/src/View/Helper/CrudViewHelper.php @@ -252,7 +252,7 @@ public function formatString($field, $value) * Format display field value. * * @param string $value Display field value. - * @param mixed $options Field options. + * @param array $options Field options. * @return string */ public function formatDisplayField($value, array $options)