PHP8 compatibility
This commit is contained in:
parent
5abe61b90a
commit
63a02083b8
@ -318,7 +318,7 @@ function getIbanHumanReadable(Account $account)
|
|||||||
{
|
{
|
||||||
if ($account->getCountryCode() == 'FR') {
|
if ($account->getCountryCode() == 'FR') {
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/php-iban/oophp-iban.php';
|
require_once DOL_DOCUMENT_ROOT.'/includes/php-iban/oophp-iban.php';
|
||||||
$ibantoprint = preg_replace('/[^a-zA-Z0-9]/', '', $account->iban);
|
$ibantoprint = preg_replace('/[^a-zA-Z0-9]/', '', empty($account->iban)?'':$account->iban);
|
||||||
$iban = new PHP_IBAN\IBAN($ibantoprint);
|
$iban = new PHP_IBAN\IBAN($ibantoprint);
|
||||||
return $iban->HumanFormat();
|
return $iban->HumanFormat();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -414,7 +414,7 @@ if ($outputalsopricetotalwithtax) {
|
|||||||
|
|
||||||
if ($this->statut == 0 && !empty($object_rights->creer) && $action != 'selectlines') {
|
if ($this->statut == 0 && !empty($object_rights->creer) && $action != 'selectlines') {
|
||||||
$situationinvoicelinewithparent = 0;
|
$situationinvoicelinewithparent = 0;
|
||||||
if ($line->fk_prev_id != null && in_array($object->element, array('facture', 'facturedet'))) {
|
if (isset($line->fk_prev_id) && in_array($object->element, array('facture', 'facturedet'))) {
|
||||||
if ($object->type == $object::TYPE_SITUATION) { // The constant TYPE_SITUATION exists only for object invoice
|
if ($object->type == $object::TYPE_SITUATION) { // The constant TYPE_SITUATION exists only for object invoice
|
||||||
// Set constant to disallow editing during a situation cycle
|
// Set constant to disallow editing during a situation cycle
|
||||||
$situationinvoicelinewithparent = 1;
|
$situationinvoicelinewithparent = 1;
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace Stripe;
|
namespace Stripe;
|
||||||
|
|
||||||
|
use Traversable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Collection.
|
* Class Collection.
|
||||||
*
|
*
|
||||||
@ -47,7 +49,7 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
|
|||||||
$this->filters = $filters;
|
$this->filters = $filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetGet($k)
|
public function offsetGet($k): mixed
|
||||||
{
|
{
|
||||||
if (\is_string($k)) {
|
if (\is_string($k)) {
|
||||||
return parent::offsetGet($k);
|
return parent::offsetGet($k);
|
||||||
@ -107,7 +109,7 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
|
|||||||
/**
|
/**
|
||||||
* @return int the number of objects in the current page
|
* @return int the number of objects in the current page
|
||||||
*/
|
*/
|
||||||
public function count()
|
public function count(): int
|
||||||
{
|
{
|
||||||
return \count($this->data);
|
return \count($this->data);
|
||||||
}
|
}
|
||||||
@ -116,7 +118,7 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
|
|||||||
* @return \ArrayIterator an iterator that can be used to iterate
|
* @return \ArrayIterator an iterator that can be used to iterate
|
||||||
* across objects in the current page
|
* across objects in the current page
|
||||||
*/
|
*/
|
||||||
public function getIterator()
|
public function getIterator(): Traversable
|
||||||
{
|
{
|
||||||
return new \ArrayIterator($this->data);
|
return new \ArrayIterator($this->data);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -194,28 +194,28 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ArrayAccess methods
|
// ArrayAccess methods
|
||||||
public function offsetSet($k, $v)
|
public function offsetSet($k, $v): void
|
||||||
{
|
{
|
||||||
$this->{$k} = $v;
|
$this->{$k} = $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetExists($k)
|
public function offsetExists($k): bool
|
||||||
{
|
{
|
||||||
return \array_key_exists($k, $this->_values);
|
return \array_key_exists($k, $this->_values);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetUnset($k)
|
public function offsetUnset($k): void
|
||||||
{
|
{
|
||||||
unset($this->{$k});
|
unset($this->{$k});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetGet($k)
|
public function offsetGet($k): mixed
|
||||||
{
|
{
|
||||||
return \array_key_exists($k, $this->_values) ? $this->_values[$k] : null;
|
return \array_key_exists($k, $this->_values) ? $this->_values[$k] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Countable method
|
// Countable method
|
||||||
public function count()
|
public function count(): int
|
||||||
{
|
{
|
||||||
return \count($this->_values);
|
return \count($this->_values);
|
||||||
}
|
}
|
||||||
@ -419,7 +419,7 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function jsonSerialize()
|
public function jsonSerialize(): mixed
|
||||||
{
|
{
|
||||||
return $this->toArray();
|
return $this->toArray();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace Stripe\Util;
|
namespace Stripe\Util;
|
||||||
|
|
||||||
|
use Traversable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CaseInsensitiveArray is an array-like class that ignores case for keys.
|
* CaseInsensitiveArray is an array-like class that ignores case for keys.
|
||||||
*
|
*
|
||||||
@ -21,17 +23,17 @@ class CaseInsensitiveArray implements \ArrayAccess, \Countable, \IteratorAggrega
|
|||||||
$this->container = \array_change_key_case($initial_array, \CASE_LOWER);
|
$this->container = \array_change_key_case($initial_array, \CASE_LOWER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function count()
|
public function count(): int
|
||||||
{
|
{
|
||||||
return \count($this->container);
|
return \count($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getIterator()
|
public function getIterator(): Traversable
|
||||||
{
|
{
|
||||||
return new \ArrayIterator($this->container);
|
return new \ArrayIterator($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetSet($offset, $value)
|
public function offsetSet($offset, $value): void
|
||||||
{
|
{
|
||||||
$offset = static::maybeLowercase($offset);
|
$offset = static::maybeLowercase($offset);
|
||||||
if (null === $offset) {
|
if (null === $offset) {
|
||||||
@ -41,20 +43,20 @@ class CaseInsensitiveArray implements \ArrayAccess, \Countable, \IteratorAggrega
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetExists($offset)
|
public function offsetExists($offset): bool
|
||||||
{
|
{
|
||||||
$offset = static::maybeLowercase($offset);
|
$offset = static::maybeLowercase($offset);
|
||||||
|
|
||||||
return isset($this->container[$offset]);
|
return isset($this->container[$offset]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetUnset($offset)
|
public function offsetUnset($offset): void
|
||||||
{
|
{
|
||||||
$offset = static::maybeLowercase($offset);
|
$offset = static::maybeLowercase($offset);
|
||||||
unset($this->container[$offset]);
|
unset($this->container[$offset]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetGet($offset)
|
public function offsetGet($offset): mixed
|
||||||
{
|
{
|
||||||
$offset = static::maybeLowercase($offset);
|
$offset = static::maybeLowercase($offset);
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@ namespace Stripe\Util;
|
|||||||
|
|
||||||
use ArrayIterator;
|
use ArrayIterator;
|
||||||
use IteratorAggregate;
|
use IteratorAggregate;
|
||||||
|
use Traversable;
|
||||||
|
|
||||||
class Set implements IteratorAggregate
|
class Set implements IteratorAggregate
|
||||||
{
|
{
|
||||||
@ -37,7 +38,7 @@ class Set implements IteratorAggregate
|
|||||||
return \array_keys($this->_elts);
|
return \array_keys($this->_elts);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getIterator()
|
public function getIterator(): Traversable
|
||||||
{
|
{
|
||||||
return new ArrayIterator($this->toArray());
|
return new ArrayIterator($this->toArray());
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user