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

Bump phpstan/phpstan from 1.12.8 to 2.0.2 #1394

Merged
merged 5 commits into from
Nov 19, 2024
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"phpmd/phpmd": "^2.7",
"phan/phan": "^5.1",
"skaut/wordpress-stubs": "^2.2.0",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan": "^2.0",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"wp-cli/i18n-command": "^2.4"
}
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

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

8 changes: 4 additions & 4 deletions src/languages/crdm-modern.pot
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,18 @@ msgstr ""
msgid "A widget containing the site logo, title and tagline."
msgstr ""

#: php/functions.php:163
#: php/functions.php:165
msgid "CRDM - Modern theme requires at least WordPress 5.0"
msgstr ""

#: php/functions.php:176
#: php/functions.php:178
msgid "CRDM - Modern theme requires at least PHP 7.0"
msgstr ""

#: php/functions.php:188
#: php/functions.php:190
msgid "CRDM - Modern theme requires GeneratePress Premium"
msgstr ""

#: php/functions.php:200
#: php/functions.php:202
msgid "Failed to copy CRDM - Modern theme images to WordPress Media. The theme will work fine, but you won't be able to re-select the default images outside of the theme presets."
msgstr ""
8 changes: 4 additions & 4 deletions src/languages/cs_CZ.po
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,18 @@ msgstr "Widget názvu webu"
msgid "A widget containing the site logo, title and tagline."
msgstr "Widget obsahující logo, název a popis webu."

#: php/functions.php:163
#: php/functions.php:165
msgid "CRDM - Modern theme requires at least WordPress 5.0"
msgstr "Šablona CRDM - Modern vyžaduje alespoň WordPress 5.0"

#: php/functions.php:176
#: php/functions.php:178
msgid "CRDM - Modern theme requires at least PHP 7.0"
msgstr "Šablona CRDM - Modern vyžaduje alespoň PHP 7.0"

#: php/functions.php:188
#: php/functions.php:190
msgid "CRDM - Modern theme requires GeneratePress Premium"
msgstr "Šablona CRDM - Modern vyžaduje premium verzi GeneratePress"

#: php/functions.php:200
#: php/functions.php:202
msgid "Failed to copy CRDM - Modern theme images to WordPress Media. The theme will work fine, but you won't be able to re-select the default images outside of the theme presets."
msgstr "Nepodařilo se zkopírovat obrázky šablony CRDM - Modern do WordPress Médií. Šablona bude fungovat v pořádku i tak, ale nebudete moct znovu použít její výchozí obrázky jinak, než použitím předvolby šablony."
2 changes: 1 addition & 1 deletion src/php/admin/class-wordpress-github-updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function update_theme( $transient ) {
*
* @return void
*
* @SuppressWarnings(PHPMD.ExitExpression)
* @SuppressWarnings("PHPMD.ExitExpression")
*/
public function update_url() {
if ( ! isset( $_GET['version'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
Expand Down
2 changes: 1 addition & 1 deletion src/php/admin/customizer/class-preset-registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function default_preset() {
* @return Preset_Registry The default registry.
*
* @suppress PhanPossiblyNullTypeReturn
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings("PHPMD.ExcessiveMethodLength")
*/
public static function get_instance() {
if ( ! is_null( self::$instance ) ) {
Expand Down
4 changes: 2 additions & 2 deletions src/php/admin/customizer/class-preset.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* Contains all the data about a preset.
*
* @SuppressWarnings(PHPMD.ShortVariable)
* @SuppressWarnings("PHPMD.ShortVariable")
*/
class Preset {
/**
Expand Down Expand Up @@ -162,7 +162,7 @@ public function get_stylesheet_defaults( string $name ) {
*
* @return mixed The defautl values.
*
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
* @SuppressWarnings("PHPMD.UnusedLocalVariable")
*/
public function get_all_template_defaults() {
$ret = array();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Preset_Customize_Control extends \WP_Customize_Control {
*
* @inheritDoc
*
* @SuppressWarnings(PHPMD.ShortVariable)
* @SuppressWarnings("PHPMD.ShortVariable")
*/
public function __construct( \WP_Customize_Manager $manager, string $id, array $args, $presets = null ) {
parent::__construct( $manager, $id, $args );
Expand Down
1 change: 1 addition & 0 deletions src/php/admin/preset-on-activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ function apply_preset( $preset ) {
remove_theme_mod( $mod );
continue;
}
// @phpstan-ignore function.alreadyNarrowedType (Should always be array, but check here for safety)
if ( is_array( $value ) ) {
$value = implode( ',', $value );
}
Expand Down
4 changes: 2 additions & 2 deletions src/php/frontend/class-title-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public function __construct() {
*
* @return void
*
* @SuppressWarnings(PHPMD.ShortVariable)
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.ShortVariable")
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function widget( $args, $instance ) {
$gp_settings = wp_parse_args(
Expand Down
4 changes: 2 additions & 2 deletions src/php/frontend/widget-icons.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ function enqueue() {
*
* @return string The new title.
*
* @SuppressWarnings(PHPMD.ShortVariable)
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.ShortVariable")
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
function add_icon( string $title, array $instance = array(), string $id_base = '' ) {
switch ( $id_base ) {
Expand Down
4 changes: 3 additions & 1 deletion src/php/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ function copy_images() {
* @return void
*/
function copy_image( $path, $title ) {
// Bail if image already exists.
// @phpstan-ignore requireOnce.fileNotFound (WordPress file)
require_once ABSPATH . 'wp-admin/includes/post.php';
// Bail if image already exists.
if ( 0 !== post_exists( $title, '', '', 'attachment' ) ) {
return;
}
Expand All @@ -134,6 +135,7 @@ function copy_image( $path, $title ) {
if ( is_wp_error( $attachment_id ) ) {
throw new \Exception();
}
// @phpstan-ignore requireOnce.fileNotFound (WordPress file)
require_once ABSPATH . 'wp-admin/includes/image.php';
// @phpstan-ignore-next-line
$attachment_metadata = wp_generate_attachment_metadata( $attachment_id, $file_contents['file'] );
Expand Down