Skip to content

Commit

Permalink
[PHP8.4] Deprecate implicitly nullable parameter types (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
heelc29 authored Aug 16, 2024
1 parent a8c4e7e commit 5383294
Show file tree
Hide file tree
Showing 20 changed files with 38 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Tests/DbUnit/DataSet/QueryTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace Joomla\Entity\Tests\DbUnit\DataSet;

use PDO;
use Joomla\Entity\Tests\DbUnit\Database\Connection;
use PDO;

/**
* Provides the functionality to represent a database table.
Expand Down
6 changes: 3 additions & 3 deletions Tests/DbUnit/Database/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

namespace Joomla\Entity\Tests\DbUnit\Database;

use PDO;
use Joomla\Entity\Tests\DbUnit\Database\Metadata\Metadata;
use Joomla\Entity\Tests\DbUnit\DataSet\IDataSet;
use Joomla\Entity\Tests\DbUnit\DataSet\ITable;
use PDO;

/**
* Provides a basic interface for communicating with a database.
Expand All @@ -31,11 +31,11 @@ public function close();
* names are specified then it will created a dataset over the entire
* database.
*
* @param array $tableNames
* @param array|null $tableNames
*
* @return IDataSet
*/
public function createDataSet(array $tableNames = null);
public function createDataSet(?array $tableNames = null);

/**
* Creates a table with the result of the specified SQL statement.
Expand Down
3 changes: 2 additions & 1 deletion Tests/DbUnit/Database/DataSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ class DataSet extends AbstractDataSet
* Creates the query necessary to pull all of the data from a table.
*
* @param ITableMetadata $tableMetaData
* @param Connection|null $databaseConnection
*
* @return string
*/
public static function buildTableSelect(ITableMetadata $tableMetaData, Connection $databaseConnection = null)
public static function buildTableSelect(ITableMetadata $tableMetaData, ?Connection $databaseConnection = null)
{
if ($tableMetaData->getTableName() == '') {
$e = new RuntimeException('Empty Table Name');
Expand Down
6 changes: 3 additions & 3 deletions Tests/DbUnit/Database/DefaultConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

namespace Joomla\Entity\Tests\DbUnit\Database;

use PDO;
use Joomla\Entity\Tests\DbUnit\Database\Metadata\AbstractMetadata;
use Joomla\Entity\Tests\DbUnit\Database\Metadata\Metadata;
use Joomla\Entity\Tests\DbUnit\DataSet\IDataSet;
use Joomla\Entity\Tests\DbUnit\DataSet\QueryTable;
use PDO;

/**
* Provides a basic interface for communicating with a database.
Expand Down Expand Up @@ -81,13 +81,13 @@ public function getSchema()
* names are specified then it will created a dataset over the entire
* database.
*
* @param array $tableNames
* @param array|null $tableNames
*
* @return IDataSet
*
* @todo Implement the filtered data set.
*/
public function createDataSet(array $tableNames = null)
public function createDataSet(?array $tableNames = null)
{
if (empty($tableNames)) {
return new DataSet($this);
Expand Down
2 changes: 1 addition & 1 deletion Tests/DbUnit/Database/Metadata/AbstractMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace Joomla\Entity\Tests\DbUnit\Database\Metadata;

use PDO;
use Joomla\Entity\Tests\DbUnit\RuntimeException;
use PDO;
use ReflectionClass;

/**
Expand Down
4 changes: 2 additions & 2 deletions Tests/DbUnit/Database/ResultSetTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

namespace Joomla\Entity\Tests\DbUnit\Database;

use PDO;
use PDOStatement;
use Joomla\Entity\Tests\DbUnit\DataSet\AbstractTable;
use Joomla\Entity\Tests\DbUnit\DataSet\DefaultTableMetadata;
use PDO;
use PDOStatement;

/**
* Provides the functionality to represent a database result set as a DBUnit
Expand Down
2 changes: 1 addition & 1 deletion Tests/DbUnit/Database/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

namespace Joomla\Entity\Tests\DbUnit\Database;

use PDO;
use Joomla\Entity\Tests\DbUnit\DataSet\AbstractTable;
use Joomla\Entity\Tests\DbUnit\DataSet\ITableMetadata;
use PDO;

/**
* Provides the functionality to represent a database table.
Expand Down
2 changes: 1 addition & 1 deletion Tests/DbUnit/Operation/DeleteAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

namespace Joomla\Entity\Tests\DbUnit\Operation;

use PDOException;
use Joomla\Entity\Tests\DbUnit\Database\Connection;
use Joomla\Entity\Tests\DbUnit\DataSet\IDataSet;
use Joomla\Entity\Tests\DbUnit\DataSet\ITable;
use PDOException;

/**
* Deletes all rows from all tables in a dataset.
Expand Down
4 changes: 2 additions & 2 deletions Tests/DbUnit/Operation/Truncate.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

namespace Joomla\Entity\Tests\DbUnit\Operation;

use PDO;
use PDOException;
use Joomla\Entity\Tests\DbUnit\Database\Connection;
use Joomla\Entity\Tests\DbUnit\DataSet\IDataSet;
use Joomla\Entity\Tests\DbUnit\DataSet\ITable;
use PDO;
use PDOException;

/**
* Executes a truncate against all tables in a dataset.
Expand Down
2 changes: 1 addition & 1 deletion Tests/DbUnit/TestCaseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Joomla\Entity\Tests\DbUnit;

use PDO;
use Joomla\Entity\Tests\DbUnit\Constraint\DataSetIsEqual;
use Joomla\Entity\Tests\DbUnit\Constraint\TableIsEqual;
use Joomla\Entity\Tests\DbUnit\Constraint\TableRowCount;
Expand All @@ -25,6 +24,7 @@
use Joomla\Entity\Tests\DbUnit\DataSet\XmlDataSet;
use Joomla\Entity\Tests\DbUnit\Operation\Factory;
use Joomla\Entity\Tests\DbUnit\Operation\Operation;
use PDO;

trait TestCaseTrait
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/Helpers/CollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace Joomla\Entity\Tests\Helpers;

use Joomla\Entity\Tests\Models\User;
use Joomla\Entity\Helpers\Collection;
use Joomla\Entity\Tests\Models\User;
use Joomla\Entity\Tests\Models\UserProfile;
use Joomla\Entity\Tests\SqliteCase;

Expand Down
2 changes: 1 addition & 1 deletion Tests/ModelHelpers/AttributesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

use Joomla\Entity\Exceptions\AttributeNotFoundException;
use Joomla\Entity\Helpers\Collection;
use Joomla\Entity\Model;
use Joomla\Entity\Tests\Models\User;
use Joomla\Entity\Tests\SqliteCase;
use Joomla\Entity\Model;

/**
* @since 1.0
Expand Down
2 changes: 1 addition & 1 deletion Tests/ModelHelpers/RelationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

namespace Joomla\Entity\Tests\ModelHelpers;

use Joomla\Entity\Model;
use Joomla\Entity\Tests\Models\Message;
use Joomla\Entity\Tests\Models\User;
use Joomla\Entity\Tests\SqliteCase;
use Joomla\Entity\Model;

/**
* @since 1.0
Expand Down
8 changes: 4 additions & 4 deletions src/Helpers/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
namespace Joomla\Entity\Helpers;

use ArrayAccess;
use ArrayIterator;
use Closure;
use Countable;
use Joomla\Entity\Exceptions\JsonEncodingException;
use JsonSerializable;
use IteratorAggregate;
use ArrayIterator;
use Joomla\Entity\Exceptions\JsonEncodingException;
use Joomla\Entity\Model;
use JsonSerializable;

/**
* Collection Helper class
Expand Down Expand Up @@ -241,7 +241,7 @@ public function count()
* @param Closure|null $callback callback function for sorting
* @return static
*/
public function sort(Closure $callback = null)
public function sort(?Closure $callback = null)
{
$items = $this->items;

Expand Down
6 changes: 3 additions & 3 deletions src/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
use ArrayAccess;
use BadMethodCallException;
use Closure;
use Joomla\Entity\Helpers\ArrayHelper;
use JsonSerializable;
use Joomla\Database\DatabaseDriver;
use Joomla\String\Inflector;
use Joomla\Entity\Helpers\ArrayHelper;
use Joomla\Entity\Helpers\StringHelper;
use Joomla\String\Inflector;
use Joomla\String\Normalise;
use JsonSerializable;

/**
* Base Entity class for items
Expand Down
6 changes: 3 additions & 3 deletions src/ModelHelpers/Attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@

namespace Joomla\Entity\ModelHelpers;

use Joomla\Entity\Exceptions\AttributeNotFoundException;
use Joomla\String\Normalise;
use Carbon\Carbon;
use DateTimeInterface;
use LogicException;
use Joomla\Entity\Exceptions\AttributeNotFoundException;
use Joomla\Entity\Exceptions\JsonEncodingException;
use Joomla\Entity\Helpers\ArrayHelper;
use Joomla\Entity\Helpers\StringHelper;
use Joomla\Entity\Relations\Relation;
use Joomla\String\Normalise;
use LogicException;

/**
* Attribute Trait
Expand Down
6 changes: 3 additions & 3 deletions src/ModelHelpers/Relations.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

namespace Joomla\Entity\ModelHelpers;

use Joomla\Entity\Helpers\Collection;
use Joomla\Entity\Helpers\StringHelper;
use Joomla\Entity\Model;
use Joomla\Entity\Helpers\Collection;
use Joomla\Entity\Relations\HasOne;
use Joomla\Entity\Relations\HasMany;
use Joomla\Entity\Relations\BelongsTo;
use Joomla\Entity\Relations\HasMany;
use Joomla\Entity\Relations\HasOne;
use Joomla\String\Inflector;
use Joomla\String\Normalise;

Expand Down
6 changes: 3 additions & 3 deletions src/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
namespace Joomla\Entity;

use BadMethodCallException;
use Closure;
use Joomla\Database\DatabaseDriver;
use Joomla\Database\ParameterType;
use Joomla\Entity\Exceptions\RelationNotFoundException;
use Joomla\Database\Query\LimitableInterface;
use Joomla\Database\QueryInterface;
use Joomla\Database\DatabaseDriver;
use Joomla\Entity\Exceptions\RelationNotFoundException;
use Joomla\Entity\Helpers\Collection;
use Joomla\Entity\Helpers\StringHelper;
use Joomla\Entity\Relations\Relation;
use Closure;

/**
* Base Query Class
Expand Down
2 changes: 1 addition & 1 deletion src/Relations/HasOneOrMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

namespace Joomla\Entity\Relations;

use Joomla\Entity\Helpers\Collection;
use Joomla\Entity\Model;
use Joomla\Entity\Query;
use Joomla\Entity\Helpers\Collection;

/**
* Joomla Framework Has one or many relation
Expand Down
2 changes: 1 addition & 1 deletion src/Relations/Relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
namespace Joomla\Entity\Relations;

use Closure;
use Joomla\Entity\Helpers\Collection;
use Joomla\Entity\Model;
use Joomla\Entity\Query;
use Joomla\Entity\Helpers\Collection;

/**
* Joomla Framework Base relation class
Expand Down

0 comments on commit 5383294

Please sign in to comment.