Skip to content

Commit

Permalink
Merge pull request #239 from markkelnar/phpstan-level-1-fixes
Browse files Browse the repository at this point in the history
fixes for phpstan level increase strictness
  • Loading branch information
jasonbahl authored Aug 1, 2023
2 parents 4c0b73c + ce3c94c commit db29897
Show file tree
Hide file tree
Showing 14 changed files with 147 additions and 98 deletions.
97 changes: 49 additions & 48 deletions composer.lock

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

3 changes: 2 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
parameters:
level: 0
level: 2
inferPrivatePropertyTypeFromConstructor: true
checkMissingIterableValueType: false
stubFiles:
# Simulate added properties
- phpstan/class-wp-post-type.stub
- phpstan/class-wp-taxonomy.stub
- phpstan/class-wp-dependency.stub
- phpstan/appsero.stub
bootstrapFiles:
- phpstan/constants.php
- vendor/wp-graphql/wp-graphql/wp-graphql.php
Expand Down
30 changes: 30 additions & 0 deletions phpstan/appsero.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* This stub file fixes return type from appsero client class function.
**/

namespace Appsero;

/**
* Appsero Insights
*
* This is a tracker class to track plugin usage based on if the customer has opted in.
* No personal information is being tracked by this class, only general settings, active plugins, environment details
* and admin email.
*/
class Insights {}

/**
* Appsero Client
*
* This class is necessary to set project data
*/
class Client {

/**
* Initialize insights class
*
* @return \Appsero\Insights
*/
public function insights();
}
2 changes: 1 addition & 1 deletion src/Admin/Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public static function maxage_input_box_cb( $post ) {
/**
* Change the text from Excerpt to Description where it is visible.
*
* @param String The string for the __() or _e() translation
* @param String $string The string for the __() or _e() translation
* @return String The translated or original string
*/
public function translate_excerpt_text_cb( $string ) {
Expand Down
10 changes: 5 additions & 5 deletions src/Cache/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function build_key( $query_id, $query, $variables = null, $operation = nu
/**
* Get the data from cache/transient based on the provided key
*
* @param string unique id for this request
* @param string $key unique id for this request
* @return mixed|array|object|null The graphql response or null if not found
*/
public function get( $key ) {
Expand All @@ -78,9 +78,9 @@ public function get( $key ) {
/**
* Converts GraphQL query result to spec-compliant serializable array using provided function
*
* @param string unique id for this request
* @param mixed|array|object|null The graphql response
* @param int Time in seconds for the data to persist in cache. Zero means no expiration.
* @param string $key unique id for this request
* @param mixed|array|object|null $data The graphql response
* @param int $expire Time in seconds for the data to persist in cache. Zero means no expiration.
*
* @return bool False if value was not set and true if value was set.
*/
Expand All @@ -91,7 +91,7 @@ public function save( $key, $data, $expire = DAY_IN_SECONDS ) {
/**
* Delete the data from cache/transient based on the provided key
*
* @param string unique id for this request
* @param string $key unique id for this request
* @return bool True on successful removal, false on failure.
*/
public function delete( $key ) {
Expand Down
Loading

0 comments on commit db29897

Please sign in to comment.