2017 © Pedro Peláez
 

library is_countable-polyfill

A trivial but working polyfill for PHP 7.3 is_countable function. Supports PHP versions >= 5.3

image

ayesh/is_countable-polyfill

A trivial but working polyfill for PHP 7.3 is_countable function. Supports PHP versions >= 5.3

  • Sunday, June 17, 2018
  • by Ayesh
  • Repository
  • 1 Watchers
  • 12 Stars
  • 28 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 8 Versions
  • 27 % Grown

The README.md

PHP 7.3 is_countable polyfill

A trivial yet functional polyfill for PHP 7.3 is_countable() function., (*1)

This polyfill is now archived and is marked as abandoned. PHP 7.3 is quite old, and it is highly recommended to simply upgrade to PHP 8 or later, which should leave no reason to use this polyfill. Thank you for using/considering this polyfill., (*2)

Installation

You can use composer to install this polyfill:, (*3)

composer require ayesh/is_countable-polyfill, (*4)

Tests

PHPUnit is used as the test framework. Some of the tested variables are directly taken from the commit that added is_countable to PHP source., (*5)

FAQ (or questions I think someone would ask)

Why use this library when I could simply copy-paste the snippet from the RFC?, (*6)

¯\_(ツ)_/¯, (*7)

PHP 5.2 compatibility, (*8)

You can even use this simple compat for any PHP version that you'd ever run into. For 5.2 or older versions, please just stop using polyfills and just upgrade your PHP version., (*9)

I get Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d error, (*10)

This is because you called count() function on a variable that cannot be counted. If you want to check if a given variable is "positive", you should be using empty() contruct instead of count()., (*11)

PHP 7.3 comes with an is_countable function that helps to mitigate such warnings by checking if the variable is countable first. For those who don't have PHP 7.3 yet, this polyfill will add the same functionality in user-land code., (*12)

Can I remove this package when I upgrade to PHP 7.3 or later?, (*13)

Yes. If you require PHP 7.3 or later as the minimum supported PHP version, you do not need to use this package. To remove it:, (*14)

composer remove ayesh/is_countable-polyfill, (*15)

The Versions

17/06 2018

dev-master

9999999-dev

A trivial but working polyfill for PHP 7.3 is_countable function. Supports PHP versions >= 5.3

  Sources   Download

MIT and GPL-3.0+

The Requires

  • php >=5.3

 

The Development Requires

portable shim polyfill compatibility compat port php73

17/06 2018

v1.0.7

1.0.7.0

A trivial but working polyfill for PHP 7.3 is_countable function. Supports PHP versions >= 5.3

  Sources   Download

MIT and GPL-3.0+

The Requires

  • php >=5.3

 

The Development Requires

portable shim polyfill compatibility compat port php73

17/06 2018

v1.0.6

1.0.6.0

A trivial but working polyfill for PHP 7.3 is_countable function.

  Sources   Download

MIT and GPL-3.0+

The Requires

  • php >=5.3

 

The Development Requires

portable shim polyfill compatibility compat port php73

05/05 2018

v1.0.4

1.0.4.0

A trivial but working polyfill for PHP 7.3 is_countable function.

  Sources   Download

MIT and GPL-3.0+

The Requires

  • php >=5.3

 

The Development Requires

portable shim polyfill compatibility compat port php73

25/03 2018

v1.0.3

1.0.3.0

A trivial but working polyfill for PHP 7.3 is_countable function.

  Sources   Download

MIT and GPL-3.0+

The Requires

  • php >=5.3

 

The Development Requires

portable shim polyfill compatibility compat port php73

22/03 2018

v1.0.2

1.0.2.0

A trivial but working polyfill for PHP 7.3 is_countable function.

  Sources   Download

MIT and GPL-3.0+

The Requires

  • php >=5.3

 

The Development Requires

by Ayesh Karunatatne

portable shim polyfill compatibility compat port php73

22/03 2018

v1.0.1

1.0.1.0

A trivial but working polyfill for PHP 7.3 is_countable function.

  Sources   Download

MIT and GPL-3.0+

The Requires

  • php >=5.3

 

The Development Requires

by Ayesh Karunatatne

portable shim polyfill compatibility compat port php73

22/03 2018

v1.0.0

1.0.0.0

A trivial but working polyfill for PHP 7.3 is_countable function.

  Sources   Download

MIT and GPL-3.0+

The Requires

  • php >=5.3

 

The Development Requires

by Ayesh Karunatatne

portable shim polyfill compatibility compat port php73