Skip to content

Commit

Permalink
Merge pull request #43 from UseMuffin/deprecations
Browse files Browse the repository at this point in the history
Fix deprecation warnings
  • Loading branch information
ADmad committed Feb 24, 2020
2 parents 6fb7673 + fc3ce91 commit f0f252d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ php:
- 7.1
- 7.2

services:
- mysql
- postgresql

env:
matrix:
- DB=mysql db_dsn='mysql://[email protected]/cakephp_test'
Expand Down Expand Up @@ -37,7 +41,7 @@ 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 [[ $PHPCS = 1 ]]; then composer require cakephp/cakephp-codesniffer; fi
- if [[ $PHPCS = 1 ]]; then composer require cakephp/cakephp-codesniffer:^3.0; fi
- if [[ $PHPSTAN = 1 ]]; then composer require phpstan/phpstan; fi

script:
Expand Down
3 changes: 2 additions & 1 deletion src/Model/Entity/TagAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public function untag($tags = null)

foreach ($untags as $untag) {
foreach ($tags as $k => $tag) {
if ((empty($untag[$pk]) || $tag[$pk] === $untag[$pk]) &&
if (
(empty($untag[$pk]) || $tag[$pk] === $untag[$pk]) &&
(empty($untag[$df]) || $tag[$df] === $untag[$df])
) {
unset($tags[$k]);
Expand Down
6 changes: 5 additions & 1 deletion src/Model/Table/TagsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ public function initialize(array $config)
$this->setTable('tags_tags');
$this->setDisplayField('label');
$this->addBehavior('Timestamp');
if (Plugin::loaded('Muffin/Slug')) {
$method = 'isLoaded';
if (!method_exists(Plugin::class, 'isLoaded')) {
$method = 'loaded';
}
if (Plugin::{$method}('Muffin/Slug')) {
$this->addBehavior('Muffin/Slug.Slug');
}
}
Expand Down
2 changes: 0 additions & 2 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,3 @@
}

require $root . '/vendor/cakephp/cakephp/tests/bootstrap.php';

\Cake\Core\Plugin::load('Muffin/Tags', ['path' => dirname(dirname(__FILE__)) . DS]);

0 comments on commit f0f252d

Please sign in to comment.