Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit07c46a2

Browse files
feature#28939 [WebProfilerBundle] Remove application name (ro0NL)
This PR was squashed before being merged into the 4.2-dev branch (closes#28939).Discussion----------[WebProfilerBundle] Remove application name| Q | A| ------------- | ---| Branch? | master| Bug fix? | yes| New feature? | yes| BC breaks? | no <!-- seehttps://symfony.com/bc -->| Deprecations? | yes| Tests pass? | yes <!-- please add some, will be required by reviewers -->| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->| License | MIT| Doc PR | symfony/symfony-docs#... <!-- required for new features -->This fixes a regression in master, i think after#28809 (or something related)There's still a "application name" concept out there today, and it's `ConfigDataCollector::getApplicationName()` 🤔In my case the service resolved to```php$e = new \Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector(\basename('/app'));```Causing the app name to be, well, `app` (again :P). It was really confusing.Before:![image](https://user-images.githubusercontent.com/1047696/47264761-fcb01980-d51c-11e8-9a3b-14a43d18b179.png)(the "a" is from "app" here)After:![image](https://user-images.githubusercontent.com/1047696/47264767-16516100-d51d-11e8-8a5d-4c20d4911861.png)or![image](https://user-images.githubusercontent.com/1047696/47264774-28cb9a80-d51d-11e8-8fe6-de0f46b06a1d.png)I think we need to deprecate the argument for real?cc@fabpotCommits-------f5c355e [WebProfilerBundle] Remove application name
2 parents73032f3 +f5c355e commit07c46a2

File tree

7 files changed

+94
-100
lines changed

7 files changed

+94
-100
lines changed

‎UPGRADE-4.2.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,15 @@ HttpFoundation
111111
will respectively change from "false" to "null" and from "null" to "lax" in Symfony
112112
5.0, you should define their values explicitly or use "Cookie::create()" instead.
113113

114+
HttpKernel
115+
----------
116+
117+
* The`Kernel::getRootDir()` and the`kernel.root_dir` parameter have been deprecated
118+
* The`KernelInterface::getName()` and the`kernel.name` parameter have been deprecated
119+
* Deprecated the first and second constructor argument of`ConfigDataCollector`
120+
* Deprecated`ConfigDataCollector::getApplicationName()`
121+
* Deprecated`ConfigDataCollector::getApplicationVersion()`
122+
114123
FrameworkBundle
115124
---------------
116125

‎UPGRADE-5.0.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ HttpKernel
182182

183183
* The `Kernel::getRootDir()` and the `kernel.root_dir` parameter have been removed
184184
* The `KernelInterface::getName()` and the `kernel.name` parameter have been removed
185+
* Removed the first and second constructor argument of `ConfigDataCollector`
186+
* Removed `ConfigDataCollector::getApplicationName()`
187+
* Removed `ConfigDataCollector::getApplicationVersion()`
185188

186189
Monolog
187190
-------

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/collectors.xml‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010
<serviceid="data_collector.config"class="Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector">
1111
<tagname="data_collector"template="@WebProfiler/Collector/config.html.twig"id="config"priority="-255" />
1212
<callmethod="setKernel"><argumenttype="service"id="kernel"on-invalid="ignore" /></call>
13-
<argumenttype="service">
14-
<serviceclass="string">
15-
<factoryfunction="basename" />
16-
<argument>%kernel.project_dir%</argument>
17-
</service>
18-
</argument>
1913
</service>
2014

2115
<serviceid="data_collector.request"class="Symfony\Component\HttpKernel\DataCollector\RequestDataCollector">

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig‎

Lines changed: 46 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,14 @@
1919
{%endif %}
2020

2121
{%seticon %}
22-
{%ifcollector.applicationname %}
23-
<spanclass="sf-toolbar-label">{{collector.applicationname }}</span>
24-
<spanclass="sf-toolbar-value">{{collector.applicationversion }}</span>
25-
{%elseifcollector.symfonyStateisdefined %}
26-
<spanclass="sf-toolbar-label">
27-
{{include('@WebProfiler/Icon/symfony.svg') }}
28-
</span>
29-
<spanclass="sf-toolbar-value">{{collector.symfonyversion }}</span>
30-
{%endif %}
22+
<spanclass="sf-toolbar-label">
23+
{{include('@WebProfiler/Icon/symfony.svg') }}
24+
</span>
25+
<spanclass="sf-toolbar-value">{{collector.symfonyStateisdefined?collector.symfonyversion:'n/a' }}</span>
3126
{%endset %}
3227

3328
{%settext %}
3429
<divclass="sf-toolbar-info-group">
35-
{%ifcollector.applicationname %}
36-
<divclass="sf-toolbar-info-piece">
37-
<b>{{collector.applicationname }}</b>
38-
<span>{{collector.applicationversion }}</span>
39-
</div>
40-
{%endif %}
41-
4230
<divclass="sf-toolbar-info-piece">
4331
<b>Profiler token</b>
4432
<span>
@@ -92,15 +80,9 @@
9280
<divclass="sf-toolbar-info-piece">
9381
<b>Resources</b>
9482
<span>
95-
{%if'Silex'==collector.applicationname %}
96-
<ahref="https://silex.symfony.com/documentation"rel="help">
97-
Read Silex Docs
98-
</a>
99-
{%else %}
100-
<ahref="https://symfony.com/doc/{{collector.symfonyversion }}/index.html"rel="help">
101-
Read Symfony {{collector.symfonyversion }} Docs
102-
</a>
103-
{%endif %}
83+
<ahref="https://symfony.com/doc/{{collector.symfonyversion }}/index.html"rel="help">
84+
Read Symfony {{collector.symfonyversion }} Docs
85+
</a>
10486
</span>
10587
</div>
10688
<divclass="sf-toolbar-info-piece">
@@ -126,74 +108,53 @@
126108
{%endblock %}
127109

128110
{%blockpanel %}
129-
{%ifcollector.applicationname %}
130-
{# this application is not the Symfony framework#}
131-
<h2>Project Configuration</h2>
111+
<h2>Symfony Configuration</h2>
132112

133-
<divclass="metrics">
134-
<divclass="metric">
135-
<spanclass="value">{{collector.applicationname }}</span>
136-
<spanclass="label">Application name</span>
137-
</div>
113+
<divclass="metrics">
114+
<divclass="metric">
115+
<spanclass="value">{{collector.symfonyversion }}</span>
116+
<spanclass="label">Symfony version</span>
117+
</div>
138118

119+
{%if'n/a'!=collector.env %}
139120
<divclass="metric">
140-
<spanclass="value">{{collector.applicationversion }}</span>
141-
<spanclass="label">Application version</span>
121+
<spanclass="value">{{collector.env }}</span>
122+
<spanclass="label">Environment</span>
142123
</div>
143-
</div>
144-
145-
<p>
146-
Based on <aclass="text-bold"href="https://symfony.com">Symfony {{collector.symfonyversion }}</a>
147-
</p>
148-
{%else %}
149-
<h2>Symfony Configuration</h2>
124+
{%endif %}
150125

151-
<divclass="metrics">
126+
{%if'n/a'!=collector.debug %}
152127
<divclass="metric">
153-
<spanclass="value">{{collector.symfonyversion }}</span>
154-
<spanclass="label">Symfony version</span>
128+
<spanclass="value">{{collector.debug?'enabled':'disabled' }}</span>
129+
<spanclass="label">Debug</span>
155130
</div>
131+
{%endif %}
132+
</div>
156133

157-
{%if'n/a'!=collector.env %}
158-
<divclass="metric">
159-
<spanclass="value">{{collector.env }}</span>
160-
<spanclass="label">Environment</span>
161-
</div>
162-
{%endif %}
163-
164-
{%if'n/a'!=collector.debug %}
165-
<divclass="metric">
166-
<spanclass="value">{{collector.debug?'enabled':'disabled' }}</span>
167-
<spanclass="label">Debug</span>
168-
</div>
169-
{%endif %}
170-
</div>
171-
172-
{%setsymfony_status= {dev:'Unstable Version',stable:'Stable Version',eom:'Maintenance Ended',eol:'Version Expired' } %}
173-
{%setsymfony_status_class= {dev:'warning',stable:'success',eom:'warning',eol:'error' } %}
174-
<table>
175-
<theadclass="small">
176-
<tr>
177-
<th>Symfony Status</th>
178-
<th>Bugs {{collector.symfonystatein ['eom','eol']?'were':'are' }} fixed until</th>
179-
<th>Security issues {{collector.symfonystate=='eol'?'were':'are' }} fixed until</th>
180-
<th></th>
181-
</tr>
182-
</thead>
183-
<tbody>
184-
<tr>
185-
<tdclass="font-normal">
186-
<spanclass="label status-{{symfony_status_class[collector.symfonystate] }}">{{symfony_status[collector.symfonystate]|upper }}</span>
187-
</td>
188-
<tdclass="font-normal">{{collector.symfonyeom }}</td>
189-
<tdclass="font-normal">{{collector.symfonyeol }}</td>
190-
<tdclass="font-normal">
191-
<ahref="https://symfony.com/roadmap?version={{collector.symfonyminorversion }}#checker">View roadmap</a>
192-
</td>
193-
</tr>
194-
</tbody>
195-
</table>
196-
{%endif %}
134+
{%setsymfony_status= {dev:'Unstable Version',stable:'Stable Version',eom:'Maintenance Ended',eol:'Version Expired' } %}
135+
{%setsymfony_status_class= {dev:'warning',stable:'success',eom:'warning',eol:'error' } %}
136+
<table>
137+
<theadclass="small">
138+
<tr>
139+
<th>Symfony Status</th>
140+
<th>Bugs {{collector.symfonystatein ['eom','eol']?'were':'are' }} fixed until</th>
141+
<th>Security issues {{collector.symfonystate=='eol'?'were':'are' }} fixed until</th>
142+
<th></th>
143+
</tr>
144+
</thead>
145+
<tbody>
146+
<tr>
147+
<tdclass="font-normal">
148+
<spanclass="label status-{{symfony_status_class[collector.symfonystate] }}">{{symfony_status[collector.symfonystate]|upper }}</span>
149+
</td>
150+
<tdclass="font-normal">{{collector.symfonyeom }}</td>
151+
<tdclass="font-normal">{{collector.symfonyeol }}</td>
152+
<tdclass="font-normal">
153+
<ahref="https://symfony.com/roadmap?version={{collector.symfonyminorversion }}#checker">View roadmap</a>
154+
</td>
155+
</tr>
156+
</tbody>
157+
</table>
197158

198159
<h2>PHP Configuration</h2>
199160

‎src/Symfony/Component/HttpKernel/CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ CHANGELOG
66

77
* deprecated`KernelInterface::getRootDir()` and the`kernel.root_dir` parameter
88
* deprecated`KernelInterface::getName()` and the`kernel.name` parameter
9+
* deprecated the first and second constructor argument of`ConfigDataCollector`
10+
* deprecated`ConfigDataCollector::getApplicationName()`
11+
* deprecated`ConfigDataCollector::getApplicationVersion()`
912

1013
4.1.0
1114
-----

‎src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,15 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
3030
private$version;
3131
private$hasVarDumper;
3232

33-
/**
34-
* @param string $name The name of the application using the web profiler
35-
* @param string $version The version of the application using the web profiler
36-
*/
3733
publicfunction__construct(string$name =null,string$version =null)
3834
{
35+
if (1 <=\func_num_args()) {
36+
@trigger_error(sprintf('The "$name" argument in method "%s()" is deprecated since Symfony 4.2.',__METHOD__),E_USER_DEPRECATED);
37+
}
38+
if (2 <=\func_num_args()) {
39+
@trigger_error(sprintf('The "$version" argument in method "%s()" is deprecated since Symfony 4.2.',__METHOD__),E_USER_DEPRECATED);
40+
}
41+
3942
$this->name =$name;
4043
$this->version =$version;
4144
$this->hasVarDumper =class_exists(LinkStub::class);
@@ -105,13 +108,23 @@ public function lateCollect()
105108
$this->data =$this->cloneVar($this->data);
106109
}
107110

111+
/**
112+
* @deprecated since Symfony 4.2
113+
*/
108114
publicfunctiongetApplicationName()
109115
{
116+
@trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.2.',__METHOD__),E_USER_DEPRECATED);
117+
110118
return$this->data['app_name'];
111119
}
112120

121+
/**
122+
* @deprecated since Symfony 4.2
123+
*/
113124
publicfunctiongetApplicationVersion()
114125
{
126+
@trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.2.',__METHOD__),E_USER_DEPRECATED);
127+
115128
return$this->data['app_version'];
116129
}
117130

‎src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php‎

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,26 @@ public function testCollect()
4141
$this->assertSame(\extension_loaded('Zend OPcache') &&ini_get('opcache.enable'),$c->hasZendOpcache());
4242
$this->assertSame(\extension_loaded('apcu') &&ini_get('apc.enabled'),$c->hasApcu());
4343
}
44-
}
4544

46-
class KernelForTestextends Kernel
47-
{
48-
publicfunctiongetName()
45+
/**
46+
* @group legacy
47+
* @expectedDeprecation The "$name" argument in method "Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector::__construct()" is deprecated since Symfony 4.2.
48+
* @expectedDeprecation The "$version" argument in method "Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector::__construct()" is deprecated since Symfony 4.2.
49+
* @expectedDeprecation The method "Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector::getApplicationName()" is deprecated since Symfony 4.2.
50+
* @expectedDeprecation The method "Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector::getApplicationVersion()" is deprecated since Symfony 4.2.
51+
*/
52+
publicfunctiontestLegacy()
4953
{
50-
return'testkernel';
54+
$c =newConfigDataCollector('name',null);
55+
$c->collect(newRequest(),newResponse());
56+
57+
$this->assertSame('name',$c->getApplicationName());
58+
$this->assertNull($c->getApplicationVersion());
5159
}
60+
}
5261

62+
class KernelForTestextends Kernel
63+
{
5364
publicfunctionregisterBundles()
5465
{
5566
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp