Skip to content

Commit

Permalink
fix all phpstan deprecation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
wordpressfan committed Jan 13, 2025
1 parent 15531f5 commit 83b0f85
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion inc/Engine/Common/Cache/FilesystemCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class FilesystemCache implements CacheInterface {
* @param string $root_folder Root folder from the path.
* @param WP_Filesystem_Direct|null $filesystem WordPress filesystem.
*/
public function __construct( string $root_folder, WP_Filesystem_Direct $filesystem = null ) {
public function __construct( string $root_folder, ?WP_Filesystem_Direct $filesystem = null ) {
$this->root_folder = $root_folder;
$this->filesystem = $filesystem ?: rocket_direct_filesystem();
}
Expand Down
2 changes: 1 addition & 1 deletion inc/Engine/Common/PerformanceHints/Frontend/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Processor {
* @param Options_Data $options Options instance.
* @param WP_Filesystem_Direct|null $filesystem WordPress filesystem.
*/
public function __construct( array $factories, Options_Data $options, WP_Filesystem_Direct $filesystem = null ) {
public function __construct( array $factories, Options_Data $options, ?WP_Filesystem_Direct $filesystem = null ) {
$this->factories = $factories;
$this->options = $options;
$this->filesystem = $filesystem ?: rocket_direct_filesystem();
Expand Down
2 changes: 1 addition & 1 deletion inc/Engine/Common/Queue/Cleaner.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Cleaner extends ActionScheduler_QueueCleaner {
* @param int $batch_size The batch size.
* @param string $group Current queue group.
*/
public function __construct( ActionScheduler_Store $store = null, $batch_size = 20, $group = '' ) {
public function __construct( ?ActionScheduler_Store $store = null, $batch_size = 20, $group = '' ) {
parent::__construct( $store, $batch_size );
$this->store = $store ? $store : ActionScheduler_Store::instance();
$this->group = $group;
Expand Down
11 changes: 7 additions & 4 deletions inc/Engine/Common/Queue/RUCSSQueueRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

use WP_Rocket\Logger\Logger;
use ActionScheduler_Abstract_QueueRunner;
use ActionScheduler_Store;
use ActionScheduler_FatalErrorMonitor;
use ActionScheduler_AsyncRequest_QueueRunner;

class RUCSSQueueRunner extends ActionScheduler_Abstract_QueueRunner {

Expand Down Expand Up @@ -55,12 +58,12 @@ public static function instance() {
/**
* ActionScheduler_QueueRunner constructor.
*
* @param \ActionScheduler_Store|null $store Store Instance.
* @param \ActionScheduler_FatalErrorMonitor|null $monitor Fatal Error monitor instance.
* @param ActionScheduler_Store|null $store Store Instance.
* @param ActionScheduler_FatalErrorMonitor|null $monitor Fatal Error monitor instance.
* @param Cleaner|null $cleaner Cleaner instance.
* @param \ActionScheduler_AsyncRequest_QueueRunner|null $async_request Async Request Queue Runner instance.
* @param ActionScheduler_AsyncRequest_QueueRunner|null $async_request Async Request Queue Runner instance.
*/
public function __construct( \ActionScheduler_Store $store = null, \ActionScheduler_FatalErrorMonitor $monitor = null, Cleaner $cleaner = null, \ActionScheduler_AsyncRequest_QueueRunner $async_request = null ) {
public function __construct( ?ActionScheduler_Store $store = null, ?ActionScheduler_FatalErrorMonitor $monitor = null, ?Cleaner $cleaner = null, ?ActionScheduler_AsyncRequest_QueueRunner $async_request = null ) {
if ( is_null( $cleaner ) ) {
/**
* Filters the clean batch size.
Expand Down
2 changes: 1 addition & 1 deletion inc/Engine/Media/Lazyload/CSS/Front/ContentFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ContentFetcher {
*
* @param WP_Filesystem_Direct $filesystem WordPress filesystem.
*/
public function __construct( WP_Filesystem_Direct $filesystem = null ) {
public function __construct( ?WP_Filesystem_Direct $filesystem = null ) {
$this->filesystem = $filesystem ?: rocket_direct_filesystem();
}

Expand Down
2 changes: 1 addition & 1 deletion inc/Engine/Media/Lazyload/CSS/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class Subscriber implements Subscriber_Interface, LoggerAwareInterface {
* @param LazyloadCSSContentFactory $lazyloaded_content_factory Make LazyloadedContent instance.
* @param WP_Filesystem_Direct|null $filesystem WordPress filesystem.
*/
public function __construct( Extractor $extractor, RuleFormatter $rule_formatter, FileResolver $file_resolver, CacheInterface $cache, MappingFormatter $mapping_formatter, TagGenerator $tag_generator, ContentFetcher $fetcher, ContextInterface $context, Options_Data $options, LazyloadCSSContentFactory $lazyloaded_content_factory, WP_Filesystem_Direct $filesystem = null ) {
public function __construct( Extractor $extractor, RuleFormatter $rule_formatter, FileResolver $file_resolver, CacheInterface $cache, MappingFormatter $mapping_formatter, TagGenerator $tag_generator, ContentFetcher $fetcher, ContextInterface $context, Options_Data $options, LazyloadCSSContentFactory $lazyloaded_content_factory, ?WP_Filesystem_Direct $filesystem = null ) {
$this->extractor = $extractor;
$this->cache = $cache;
$this->rule_formatter = $rule_formatter;
Expand Down
2 changes: 1 addition & 1 deletion inc/ThirdParty/Plugins/I18n/WPML.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class WPML implements Subscriber_Interface {
*
* @param WP_Filesystem_Direct $filesystem Filesystem instance.
*/
public function __construct( WP_Filesystem_Direct $filesystem = null ) {
public function __construct( ?WP_Filesystem_Direct $filesystem = null ) {
$this->filesystem = ! empty( $filesystem ) ? $filesystem : rocket_direct_filesystem();
}

Expand Down

0 comments on commit 83b0f85

Please sign in to comment.