Skip to content

Commit

Permalink
Put back the lost bootstrap.php files and some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
szepeviktor committed Jul 31, 2023
1 parent 12a9021 commit 9d6f3cd
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 28 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ tests/_data/*
!tests/acceptance
!tests/functional
!tests/unit
!tests/phpstan
!tests/wpunit
!tests/_output
tests/_output/*
Expand Down
9 changes: 5 additions & 4 deletions inc/class-helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,11 @@ function( $taxononomies_to_skip ) use ( $taxonomy_slug ) {
* @since 2.0
* @since 3.3 Respects gravatar setting in discussion settings.
*
* @param string $email email address
* @param int $size Size of the avatar image
* @param string $default URL to a default image to use if no avatar is available
* @param string $alt Alternative text to use in image tag. Defaults to blank
* @param string $email email address
* @param string $size Size of the avatar image
* @param string $default URL to a default image to use if no avatar is available
* @param string|false $alt Alternative text to use in image tag. Defaults to blank
* @param array $args Avatar arguments
* @return string The img element for the user's avatar
*/
public static function get_avatar( $email, $size = '96', $default = '', $alt = false, $args = array() ) {
Expand Down
4 changes: 2 additions & 2 deletions loggers/class-media-logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public function loaded() {
*
* @since 2.0.21
*
* @param int $id ID of the new attachment.
* @param array $args An array of arguments to add the attachment.
* @param int $attachment_id ID of the new attachment.
* @param array $args An array of arguments to add the attachment.
*/
public function on_mw_new_media_object( $attachment_id, $args ) {
$attachment_post = get_post( $attachment_id );
Expand Down
2 changes: 1 addition & 1 deletion loggers/class-plugin-acf-logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function prevent_second_acf_field_group_post_save_log( $ok_to_log, $new_s
*
* Called when ACF saves a post.
*
* @param mixed int $post_id ID of post that is being saved. string "option" or "options" when saving an options page.
* @param mixed $post_id ID of post that is being saved. String "option" or "options" when saving an options page.
*/
public function on_acf_save_post( $post_id ) {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
Expand Down
7 changes: 3 additions & 4 deletions loggers/class-plugin-logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -690,10 +690,9 @@ public function remove_saved_versions() {
* Called when plugins is updated or installed
* Called from class-wp-upgrader.php
*
* @param Plugin_Upgrader $this Plugin_Upgrader instance. In other contexts, $this, might
* be a Theme_Upgrader or Core_Upgrade instance.
* @param array $data {
* Array of bulk item update data.
* @param Plugin_Upgrader $plugin_upgrader_instance Plugin_Upgrader instance. In other contexts, $this, might
* be a Theme_Upgrader or Core_Upgrade instance.
* @param array $arr_data Array of bulk item update data.
*/
public function on_upgrader_process_complete( $plugin_upgrader_instance, $arr_data ) {
// Can't use get_plugins() here to get version of plugins updated from
Expand Down
4 changes: 2 additions & 2 deletions loggers/class-post-logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public function on_untrash_post( $post_id ) {
/**
* Fired immediately before a post is deleted from the database.
*
* @param int $postid Post ID.
* @param int $post_id Post ID.
*/
public function on_delete_post( $post_id ) {
$post = get_post( $post_id );
Expand Down Expand Up @@ -452,7 +452,7 @@ public function get_skip_posttypes() {
/**
* Check if post type is ok to log by logger
*
* @param Int or WP_Post $post Post the check.
* @param \WP_Post|int $post Post the check.
*
* @return bool
*/
Expand Down
6 changes: 3 additions & 3 deletions loggers/class-privacy-logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ public function on_user_request_action_confirmed( $request_id ) {
* Used to catch data export request actions from screen at
* /wp-admin/export-personal-data.php
*
* @param int $post_ID Post ID.
* @param WP_Post $post Post object.
* @param bool $update Whether this is an existing post being updated or not.
* @param int $post_ID Post ID.
* @param \WP_Post $post Post object.
* @param bool $update Whether this is an existing post being updated or not.
*/
public function on_save_post_user_request( $post_ID, $post, $update ) {
if ( empty( $post_ID ) ) {
Expand Down
14 changes: 7 additions & 7 deletions loggers/class-theme-logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ public function on_action_deleted_theme( $stylesheet, $deleted ) {
/**
* Log theme updated.
*
* @param WP_Upgrader $upgrader_instance WP_Upgrader instance.
* @param array $arr_data Array of bulk item update data.
* @param \WP_Upgrader $upgrader_instance WP_Upgrader instance.
* @param array $arr_data Array of bulk item update data.
*/
public function on_upgrader_process_complete_theme_update( $upgrader_instance = null, $arr_data = null ) {

Expand Down Expand Up @@ -274,8 +274,8 @@ public function on_upgrader_process_complete_theme_update( $upgrader_instance =
/**
* Log theme installation.
*
* @param WP_Upgrader $upgrader_instance WP_Upgrader instance.
* @param array $arr_data Array of bulk item update data.
* @param \WP_Upgrader $upgrader_instance WP_Upgrader instance.
* @param array $arr_data Array of bulk item update data.
* @return void
*/
public function on_upgrader_process_complete_theme_install( $upgrader_instance = null, $arr_data = null ) {
Expand Down Expand Up @@ -887,7 +887,7 @@ public function on_action_sidebar_admin_setup__detect_widget_delete() {
* Get a sidebar by id
*
* @param string $sidebar_id ID of sidebar.
* @return sidebar info or false on failure.
* @return string|false sidebar info or false on failure.
*/
public function getSidebarById( $sidebar_id ) {

Expand All @@ -912,8 +912,8 @@ public function getSidebarById( $sidebar_id ) {
/**
* Get an widget by id's id_base
*
* @param string $id_base
* @return wp_widget object or false on failure
* @param string $widget_id_base
* @return \WP_Widget|false wp_widget object or false on failure
*/
public function getWidgetByIdBase( $widget_id_base ) {

Expand Down
10 changes: 5 additions & 5 deletions loggers/class-user-logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,8 @@ public function onRetrievePasswordMessage( $message, $key, $user_login, $user_da
/**
* Fired before the password reset procedure is validated.
*
* @param object $errors WP Error object.
* @param WP_User|WP_Error $user WP_User object if the login and reset key match. WP_Error object otherwise.
* @param \WP_Error $errors WP Error object.
* @param \WP_User|\WP_Error $user WP_User object if the login and reset key match. WP_Error object otherwise.
*/
public function onValidatePasswordReset( $errors, $user ) {
$context = array();
Expand Down Expand Up @@ -739,9 +739,9 @@ public function on_user_register( $user_id, $userdata = array() ) {
/**
* Log failed login attempt to username that exists
*
* @param \WP_User|\WP_Error $user The WP_User object of the user being edited,
* or a WP_Error object if validation has already failed.
* @param string $password
* @param \WP_User|\WP_Error $userOrError The WP_User object of the user being edited,
* or a WP_Error object if validation has already failed.
* @param string $password
*/
public function onWpAuthenticateUser( $userOrError, $password ) {

Expand Down
11 changes: 11 additions & 0 deletions tests/phpstan/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

define('SIMPLE_HISTORY_BASENAME', 'simple-history');
define('SIMPLE_HISTORY_PATH', './');
define('SIMPLE_HISTORY_DIR_URL', '/');

// No core function to read these.
define('DB_NAME', 'db');
define('WPINC', 'includes');
define('WP_PLUGIN_DIR', 'plugins');
define('WP_LANG_DIR', 'languages');

0 comments on commit 9d6f3cd

Please sign in to comment.