Skip to content

Commit

Permalink
Merge pull request #848 from erikn69/phpstan-fix
Browse files Browse the repository at this point in the history
PhpStan fixes
  • Loading branch information
MortenDHansen committed Aug 24, 2023
2 parents 8b9c5bd + aa77d40 commit 6421f6a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Audit.php
Expand Up @@ -289,6 +289,6 @@ public function getModified(bool $json = false, int $options = 0, int $depth = 5
*/
public function getTags(): array
{
return preg_split('/,/', $this->tags, null, PREG_SPLIT_NO_EMPTY);
return preg_split('/,/', $this->tags, -1, PREG_SPLIT_NO_EMPTY);
}
}
3 changes: 1 addition & 2 deletions src/Console/InstallCommand.php
Expand Up @@ -3,7 +3,6 @@
namespace OwenIt\Auditing\Console;

use Illuminate\Console\Command;
use Illuminate\Container\Container;
use Illuminate\Support\Str;

class InstallCommand extends Command
Expand Down Expand Up @@ -41,7 +40,7 @@ public function handle()
*/
protected function registerAuditingServiceProvider()
{
$namespace = Str::replaceLast('\\', '', Container::getInstance()->getNamespace());
$namespace = Str::replaceLast('\\', '', app()->getNamespace());

$appConfig = file_get_contents(config_path('app.php'));

Expand Down
3 changes: 3 additions & 0 deletions src/Contracts/Audit.php
Expand Up @@ -2,6 +2,9 @@

namespace OwenIt\Auditing\Contracts;

/**
* @mixin \OwenIt\Auditing\Models\Audit
*/
interface Audit
{
/**
Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/Auditable.php
Expand Up @@ -9,7 +9,7 @@ interface Auditable
/**
* Auditable Model audits.
*
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<OwenIt\Auditing\Contracts\Audit>
* @return MorphMany<\OwenIt\Auditing\Models\Audit>
*/
public function audits(): MorphMany;

Expand Down
2 changes: 0 additions & 2 deletions src/Events/AuditCustom.php
Expand Up @@ -17,8 +17,6 @@ class AuditCustom
* Create a new Auditing event instance.
*
* @param \OwenIt\Auditing\Contracts\Auditable $model
* @param array $old
* @param array $new
*/
public function __construct(Auditable $model)
{
Expand Down
8 changes: 8 additions & 0 deletions src/Models/Audit.php
Expand Up @@ -4,6 +4,14 @@

use Illuminate\Database\Eloquent\Model;

/**
* @property string $tags
* @property string $event
* @property array $new_values
* @property array $old_values
* @property mixed $user
* @property mixed $auditable.
*/
class Audit extends Model implements \OwenIt\Auditing\Contracts\Audit
{
use \OwenIt\Auditing\Audit;
Expand Down

0 comments on commit 6421f6a

Please sign in to comment.