Skip to content

Commit

Permalink
Merge branch 'master' into 90-non-static-podio-class
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-sc authored Jun 12, 2023
2 parents 4d9e8ef + ff22ba1 commit 257e052
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 12 deletions.
9 changes: 8 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
[7.0.0](#v7.0.0) / [unreleased]
==================
* BREAKING: Replace static `Podio` client with instantiable `PodioClient` class.
* BREAKING: Replace static `Podio` client with instantiable `PodioClient` class. #228

[6.1.1](#v6.1.1) / 2023-06-12
==================
* Bugfix: PodioError.php fix for null requests by @mgithens in https://github.com/podio-community/podio-php/pull/227
* Bugfix: Added missing var to PodioError.php by @mgithens in https://github.com/podio-community/podio-php/pull/226
* Bugfix: Issue#224 PHP 8.1 ArrayAccess Issue by @bbanuri in https://github.com/podio-community/podio-php/pull/229
* Bugfix: PodioLogger.php fix by @mgithens in https://github.com/podio-community/podio-php/pull/225

[6.1.0](#v6.1.0) / 2023-01-19
==================
Expand Down
9 changes: 5 additions & 4 deletions lib/PodioCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ public function count(): int
/**
* Implements IteratorAggregate
*/
public function getIterator()
public function getIterator(): ArrayIterator
{
return new ArrayIterator($this->__items);
}

/**
* Array access. Set item by offset, automatically adding relationship.
*/
public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
if (!is_a($value, 'PodioObject')) {
throw new PodioDataIntegrityError("Objects in PodioCollection must be of class PodioObject");
Expand Down Expand Up @@ -85,15 +85,15 @@ public function offsetSet($offset, $value)
/**
* Array access. Check for existence.
*/
public function offsetExists($offset)
public function offsetExists($offset): bool
{
return isset($this->__items[$offset]);
}

/**
* Array access. Unset.
*/
public function offsetUnset($offset)
public function offsetUnset($offset): void
{
if (isset($this->__items[$offset])) {
$item = $this->__items[$offset];
Expand All @@ -105,6 +105,7 @@ public function offsetUnset($offset)
/**
* Array access. Get.
*/
#[ReturnTypeWillChange] // We cannot use :mixed due to incompatibility with php 7.3, 7.4
public function offsetGet($offset)
{
return isset($this->__items[$offset]) ? $this->__items[$offset] : null;
Expand Down
4 changes: 3 additions & 1 deletion lib/PodioLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ public function enable()

public function log($text)
{
@mkdir(dirname($this->file));
if (!is_dir(dirname($this->file))) {
mkdir(dirname($this->file), 0777, true);
}
if ($fp = fopen($this->file, 'ab')) {
fwrite($fp, $text);
fclose($fp);
Expand Down
2 changes: 1 addition & 1 deletion models/PodioAppFieldCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(PodioClient $podio_client, $attributes)
/**
* Array access. Add field to collection.
*/
public function offsetSet($offset, $field)
public function offsetSet($offset, $field): void
{
if (!is_a($field, 'PodioAppField')) {
throw new PodioDataIntegrityError("Objects in PodioAppFieldCollection must be of class PodioAppField");
Expand Down
7 changes: 4 additions & 3 deletions models/PodioFieldCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct(PodioClient $podio_client, $fields)
/**
* Array access. Set fiels using external id or offset.
*/
public function offsetSet($offset, $field)
public function offsetSet($offset, $field): void
{

// Allow you to set external id in the array offset.
Expand All @@ -49,7 +49,7 @@ public function offsetSet($offset, $field)
/**
* Array access. Check for existence using external_id or offset.
*/
public function offsetExists($offset)
public function offsetExists($offset): bool
{
if (is_string($offset)) {
return $this->get($offset) ? true : false;
Expand All @@ -60,7 +60,7 @@ public function offsetExists($offset)
/**
* Array access. Unset field using external)id or offset.
*/
public function offsetUnset($offset)
public function offsetUnset($offset): void
{
if (is_string($offset)) {
$this->remove($offset);
Expand All @@ -72,6 +72,7 @@ public function offsetUnset($offset)
/**
* Array access. Get field using external_id or offset.
*/
#[ReturnTypeWillChange] // We cannot use :mixed due to incompatibility with php 7.3, 7.4
public function offsetGet($offset)
{
if (is_string($offset)) {
Expand Down
2 changes: 1 addition & 1 deletion models/PodioItemCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct(PodioClient $podio_client, $items = array(), $filter
}

// Array access
public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
if (!is_a($value, 'PodioItem')) {
throw new PodioDataIntegrityError("Objects in PodioItemCollection must be of class PodioItem");
Expand Down
2 changes: 1 addition & 1 deletion models/PodioItemFieldCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(PodioClient $podio_client, $attributes = array(), $_
/**
* Array access. Add field to collection.
*/
public function offsetSet($offset, $field)
public function offsetSet($offset, $field): void
{
if (!is_a($field, 'PodioItemField')) {
throw new PodioDataIntegrityError("Objects in PodioItemFieldCollection must be of class PodioItemField");
Expand Down

0 comments on commit 257e052

Please sign in to comment.