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

Use symfony/polyfill-php80 #1042

Merged
merged 6 commits into from
Dec 18, 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
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"pear/xml_util": "*",
"setasign/fpdf": "^1.8",
"setasign/fpdi": "^2.6",
"smarty/smarty": "^5.0.2"
"smarty/smarty": "^5.0.2",
"symfony/polyfill-php80": "^1.31"
},
"autoload": {
"classmap": [
Expand Down
160 changes: 80 additions & 80 deletions composer.lock

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

43 changes: 0 additions & 43 deletions data/class/SC_Initial.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public function init()
$this->resetSuperglobalsRequest(); // stripslashesDeepGpc メソッドより後で実行
$this->setTimezone(); // 本当はエラーハンドラーより先に読みたい気も
$this->normalizeHostname(); // defineConstants メソッドより後で実行
$this->compatPhp();
}

/**
Expand Down Expand Up @@ -549,46 +548,4 @@ public function normalizeHostname()
SC_Response_Ex::sendRedirect($correct_url);
}
}

/**
* PHPバージョン互換処理
*
* @deprecated https://github.com/EC-CUBE/ec-cube2/issues/681 が実現したら、外部ライブラリへ移行して、削除する予定。
*
* @return void
*/
public function compatPhp()
{
if (!function_exists('str_starts_with')) {
/**
* 文字列が指定された部分文字列で始まるかを調べる。(for PHP < 8)
*
* @param string $haystack
* @param string $needle
*
* @return bool
*/
function str_starts_with($haystack, $needle)
{
return strncmp($haystack, $needle, strlen($needle)) === 0;
}
}

if (!function_exists('str_ends_with')) {
/**
* 文字列が、指定された文字列で終わるかを調べる。(for PHP < 8)
*
* @param string $haystack
* @param string $needle
*
* @return bool
*/
function str_ends_with($haystack, $needle)
{
$needle_len = strlen($needle);

return substr($haystack, -$needle_len, $needle_len) === $needle;
}
}
}
}
3 changes: 0 additions & 3 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ parameters:
-
message: "#^Variable \\$SJIS_widths might not be defined\\.$#"
path: data/class/helper/SC_Helper_FPDI.php
-
message: "#^Inner named functions are not supported by PHPStan\\.#"
path: data/class/SC_Initial.php
-
message: '#^Path in include_once\(\) "Auth/SASL.php" is not a file or it does not exist.#'
path: data/module/Net/SMTP.php
Expand Down
Loading