Skip to content

Commit

Permalink
Merge pull request #17 from wp-oop/task/scan-local-mods-with-psalm
Browse files Browse the repository at this point in the history
Fix errors reported by Psalm
  • Loading branch information
XedinUnknown authored Mar 10, 2021
2 parents bdd17f9 + ee8ea3b commit b7f692c
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 71 deletions.
14 changes: 12 additions & 2 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/plugin.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [[*next-version*]] - YYYY-MM-DD
### Fixed
- Errors in local modules (#17).

### Changed
- Depend on WP stubs instead of WP itself (#17).
- Actually use the stubs in Psalm (#17).

### Added
- Local modules are now scanned by Psalm (#17).
- PHPStorm will now use PHPCS via remote interpreter (#17).

## [0.2.0-alpha1] - 2021-03-10
### Added
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
},
"require-dev": {
"phpunit/phpunit": "^7.0 | ^8.0 | ^9.0",
"johnpbloch/wordpress-core": "^5.0@stable",
"vimeo/psalm": "^3.11.7 | ^4.0",
"slevomat/coding-standard": "^6.0",
"webmozart/path-util": "^2.3@stable"
"webmozart/path-util": "^2.3@stable",
"php-stubs/wordpress-stubs": "^5.0@stable"
},
"autoload": {
"psr-4": {
Expand Down
108 changes: 52 additions & 56 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions modules.local/core/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
$rootDir = dirname($mainFile);
$moduleDir = dirname(__FILE__);
$moduleIncDir = "$moduleDir/inc";
/** @psalm-suppress UnresolvableInclude */
$factories = (require "$moduleIncDir/factories.php")($rootDir, $mainFile);
/** @psalm-suppress UnresolvableInclude */
$extensions = (require "$moduleIncDir/extensions.php")($rootDir, $mainFile);
$provider = new ServiceProvider($factories, $extensions);
$module = new Module($provider);
Expand Down
3 changes: 3 additions & 0 deletions modules.local/core/src/FilePathPluginFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use WpOop\WordPress\Plugin\FilePathPluginFactoryInterface;
use WpOop\WordPress\Plugin\PluginInterface;

use function plugin_basename;
use function get_plugin_data;

/**
* Creates a plugin from plugin basename.
*/
Expand Down
5 changes: 0 additions & 5 deletions modules.local/core/src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ class Plugin implements PluginInterface
*/
protected $textDomain;

/**
* @var string
*/
protected $slug;

/**
* @var VersionInterface
*/
Expand Down
8 changes: 4 additions & 4 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
>
<projectFiles>
<directory name="src"/>
<directory name="modules.local"/>
</projectFiles>

<extraFiles>
<directory name="vendor/johnpbloch/wordpress-core/wp-includes" />
<directory name="vendor/johnpbloch/wordpress-core/wp-admin/includes" />
</extraFiles>
<stubs>
<file name="vendor/php-stubs/wordpress-stubs/wordpress-stubs.php" />
</stubs>


<issueHandlers>
Expand Down

0 comments on commit b7f692c

Please sign in to comment.