Skip to content

Commit 531ebb2

Browse files
chore: fix phpstan level 1 issues
1 parent d7068b9 commit 531ebb2

7 files changed

Lines changed: 37 additions & 27 deletions

File tree

phpstan.neon.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
parameters:
2-
level: 0
2+
level: 1
33
paths:
44
- boxzilla.php
55
- autoload.php

src/admin/views/metaboxes/box-appearance-controls.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
<?php defined('ABSPATH') or exit; ?>
1+
<?php defined('ABSPATH') or exit;
2+
3+
/**
4+
* Box Appearance Controls
5+
*
6+
* @var \Boxzilla\Box $box
7+
* @var array $opts
8+
*/
9+
?>
210
<div id="notice-notinymce" class="error" style="display: none;"><p><?php esc_html_e('For the best experience when styling your box, please use the default WordPress visual editor.', 'boxzilla'); ?></p></div>
311

412
<table class="form-table">

src/admin/views/settings.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
<?php defined('ABSPATH') or exit; ?>
1+
<?php defined('ABSPATH') or exit;
2+
3+
/**
4+
* Settings page
5+
*
6+
* @var array $opts
7+
*/
8+
?>
29
<div class="wrap" id="boxzilla-admin" class="boxzilla-settings">
310

411
<div class="boxzilla-row">

src/default-actions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// Register custom post type
88
add_action(
99
'init',
10-
function () use ($boxzilla) {
10+
function () {
1111
$args = [
1212
'public' => false,
1313
'labels' => [

src/licensing/class-license-manager.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
namespace Boxzilla\Licensing;
44

5-
use Boxzilla\Admin\Notices;
6-
use Boxzilla\Collection;
7-
use Exception;
8-
95
class LicenseManager
106
{
117
/**
@@ -190,6 +186,8 @@ protected function activate_license()
190186
public function show_license_form()
191187
{
192188
$license = $this->license;
189+
$extensions = $this->extensions;
190+
$notices = $this->notices;
193191
require __DIR__ . '/views/license-form.php';
194192
}
195193
}

src/licensing/class-update-manager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function get_plugin_info($result, $action = '', $args = null)
111111
}
112112

113113
/**
114-
* @param object $updates
114+
* @param null|object $updates
115115
* @return object
116116
*/
117117
public function add_updates($updates)

src/licensing/views/license-form.php

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
<?php
2+
23
// prevent direct file access
34
defined('ABSPATH') or exit;
45

5-
/** @var Boxzilla\Licensing\License $license */
6+
/**
7+
* @var Boxzilla\Licensing\License $license
8+
* @var array $notices
9+
* @var array $extensions
10+
*/
611
?>
712

813
<h2><?php esc_html_e('License & Plugin Updates', 'boxzilla'); ?></h2>
@@ -16,7 +21,7 @@
1621
</p>
1722
<ul class="ul-square">
1823
<?php
19-
foreach ($this->extensions as $p) {
24+
foreach ($extensions as $p) {
2025
echo '<li>', esc_html($p->name()), '</li>';
2126
}
2227
?>
@@ -29,15 +34,11 @@
2934
}
3035
?>
3136

32-
<?php
33-
foreach ($this->notices as $notice) {
34-
?>
35-
<div class="notice notice-<?php echo $notice['type']; ?> inline">
36-
<p><?php echo $notice['message']; ?></p>
37-
</div>
38-
<?php
39-
}
40-
?>
37+
<?php foreach ($notices as $notice) { ?>
38+
<div class="notice notice-<?php echo esc_attr($notice['type']); ?> inline">
39+
<p><?php echo $notice['message']; ?></p>
40+
</div>
41+
<?php } ?>
4142

4243
<form method="post">
4344
<table class="form-table">
@@ -49,12 +50,12 @@
4950
size="40"
5051
name="boxzilla_license_key"
5152
placeholder="<?php esc_attr_e('Enter your license key..', 'boxzilla'); ?>"
52-
value="<?php echo esc_attr($this->license->key); ?>"
53-
<?php if ($this->license->activated) {
53+
value="<?php echo esc_attr($license->key); ?>"
54+
<?php if ($license->activated) {
5455
echo 'readonly';
5556
} ?>
5657
/>
57-
<input class="button" type="submit" name="action" value="<?php echo ( $this->license->activated ) ? 'deactivate' : 'activate'; ?>" />
58+
<input class="button" type="submit" name="action" value="<?php echo $license->activated ? 'deactivate' : 'activate'; ?>" />
5859
<p class="help">
5960
<?php
6061
esc_html_e('The license key received when purchasing your premium Boxzilla plan.', 'bozilla');
@@ -80,10 +81,6 @@
8081
</td>
8182
</tr>
8283
</table>
83-
84-
85-
86-
8784
<p>
8885
<input type="submit" class="button button-primary" name="action" value="<?php esc_attr_e('Save Changes', 'boxzilla'); ?>" />
8986
</p>

0 commit comments

Comments
 (0)