Skip to content

Commit

Permalink
Fix issues reported by phpstan.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Jul 28, 2019
1 parent b768004 commit 5fb8ba1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ matrix:
- php: 7.3
env: PHPCS=1 DEFAULT=0

- php: 7.3
env: STATIC_ANALYSIS=1 DEFAULT=0

- php: 5.6
env: PREFER_LOWEST=1

Expand All @@ -34,6 +37,8 @@ before_script:
- if [[ $DB = 'mysql' ]]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi
- if [[ $DB = 'pgsql' ]]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi

- if [[ $STATIC_ANALYSIS = 1 ]]; then composer require --dev phpstan/phpstan-shim:^0.11; fi

script:
- |
if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.3 ]]; then
Expand All @@ -45,6 +50,8 @@ script:

- if [[ $PHPCS = 1 ]]; then vendor/bin/phpcs -n -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi

- if [[ $STATIC_ANALYSIS = 1 ]]; then vendor/bin/phpstan.phar analyse src/; fi

after_success:
- |
if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.3 ]]; then
Expand Down
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
parameters:
level: 5
ignoreErrors:
- '#Constant ROOT not found#'
- '#Parameter \#2 \$options of static method Cake\\Utility\\Text::slug\(\) expects array, string given#'
6 changes: 3 additions & 3 deletions src/Model/Behavior/UploadBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function beforeSave(Event $event, Entity $entity, ArrayObject $options)
* @param \Cake\Event\Event $event The afterDelete event that was fired
* @param \Cake\ORM\Entity $entity The entity that was deleted
* @param \ArrayObject $options the options passed to the delete method
* @return void|false
* @return bool
*/
public function afterDelete(Event $event, Entity $entity, ArrayObject $options)
{
Expand Down Expand Up @@ -167,7 +167,7 @@ public function afterDelete(Event $event, Entity $entity, ArrayObject $options)
* @param array $data the data being submitted for a save
* @param string $field the field for which data will be saved
* @param array $settings the settings for the current field
* @return \Josegonzalez\Upload\File\Path\AbstractProcessor
* @return \Josegonzalez\Upload\File\Path\ProcessorInterface
*/
public function getPathProcessor(Entity $entity, $data, $field, $settings)
{
Expand All @@ -190,7 +190,7 @@ public function getPathProcessor(Entity $entity, $data, $field, $settings)
* @param array $data the data being submitted for a save
* @param string $field the field for which data will be saved
* @param array $settings the settings for the current field
* @return \Josegonzalez\Upload\File\Path\AbstractProcessor
* @return \Josegonzalez\Upload\File\Writer\WriterInterface
*/
public function getWriter(Entity $entity, $data, $field, $settings)
{
Expand Down

0 comments on commit 5fb8ba1

Please sign in to comment.