Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhpStan fixes #848

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Audit.php
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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