Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Addressed deprecation errors for compatibility with newer PHP versions (
Browse files Browse the repository at this point in the history
#63)

* Update dependencies

* Small bug fixes

* Update dependencies

* Version up

* v2.5
  • Loading branch information
shinsenter authored Sep 7, 2023
1 parent 5a26c60 commit 41ea13f
Show file tree
Hide file tree
Showing 23 changed files with 372 additions and 297 deletions.
25 changes: 16 additions & 9 deletions .dist/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
#!/bin/bash

shopt -s expand_aliases
alias sed=$(which gsed)

# git checkout master
# git fetch --all
# git reset --hard origin/master
# git pull

rm -Rf vendor
base_dir=`pwd`
base_dir="$(pwd)"
build_dir=$base_dir/.dist/build

echo
echo $base_dir

# Install modules
composer pull

# Prepare
plugin_url=https://plugins.svn.wordpress.org/
plugin_url=https://plugins.svn.wordpress.org
plugin_name=shins-pageload-magic
plugin_svn=$plugin_url/$plugin_name
plugin_dir=$build_dir/$plugin_name
black_list=$base_dir/.dist/blacklist.txt

version=`head -n 1 $base_dir/VERSION`

echo "Deploy version ${version} ${build_dir}"
sed -i "s/\(Version:\s\+\).\+$/\\1${version}/" $base_dir/defer-wordpress.php
sed -i "s/'DEFER_WP_PLUGIN_VERSION', '.*'/'DEFER_WP_PLUGIN_VERSION', '${version}'/" $base_dir/defer-wordpress.php

if [[ ! -e $plugin_dir ]]; then
echo "Clone from $plugin_svn"
Expand All @@ -36,27 +43,27 @@ echo ""
# ------------------------------------------------------------------------------
echo "Copy from source"
cd $plugin_dir
svn rm trunk/* --force
svn rm --force trunk/*

cd $base_dir
rsync -aHxW --delete --exclude-from=$black_list $base_dir/ $plugin_dir/trunk/
rsync -aHxW --delete --exclude-from=${black_list/$base_dir/.} ./ ${plugin_dir/$base_dir/.}/trunk/
mv $plugin_dir/trunk/defer-wordpress.php $plugin_dir/trunk/$plugin_name.php
composer fixer .dist
# composer fixer .dist
echo ""

# ------------------------------------------------------------------------------
echo "Release $version"
cd $plugin_dir
svn add trunk/* --force
svn add --force trunk/*
svn stat
svn ci -m "Release $version" --username=shinsenter
echo ""

# ------------------------------------------------------------------------------
echo "Add new tag $version"
svn up tags/$version --force
svn up --force tags/$version
if [[ -e $plugin_dir ]]; then
svn rm tags/$version --force
svn rm --force tags/$version
rm -Rf tags/$version
fi
echo ""
Expand Down
122 changes: 45 additions & 77 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
/**
* 🚀 A WordPress plugin that focuses on minimizing payload size of HTML document
* and optimizing processing on the browser when rendering the WordPress page.
* (c) 2021 AppSeeds <hello@appseeds.net>
* (c) 2021-2023 SHIN Company <service@shin.company>
*
* PHP Version >=5.6
*
* @category Web_Performance_Optimization
* @package defer-wordpress
* @author Mai Nhut Tan <shin@shin.company>
* @copyright 2021 AppSeeds
* @copyright 2021-2023 SHIN Company
* @license https://code.shin.company/defer-wordpress/blob/master/LICENSE GPL-2.0
* @link https://code.shin.company/defer-wordpress
* @see https://code.shin.company/defer-wordpress/blob/master/README.md
Expand All @@ -19,98 +19,66 @@
$header = <<<'EOF'
🚀 A WordPress plugin that focuses on minimizing payload size of HTML document
and optimizing processing on the browser when rendering the WordPress page.
(c) 2021 AppSeeds <hello@appseeds.net>
(c) 2021-2023 SHIN Company <service@shin.company>
PHP Version >=5.6
@category Web_Performance_Optimization
@package defer-wordpress
@author Mai Nhut Tan <shin@shin.company>
@copyright 2021 AppSeeds
@copyright 2021-2023 SHIN Company
@license https://code.shin.company/defer-wordpress/blob/master/LICENSE GPL-2.0
@link https://code.shin.company/defer-wordpress
@see https://code.shin.company/defer-wordpress/blob/master/README.md
EOF;

$rules = [
'@Symfony' => true,
'@PSR2' => true,
'align_multiline_comment' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'braces' => ['allow_single_line_closure' => true],
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'escape_implicit_backslashes' => true,
'explicit_indirect_variable' => true,
'explicit_string_variable' => true,
'fully_qualified_strict_types' => true,
'header_comment' => ['header' => $header, 'comment_type' => 'PHPDoc'],
'heredoc_to_nowdoc' => true,
'increment_style' => ['style' => 'post'],
'list_syntax' => ['syntax' => 'long'],
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'method_chaining_indentation' => true,
'multiline_comment_opening_closing' => true,
'native_function_invocation' => false,
'no_alternative_syntax' => true,
'no_blank_lines_before_namespace' => false,
'no_binary_string' => true,
'no_empty_phpdoc' => true,
'no_null_property_initialization' => true,
'no_superfluous_elseif' => true,
'no_unneeded_curly_braces' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'php_unit_internal_class' => true,
'php_unit_test_class_requires_covers' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_order' => true,
'phpdoc_separation' => false,
'phpdoc_summary' => false,
'phpdoc_types_order' => true,
'return_assignment' => false,
'semicolon_after_instruction' => true,
'single_line_comment_style' => false,
'single_quote' => true,
'yoda_style' => false,
'blank_line_before_statement' => [
'statements' => [
'continue', 'declare', 'return', 'throw', 'try',
'declare', 'for', 'foreach', 'goto', 'if',
'@PhpCsFixer' => true,
'concat_space' => ['spacing' => 'one'],
'header_comment' => ['header' => $header, 'comment_type' => 'PHPDoc'],
'increment_style' => ['style' => 'post'],
'no_superfluous_phpdoc_tags' => false,
'phpdoc_summary' => true,
'phpdoc_to_comment' => false,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],

'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
],
'no_extra_blank_lines' => [
'tokens' => [
'continue', 'extra', 'return', 'throw', 'use',
'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block',

'phpdoc_align' => ['align' => 'vertical'],

'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => [
'||' => 'align_single_space_minimal',
'or' => 'align_single_space_minimal',
'=' => 'align_single_space_minimal',
'=>' => 'align_single_space_minimal',
'<=>' => 'align_single_space_minimal',
],
],
],
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => [
'=' => 'align_single_space_minimal',
'=>' => 'align_single_space_minimal',

'visibility_required' => [
'elements' => ['method', 'property'],
],
],
];

$finder = \PhpCsFixer\Finder::create()
->in(__DIR__ . DIRECTORY_SEPARATOR)
->name('*.php')
->exclude('.dist')
->exclude('.docker')
->exclude('cache')
->ignoreDotFiles(true)
->ignoreVCS(true);
->in(dirname(__DIR__))
->name('*.php')
->exclude('.dist')
->exclude('.docker')
->exclude('.github')
->exclude('cache')
->exclude('node_modules')
->exclude('vendor')
->ignoreDotFiles(false)
->ignoreVCS(true);

return (new \PhpCsFixer\Config())
->setFinder($finder)
->setRules($rules)
->setIndent(' ')
->setLineEnding("\n")
->setUsingCache(false);
->setFinder($finder)
->setRules($rules)
->setIndent(' ')
->setLineEnding("\n")
->setUsingCache(false);
Loading

0 comments on commit 41ea13f

Please sign in to comment.