Skip to content

Commit

Permalink
update: 测试 scoper 0.18
Browse files Browse the repository at this point in the history
  • Loading branch information
NHZEX committed Aug 12, 2023
1 parent 87665c9 commit 12bdec0
Show file tree
Hide file tree
Showing 26 changed files with 249 additions and 1,137 deletions.
8 changes: 8 additions & 0 deletions README.md
Expand Up @@ -54,3 +54,11 @@ return [
- [Phinx EN](https://book.cakephp.org/phinx)
- [Phinx CN](https://tsy12321.gitbooks.io/phinx-doc/content)
- [Phinx Old](http://docs.phinx.org/en/latest)

## Dev

```bash
## 安装构建工具

composer bin php-scoper install
```
3 changes: 1 addition & 2 deletions composer.json
Expand Up @@ -60,8 +60,7 @@
},
"scripts": {
"post-install-cmd": [
"@composer bin phpunit install --ansi",
"@composer bin php-scoper install --ansi"
"@composer bin phpunit install --ansi"
],
"build-third-party": [
"php-scoper add --working-dir=./third-party-src --output-dir=../third-party --force",
Expand Down
17 changes: 16 additions & 1 deletion third-party-src/scoper.inc.php
Expand Up @@ -61,8 +61,23 @@
//
// For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers
'patchers' => [
/**
* @see https://github.com/humbug/php-scoper/issues/841
*/
static function (string $filePath, string $prefix, string $contents): string {
// Change the contents here.
if (preg_match('/vendor\/composer\/autoload_real\.php$/', $filePath)) {
return preg_replace(
[
"/'Composer\\\\\\\\Autoload\\\\\\\\ClassLoader'/",
"/spl_autoload_unregister\(array\('ComposerAutoloaderInit/",
],
[
"'{$prefix}\\\\\\\\Composer\\\\\\\\Autoload\\\\\\\\ClassLoader'",
"spl_autoload_unregister(array('{$prefix}\\\\\\\\ComposerAutoloaderInit",
],
$contents
);
}

return $contents;
},
Expand Down
26 changes: 11 additions & 15 deletions third-party/vendor/autoload.php
@@ -1,25 +1,21 @@
<?php

// autoload.php @generated by Composer
namespace _Z_PhinxVendor;

if (PHP_VERSION_ID < 50600) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
// autoload.php @generated by Composer
if (\PHP_VERSION_ID < 50600) {
if (!\headers_sent()) {
\header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running ' . \PHP_VERSION . ', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.' . \PHP_EOL;
if (!\ini_get('display_errors')) {
if (\PHP_SAPI === 'cli' || \PHP_SAPI === 'phpdbg') {
\fwrite(\STDERR, $err);
} elseif (!\headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
\trigger_error($err, \E_USER_ERROR);
}

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit2651f7a90f10b004f7f863b6fc48004c::getLoader();
2 changes: 1 addition & 1 deletion third-party/vendor/cakephp/datasource/RulesAwareTrait.php
Expand Up @@ -82,7 +82,7 @@ public function rulesChecker() : RulesChecker
return $this->_rulesChecker;
}
/** @psalm-var class-string<\Cake\Datasource\RulesChecker> $class */
$class = \defined('static::RULES_CLASS') ? static::RULES_CLASS : RulesChecker::class;
$class = \defined('_Z_PhinxVendor\\static::RULES_CLASS') ? static::RULES_CLASS : RulesChecker::class;
/** @psalm-suppress ArgumentTypeCoercion */
$this->_rulesChecker = $this->buildRules(new $class(['repository' => $this]));
$this->dispatchEvent('Model.buildRules', ['rules' => $this->_rulesChecker]);
Expand Down

0 comments on commit 12bdec0

Please sign in to comment.