Skip to content

Commit

Permalink
[static-analysis] Fixes PHPStan errors minus - access to an undefined…
Browse files Browse the repository at this point in the history
… property object.
  • Loading branch information
bahiirwa committed Sep 8, 2024
1 parent c9d7089 commit 28776a0
Show file tree
Hide file tree
Showing 19 changed files with 556 additions and 133 deletions.
93 changes: 93 additions & 0 deletions .phpstan/stubs/includes/entities/class-fs-entity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?php

/**
* @param mixed $object
*
* @return array<string, mixed>
*/
function fs_get_object_public_vars($object) {
return [];
}

class FS_Entity {

/**
* @var int
*/
public $id;

/**
* @var string
*/
public $updated;

/**
* @var string
*/
public $created;

/**
* FS_Entity constructor.
* @param mixed $entity
*/
function __construct($entity = false) {
// Implementation here
}

/**
* @return string
*/
static function get_type() {
// Implementation here
return '';
}

/**
* @param mixed $entity1
* @param mixed $entity2
* @return bool
*/
static function equals($entity1, $entity2) {
// Implementation here
return false;
}

/**
* @var bool
*/
private $_is_updated = false;

/**
* @param string $key
* @param bool $val
* @return bool
*/
function update($key, $val = false) {
return false;
}

/**
* @return bool
*/
function is_updated() {
// Implementation here
return $this->_is_updated;
}

/**
* @param int $id
* @return bool
*/
static function is_valid_id($id) {
// Implementation here
return false;
}

/**
* @return string
*/
public static function get_class_name() {
// Implementation here
return '';
}
}
129 changes: 129 additions & 0 deletions .phpstan/stubs/includes/fs-plugin-info-dialog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<?php
class FS_Plugin_Plan extends FS_Entity {

/**
* @var int
*/
public $plugin_id;

/**
* @var string
*/
public $name;

/**
* @var string
*/
public $title;

/**
* @var string
*/
public $description;

/**
* @var bool
*/
public $is_free_localhost;

/**
* @var bool
*/
public $is_block_features;

/**
* @var string
*/
public $license_type;

/**
* @var bool
*/
public $is_https_support;

/**
* @var int
*/
public $trial_period;

/**
* @var bool
*/
public $is_require_subscription;

/**
* @var string
*/
public $support_kb;

/**
* @var string
*/
public $support_forum;

/**
* @var string
*/
public $support_email;

/**
* @var string
*/
public $support_phone;

/**
* @var string
*/
public $support_skype;

/**
* @var bool
*/
public $is_success_manager;

/**
* @var bool
*/
public $is_featured;

/**
* @var bool
*/
public $is_hidden;

/**
* @var array<string, mixed>
*/
public $pricing;

/**
* @var array<string, mixed>
*/
public $features;

/**
* FS_Plugin_Plan constructor.
* @param object|bool $plan
*/
public function __construct($plan = false) {}

/**
* @return string
*/
public static function get_type() {}

/**
* @return bool
*/
public function is_free() {}

/**
* @return bool
*/
public function has_technical_support() {}

/**
* @return bool
*/
public function has_trial() {}
}
Loading

0 comments on commit 28776a0

Please sign in to comment.