Skip to content

Commit

Permalink
chore: add property annotations to models
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Jan 3, 2025
1 parent 8b815e7 commit 3851745
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 142 deletions.
140 changes: 0 additions & 140 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ parameters:
count: 1
path: src/AutomationRules/Actions/SendMailTemplate.php

-
message: "#^Call to an undefined static method Igniter\\\\System\\\\Models\\\\MailTemplate\\:\\:dropdown\\(\\)\\.$#"
count: 1
path: src/AutomationRules/Actions/SendMailTemplate.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Models\\\\Customer\\:\\:whereIsEnabled\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -85,11 +80,6 @@ parameters:
count: 1
path: src/Classes/EventManager.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Support\\\\Facades\\\\Igniter\\:\\:runningInAdmin\\(\\)\\.$#"
count: 1
path: src/Classes/EventManager.php

-
message: "#^Call to an undefined static method Igniter\\\\Reservation\\\\Models\\\\Reservation\\:\\:where\\(\\)\\.$#"
count: 1
Expand All @@ -110,11 +100,6 @@ parameters:
count: 1
path: src/Extension.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Support\\\\Facades\\\\Igniter\\:\\:prunableModel\\(\\)\\.$#"
count: 1
path: src/Extension.php

-
message: "#^Cannot call method hourly\\(\\) on null\\.$#"
count: 2
Expand All @@ -135,56 +120,11 @@ parameters:
count: 1
path: src/Http/Controllers/Automations.php

-
message: "#^Call to an undefined static method Igniter\\\\Admin\\\\Facades\\\\AdminMenu\\:\\:setContext\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/Automations.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\AutomationLog\\:\\:\\$action\\.$#"
count: 1
path: src/Models/AutomationLog.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\AutomationLog\\:\\:\\$automation_rule_id\\.$#"
count: 2
path: src/Models/AutomationLog.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\AutomationLog\\:\\:\\$created_at\\.$#"
count: 1
path: src/Models/AutomationLog.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\AutomationLog\\:\\:\\$exception\\.$#"
count: 1
path: src/Models/AutomationLog.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\AutomationLog\\:\\:\\$is_success\\.$#"
count: 2
path: src/Models/AutomationLog.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\AutomationLog\\:\\:\\$message\\.$#"
count: 1
path: src/Models/AutomationLog.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\AutomationLog\\:\\:\\$params\\.$#"
count: 1
path: src/Models/AutomationLog.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\AutomationLog\\:\\:\\$rule_action_id\\.$#"
count: 2
path: src/Models/AutomationLog.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\RuleAction\\:\\:\\$automation_rule_id\\.$#"
count: 1
path: src/Models/AutomationLog.php

-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 1
Expand All @@ -195,97 +135,17 @@ parameters:
count: 1
path: src/Models/AutomationRule.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\AutomationRule\\:\\:\\$code\\.$#"
count: 1
path: src/Models/AutomationRule.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\AutomationRule\\:\\:\\$conditions\\.$#"
count: 2
path: src/Models/AutomationRule.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\AutomationRule\\:\\:\\$event_class\\.$#"
count: 4
path: src/Models/AutomationRule.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\AutomationRule\\:\\:\\$is_custom\\.$#"
count: 1
path: src/Models/AutomationRule.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\AutomationRule\\:\\:\\$name\\.$#"
count: 1
path: src/Models/AutomationRule.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\AutomationRule\\:\\:\\$status\\.$#"
count: 1
path: src/Models/AutomationRule.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\RuleAction\\:\\:\\$automation_rule_id\\.$#"
count: 1
path: src/Models/AutomationRule.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\RuleAction\\:\\:\\$class_name\\.$#"
count: 1
path: src/Models/AutomationRule.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\RuleAction\\:\\:\\$options\\.$#"
count: 1
path: src/Models/AutomationRule.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\RuleCondition\\:\\:\\$automation_rule_id\\.$#"
count: 1
path: src/Models/AutomationRule.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\RuleCondition\\:\\:\\$class_name\\.$#"
count: 1
path: src/Models/AutomationRule.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\RuleCondition\\:\\:\\$options\\.$#"
count: 1
path: src/Models/AutomationRule.php

-
message: "#^Binary operation \"\\.\" between array and ' \\- ' results in an error\\.$#"
count: 1
path: src/Models/AutomationRule.php

-
message: "#^Call to an undefined static method Igniter\\\\Automation\\\\Models\\\\AutomationRule\\:\\:applyStatus\\(\\)\\.$#"
count: 1
path: src/Models/AutomationRule.php

-
message: "#^Call to an undefined static method Igniter\\\\Automation\\\\Models\\\\AutomationRule\\:\\:pluck\\(\\)\\.$#"
count: 1
path: src/Models/AutomationRule.php

-
message: "#^Call to an undefined static method Igniter\\\\Automation\\\\Models\\\\AutomationRule\\:\\:whereCode\\(\\)\\.$#"
count: 1
path: src/Models/AutomationRule.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\RuleAction\\:\\:\\$class_name\\.$#"
count: 3
path: src/Models/RuleAction.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\RuleAction\\:\\:\\$options\\.$#"
count: 2
path: src/Models/RuleAction.php

-
message: "#^Access to an undefined property Igniter\\\\Automation\\\\Models\\\\RuleCondition\\:\\:\\$class_name\\.$#"
count: 3
path: src/Models/RuleCondition.php
39 changes: 39 additions & 0 deletions src/Models/AutomationLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,45 @@
use Illuminate\Database\Eloquent\Prunable;
use Throwable;

