Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
composer
composer
提交
f4738d97
composer
项目概览
镜像
/
composer
/
composer
9 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
composer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
f4738d97
编写于
7月 28, 2023
作者:
J
Jordi Boggiano
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for Application::setCatchErrors in symfony 6.4+, refs symfony/symfony#50420
上级
ff70ab7c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
2 deletion
+16
-2
src/Composer/Console/Application.php
src/Composer/Console/Application.php
+7
-2
src/Composer/EventDispatcher/EventDispatcher.php
src/Composer/EventDispatcher/EventDispatcher.php
+3
-0
tests/Composer/Test/DocumentationTest.php
tests/Composer/Test/DocumentationTest.php
+3
-0
tests/Composer/Test/TestCase.php
tests/Composer/Test/TestCase.php
+3
-0
未找到文件。
src/Composer/Console/Application.php
浏览文件 @
f4738d97
...
@@ -87,6 +87,10 @@ class Application extends BaseApplication
...
@@ -87,6 +87,10 @@ class Application extends BaseApplication
public
function
__construct
(
string
$name
=
'Composer'
,
string
$version
=
''
)
public
function
__construct
(
string
$name
=
'Composer'
,
string
$version
=
''
)
{
{
if
(
method_exists
(
$this
,
'setCatchErrors'
))
{
$this
->
setCatchErrors
(
true
);
}
static
$shutdownRegistered
=
false
;
static
$shutdownRegistered
=
false
;
if
(
$version
===
''
)
{
if
(
$version
===
''
)
{
$version
=
Composer
::
getVersion
();
$version
=
Composer
::
getVersion
();
...
@@ -395,9 +399,10 @@ function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknow
...
@@ -395,9 +399,10 @@ function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknow
$this
->
hintCommonErrors
(
$e
,
$output
);
$this
->
hintCommonErrors
(
$e
,
$output
);
// symfony/console does not handle \Error subtypes so we have to renderThrowable ourselves
// symfony/console
<6.4
does not handle \Error subtypes so we have to renderThrowable ourselves
// instead of rethrowing those for consumption by the parent class
// instead of rethrowing those for consumption by the parent class
if
(
!
$e
instanceof
\
Exception
)
{
// can be removed when Composer supports PHP 8.1+
if
(
!
method_exists
(
$this
,
'setCatchErrors'
)
&&
!
$e
instanceof
\
Exception
)
{
if
(
$output
instanceof
ConsoleOutputInterface
)
{
if
(
$output
instanceof
ConsoleOutputInterface
)
{
$this
->
renderThrowable
(
$e
,
$output
->
getErrorOutput
());
$this
->
renderThrowable
(
$e
,
$output
->
getErrorOutput
());
}
else
{
}
else
{
...
...
src/Composer/EventDispatcher/EventDispatcher.php
浏览文件 @
f4738d97
...
@@ -277,6 +277,9 @@ protected function doDispatch(Event $event)
...
@@ -277,6 +277,9 @@ protected function doDispatch(Event $event)
$app
=
new
Application
();
$app
=
new
Application
();
$app
->
setCatchExceptions
(
false
);
$app
->
setCatchExceptions
(
false
);
if
(
method_exists
(
$app
,
'setCatchErrors'
))
{
$app
->
setCatchErrors
(
false
);
}
$app
->
setAutoExit
(
false
);
$app
->
setAutoExit
(
false
);
$cmd
=
new
$className
(
$event
->
getName
());
$cmd
=
new
$className
(
$event
->
getName
());
$app
->
add
(
$cmd
);
$app
->
add
(
$cmd
);
...
...
tests/Composer/Test/DocumentationTest.php
浏览文件 @
f4738d97
...
@@ -53,6 +53,9 @@ public static function provideCommandCases(): \Generator
...
@@ -53,6 +53,9 @@ public static function provideCommandCases(): \Generator
{
{
$application
=
new
Application
();
$application
=
new
Application
();
$application
->
setAutoExit
(
false
);
$application
->
setAutoExit
(
false
);
if
(
method_exists
(
$application
,
'setCatchErrors'
))
{
$application
->
setCatchErrors
(
false
);
}
$application
->
setCatchExceptions
(
false
);
$application
->
setCatchExceptions
(
false
);
$description
=
new
ApplicationDescription
(
$application
);
$description
=
new
ApplicationDescription
(
$application
);
...
...
tests/Composer/Test/TestCase.php
浏览文件 @
f4738d97
...
@@ -198,6 +198,9 @@ public function getApplicationTester(): ApplicationTester
...
@@ -198,6 +198,9 @@ public function getApplicationTester(): ApplicationTester
$application
=
new
Application
();
$application
=
new
Application
();
$application
->
setAutoExit
(
false
);
$application
->
setAutoExit
(
false
);
$application
->
setCatchExceptions
(
false
);
$application
->
setCatchExceptions
(
false
);
if
(
method_exists
(
$application
,
'setCatchErrors'
))
{
$application
->
setCatchErrors
(
false
);
}
return
new
ApplicationTester
(
$application
);
return
new
ApplicationTester
(
$application
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录