Skip to content

Commit

Permalink
php 8.4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
AnourValar committed Nov 28, 2024
1 parent 8cd91a7 commit abc34d6
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 18 deletions.
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/tests export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php-cs-fixer.php export-ignore
phpcs.xml export-ignore
phpstan.neon export-ignore
phpunit.xml export-ignore
psalm.xml export-ignore
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.phpunit.cache/
vendor/
composer.lock
.php-cs-fixer.cache
4 changes: 2 additions & 2 deletions src/CrudService.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class CrudService
* @param \Illuminate\Database\Eloquent\Model $model
* @param mixed $request
* @param mixed $createTriggerFields
* @param callable $mutator
* @param callable|null $mutator
* @param mixed $validatePrefix
* @throws \LogicException
* @return array
Expand All @@ -19,7 +19,7 @@ public function execute(
\Illuminate\Database\Eloquent\Model $model,
$request,
$createTriggerFields = null,
callable $mutator = null,
?callable $mutator = null,
$validatePrefix = null
): array {
$counters = ['deleted' => 0, 'created' => 0, 'updated' => 0, 'affected' => 0];
Expand Down
4 changes: 2 additions & 2 deletions src/Features/ManyToManyTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ trait ManyToManyTrait
* @param \Illuminate\Database\Eloquent\Model $model
* @param string $column
* @param string $relation
* @param string $key
* @param string|null $key
* @return void
*/
protected function onChangedM2M(Model $model, string $column, string $relation, string $key = null): void
protected function onChangedM2M(Model $model, string $column, string $relation, ?string $key = null): void
{
$sync = [];

Expand Down
14 changes: 7 additions & 7 deletions src/ModelTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ protected function asJson($value)
* Save validation
*
* @param mixed $prefix
* @param array $additionalRules
* @param array $additionalAttributeNames
* @param array|null $additionalRules
* @param array|null $additionalAttributeNames
* @return \Illuminate\Database\Eloquent\Model
*/
public function validate($prefix = null, array $additionalRules = null, array $additionalAttributeNames = null)
public function validate($prefix = null, ?array $additionalRules = null, ?array $additionalAttributeNames = null)
{
if ($additionalAttributeNames) {
$defaultAttributeNames = $this->getAttributeNames();
Expand Down Expand Up @@ -228,11 +228,11 @@ public function validate($prefix = null, array $additionalRules = null, array $a
* Delete validation
*
* @param mixed $prefix
* @param array $additionalRules
* @param array $additionalAttributeNames
* @param array|null $additionalRules
* @param array|null $additionalAttributeNames
* @return \Illuminate\Database\Eloquent\Model
*/
public function validateDelete($prefix = null, array $additionalRules = null, array $additionalAttributeNames = null)
public function validateDelete($prefix = null, ?array $additionalRules = null, ?array $additionalAttributeNames = null)
{
if ($additionalAttributeNames) {
$defaultAttributeNames = $this->getAttributeNames();
Expand Down Expand Up @@ -375,7 +375,7 @@ public function scopeAddPublishFields(): void
* @param string|null $relation
* @return \Illuminate\Support\HigherOrderTapProxy<\Illuminate\Database\Eloquent\Model>
*/
public function authorize($abilities, string $relation = null)
public function authorize($abilities, ?string $relation = null)
{
if (isset($abilities)) {
$arg = $this;
Expand Down
10 changes: 5 additions & 5 deletions src/ValidatorHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ public function afterValidate(\Illuminate\Validation\Validator $validator, calla
*/
public function mutateArray(
mixed $value,
array $nullable = null,
array $purges = null,
array $types = null,
array $sorts = null,
array $lists = null,
?array $nullable = null,
?array $purges = null,
?array $types = null,
?array $sorts = null,
?array $lists = null,
array $parentKeys = []
): mixed {
if (! $parentKeys) {
Expand Down
4 changes: 2 additions & 2 deletions src/resources/model.stub
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,10 @@ class DummyClass extends Model
* ACL
*
* @param \Illuminate\Database\Eloquent\Builder $builder
* @param \App\User $user
* @param \App\User|null $user
* @return void
*/
public function scopeAcl(\Illuminate\Database\Eloquent\Builder $builder, \App\User $user = null): void // @TODO
public function scopeAcl(\Illuminate\Database\Eloquent\Builder $builder, ?\App\User $user = null): void // @TODO
{
if (! $user) {
$user = \Auth::user();
Expand Down

0 comments on commit abc34d6

Please sign in to comment.