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 Aug 1, 2017
1 parent 436c7ad commit 4a8230f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ matrix:
- php: 7.0
env: PHPCS=1 DEFAULT=0

- php: 7.0
env: PHPSTAN=1 DEFAULT=0

before_script:
- if [[ $TRAVIS_PHP_VERSION != 7.0 ]]; then phpenv config-rm xdebug.ini; fi

Expand All @@ -38,8 +41,11 @@ before_script:
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 -n -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi

- if [[ $PHPSTAN = 1 ]]; then composer require --dev phpstan/phpstan:^0.8 && vendor/bin/phpstan analyse -l 5 src; fi

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

Expand Down
10 changes: 5 additions & 5 deletions src/Model/Behavior/SlugBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ class SlugBehavior extends Behavior
];

/**
* Slugger instance
* Slugger instance or callable
*
* @var \Muffin\Slug\SluggerInterface
* @var \Muffin\Slug\SluggerInterface|callable
*/
protected $_slugger;

Expand Down Expand Up @@ -124,16 +124,16 @@ public function initialize(array $config)
/**
* Get/set slugger instance.
*
* @param callable $slugger Sets slugger instance if passed.
* @param \Muffin\Slug\SluggerInterface|callable $slugger Sets slugger instance if passed.
* If no argument is passed return slugger intance based on behavior config.
* @return callable|void
* @return callable|\Muffin\Slug\SluggerInterface|null
*/
public function slugger($slugger = null)
{
if ($slugger !== null) {
$this->_slugger = $slugger;

return;
return null;
}

if ($this->_slugger !== null) {
Expand Down

0 comments on commit 4a8230f

Please sign in to comment.