Skip to content
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
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
},
"require": {
"php": "^8.4",
"brightnucleus/config": "^0.5",
"composer/installers": "^2"
},
"require-dev": {
Expand Down
74 changes: 0 additions & 74 deletions config/defaults.php

This file was deleted.

13 changes: 4 additions & 9 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@
# The WordPress stubs and rules are loaded automatically from
# szepeviktor/phpstan-wordpress via phpstan/extension-installer.
#
# views/ and config/ are deliberately not analysed: those files are pulled in
# via include/require and rely on variables injected into their scope at
# runtime (template data, plugin constants), which PHPStan cannot see.
#
# Level 8 is the ceiling for this codebase: level 9 adds checkExplicitMixed,
# which fights the untyped boundary of config-driven WordPress code — the
# BrightNucleus Config accessors return mixed by design. Revisit if the
# config ever gains a typed accessor layer.
# views/ are deliberately not analysed: those files are pulled in via require
# and rely on variables injected into their scope at runtime (template data),
# which PHPStan cannot see.
parameters:
level: 8
level: max
paths:
- plugin-slug.php
- src
16 changes: 2 additions & 14 deletions plugin-slug.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,11 @@

namespace Gamajo\PluginSlug;

use BrightNucleus\Config\ConfigFactory;

// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}

if ( ! defined( 'PLUGIN_SLUG_FILE' ) ) {
define( 'PLUGIN_SLUG_FILE', __FILE__ );
}

if ( ! defined( 'PLUGIN_SLUG_DIR' ) ) {
define( 'PLUGIN_SLUG_DIR', plugin_dir_path( __FILE__ ) );
}

// Load Composer autoloader.
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require_once __DIR__ . '/vendor/autoload.php';
Expand All @@ -70,10 +60,8 @@ static function (): void {
function plugin_slug(): Plugin {
static $plugin = null;

if ( null === $plugin ) {
$plugin = new Plugin(
ConfigFactory::create( __DIR__ . '/config/defaults.php' )->getSubConfig( 'Gamajo\PluginSlug' )
);
if ( ! $plugin instanceof Plugin ) {
$plugin = new Plugin( __FILE__ );
}

return $plugin;
Expand Down
Loading