/**
*
*
* @property int $id
* @property int|null $automation_rule_id
* @property int|null $rule_action_id
* @property bool $is_success
* @property string $message
* @property array|null $params
* @property array|null $exception
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read mixed $action_name
* @property-read mixed $created_since
* @property-read mixed $status_name
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog applyFilters(array $options = [])
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog applySorts(array $sorts = [])
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog dropdown(string $column, string $key = null)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog like(string $column, string $value, string $side = 'both', string $boolean = 'and')
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog listFrontEnd(array $options = [])
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog lists(string $column, string $key = null)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog newModelQuery()
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog newQuery()
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog orLike(string $column, string $value, string $side = 'both')
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog orSearch(string $term, string $columns = [], string $mode = 'all')
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog pluckDates(string $column, string $keyFormat = 'Y-m', string $valueFormat = 'F Y')
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog query()
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog search(string $term, string $columns = [], string $mode = 'all')
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog whereAutomationRuleId($value)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog whereCreatedAt($value)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog whereException($value)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog whereId($value)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog whereIsSuccess($value)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog whereMessage($value)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog whereParams($value)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog whereRuleActionId($value)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationLog whereUpdatedAt($value)
* @mixin \Igniter\Flame\Database\Model
*/
class AutomationLog extends Model
{
use Prunable;
Expand Down
46 changes: 44 additions & 2 deletions src/Models/AutomationRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,48 @@
use Igniter\Flame\Database\Traits\Validation;
use Throwable;

/**
*
*
* @property int $id
* @property string $name
* @property string $code
* @property string $description
* @property string|null $event_class
* @property array|null $config_data
* @property bool $is_custom
* @property bool $status
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read mixed $event_description
* @property-read mixed $event_name
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule applyClass($class)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule applyFilters(array $options = [])
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule applySorts(array $sorts = [])
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule applyStatus($status = true)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule dropdown(string $column, string $key = null)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule like(string $column, string $value, string $side = 'both', string $boolean = 'and')
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule listFrontEnd(array $options = [])
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule lists(string $column, string $key = null)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule newModelQuery()
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule newQuery()
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule orLike(string $column, string $value, string $side = 'both')
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule orSearch(string $term, string $columns = [], string $mode = 'all')
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule pluckDates(string $column, string $keyFormat = 'Y-m', string $valueFormat = 'F Y')
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule query()
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule search(string $term, string $columns = [], string $mode = 'all')
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule whereCode($value)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule whereConfigData($value)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule whereCreatedAt($value)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule whereDescription($value)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule whereEventClass($value)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule whereId($value)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule whereIsCustom($value)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule whereName($value)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule whereStatus($value)
* @method static \Igniter\Flame\Database\Builder<static>|AutomationRule whereUpdatedAt($value)
* @mixin \Igniter\Flame\Database\Model
*/
class AutomationRule extends Model
{
use Purgeable;
Expand Down Expand Up @@ -213,8 +255,8 @@ public static function createFromPreset($code, $preset)
}

$automation = new self;
$automation->status = 0;
$automation->is_custom = 0;
$automation->status = false;
$automation->is_custom = false;
$automation->code = $code;
$automation->name = array_get($preset, 'name');
$automation->event_class = array_get($preset, 'event');
Expand Down
32 changes: 32 additions & 0 deletions src/Models/RuleAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,38 @@
use Igniter\Flame\Database\Model;
use Igniter\Flame\Database\Traits\Validation;

/**
*
*
* @property int $id
* @property int|null $automation_rule_id
* @property string $class_name
* @property array $options
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read mixed $description
* @property-read mixed $name
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction applyFilters(array $options = [])
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction applySorts(array $sorts = [])
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction dropdown(string $column, string $key = null)
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction like(string $column, string $value, string $side = 'both', string $boolean = 'and')
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction listFrontEnd(array $options = [])
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction lists(string $column, string $key = null)
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction newModelQuery()
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction newQuery()
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction orLike(string $column, string $value, string $side = 'both')
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction orSearch(string $term, string $columns = [], string $mode = 'all')
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction pluckDates(string $column, string $keyFormat = 'Y-m', string $valueFormat = 'F Y')
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction query()
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction search(string $term, string $columns = [], string $mode = 'all')
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction whereAutomationRuleId($value)
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction whereClassName($value)
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction whereCreatedAt($value)
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction whereId($value)
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction whereOptions($value)
* @method static \Igniter\Flame\Database\Builder<static>|RuleAction whereUpdatedAt($value)
* @mixin \Igniter\Flame\Database\Model
*/
class RuleAction extends Model
{
use Validation;
Expand Down
32 changes: 32 additions & 0 deletions src/Models/RuleCondition.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,38 @@

use Igniter\Flame\Database\Model;

/**
*
*
* @property int $id
* @property int|null $automation_rule_id
* @property string $class_name
* @property array $options
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read mixed $description
* @property-read mixed $name
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition applyFilters(array $options = [])
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition applySorts(array $sorts = [])
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition dropdown(string $column, string $key = null)
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition like(string $column, string $value, string $side = 'both', string $boolean = 'and')
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition listFrontEnd(array $options = [])
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition lists(string $column, string $key = null)
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition newModelQuery()
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition newQuery()
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition orLike(string $column, string $value, string $side = 'both')
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition orSearch(string $term, string $columns = [], string $mode = 'all')
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition pluckDates(string $column, string $keyFormat = 'Y-m', string $valueFormat = 'F Y')
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition query()
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition search(string $term, string $columns = [], string $mode = 'all')
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition whereAutomationRuleId($value)
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition whereClassName($value)
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition whereCreatedAt($value)
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition whereId($value)
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition whereOptions($value)
* @method static \Igniter\Flame\Database\Builder<static>|RuleCondition whereUpdatedAt($value)
* @mixin \Igniter\Flame\Database\Model
*/
class RuleCondition extends Model
{
/**
Expand Down

0 comments on commit 3851745

Please sign in to comment.