You are here

public function PathUtilityBase::count in Drupal 7 to 8/9 Module Upgrader 8

After PHP 7.2+ for count() E_WARNING will now be emitted when attempting to count() non-countable types. Ref: https://secure.php.net/manual/en/migration72.incompatible.php#migration7...

Possible solutions will be to check is_countable() to check for variable is instanceof Countable, but is_countable() is available from 7.3.

To make compatible for lower version we need to suppress the warning for now because we know elements will always be of array type.

1 call to PathUtilityBase::count()
PathUtilityBase::getParent in src/Utility/Path/PathUtilityBase.php
Returns a PathUtilityInterface for the parent path.

File

src/Utility/Path/PathUtilityBase.php, line 147

Class

PathUtilityBase
Base class for PathUtilityInterface implementations.

Namespace

Drupal\drupalmoduleupgrader\Utility\Path

Code

public function count() {
  return @count($this
    ->toArray());
}