Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: increase phpstan to level 2 #239

Merged
merged 2 commits into from Aug 1, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
@@ -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
@@ -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
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
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