Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit 138cd03

Browse files
committed
CS fixes
1 parent 8f7b8f7 commit 138cd03

39 files changed

+222
-51
lines changed

phpcs.xml

+1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
<!-- Paths to check -->
66
<file>src</file>
77
<file>test</file>
8+
<exclude-pattern>*/_templates/*</exclude-pattern>
89
</ruleset>

src/Helper/Doctype.php

+2
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public function __toString()
131131
*/
132132
protected static function registerDefaultDoctypes()
133133
{
134+
// @codingStandardsIgnoreStart
134135
static::$registeredDoctypes = new ArrayObject([
135136
'doctypes' => [
136137
self::XHTML11 => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
@@ -147,6 +148,7 @@ protected static function registerDefaultDoctypes()
147148
self::HTML5 => '<!DOCTYPE html>',
148149
],
149150
]);
151+
// @codingStandardsIgnoreEnd
150152
}
151153

152154
/**

src/Helper/HeadLink.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Zend\View;
1414
use Zend\View\Exception;
1515

16+
// @codingStandardsIgnoreStart
1617
/**
1718
* Zend_Layout_View_Helper_HeadLink
1819
*
@@ -28,6 +29,7 @@
2829
* @method HeadLink prependAlternate($href, $type, $title, $extras = array())
2930
* @method HeadLink setAlternate($href, $type, $title, $extras = array())
3031
*/
32+
// @codingStandardsIgnoreEnd
3133
class HeadLink extends Placeholder\Container\AbstractStandalone
3234
{
3335
/**
@@ -143,7 +145,11 @@ public function __invoke(array $attributes = null, $placement = Placeholder\Cont
143145
*/
144146
public function __call($method, $args)
145147
{
146-
if (preg_match('/^(?P<action>set|(ap|pre)pend|offsetSet)(?P<type>Stylesheet|Alternate|Prev|Next)$/', $method, $matches)) {
148+
if (preg_match(
149+
'/^(?P<action>set|(ap|pre)pend|offsetSet)(?P<type>Stylesheet|Alternate|Prev|Next)$/',
150+
$method,
151+
$matches
152+
)) {
147153
$argc = count($args);
148154
$action = $matches['action'];
149155
$type = $matches['type'];

src/Helper/HeadMeta.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ public function __invoke(
120120
*/
121121
public function __call($method, $args)
122122
{
123-
if (preg_match('/^(?P<action>set|(pre|ap)pend|offsetSet)(?P<type>Name|HttpEquiv|Property|Itemprop)$/', $method, $matches)) {
123+
if (preg_match(
124+
'/^(?P<action>set|(pre|ap)pend|offsetSet)(?P<type>Name|HttpEquiv|Property|Itemprop)$/',
125+
$method,
126+
$matches
127+
)) {
124128
$action = $matches['action'];
125129
$type = $this->normalizeType($matches['type']);
126130
$argc = count($args);

src/HelperPluginManager.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class HelperPluginManager extends AbstractPluginManager
153153
Helper\BasePath::class => InvokableFactory::class,
154154
Helper\Cycle::class => InvokableFactory::class,
155155
Helper\DeclareVars::class => InvokableFactory::class,
156-
Helper\Doctype::class => InvokableFactory::class, // overridden by a factory in ViewHelperManagerFactory
156+
Helper\Doctype::class => InvokableFactory::class, // overridden in ViewHelperManagerFactory
157157
Helper\EscapeHtml::class => InvokableFactory::class,
158158
Helper\EscapeHtmlAttr::class => InvokableFactory::class,
159159
Helper\EscapeJs::class => InvokableFactory::class,

src/Renderer/ConsoleRenderer.php

+2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222
*/
2323
class ConsoleRenderer implements RendererInterface, TreeRendererInterface
2424
{
25+
// @codingStandardsIgnoreStart
2526
/**
2627
* @var FilterChain
2728
*/
2829
protected $__filterChain;
30+
// @codingStandardsIgnoreEnd
2931

3032
/**
3133
* Constructor.

src/Renderer/PhpRenderer.php

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Zend\View\Resolver\TemplatePathStack;
2323
use Zend\View\Variables;
2424

25+
// @codingStandardsIgnoreStart
2526
/**
2627
* Class for Zend\View\Strategy\PhpRendererStrategy to help enforce private constructs.
2728
*
@@ -131,6 +132,7 @@ class PhpRenderer implements Renderer, TreeRendererInterface
131132
* @var array Temporary variable stack; used when variables passed to render()
132133
*/
133134
private $__varsCache = [];
135+
// @codingStandardsIgnoreEnd
134136

135137
/**
136138
* Constructor.

src/Stream.php

+14
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ class Stream
5454
* @param $opened_path
5555
* @return bool
5656
*/
57+
// @codingStandardsIgnoreStart
5758
public function stream_open($path, $mode, $options, &$opened_path)
5859
{
60+
// @codingStandardsIgnoreEnd
5961
// get the view script source
6062
$path = str_replace('zend.view://', '', $path);
6163
$this->data = file_get_contents($path);
@@ -91,8 +93,10 @@ public function stream_open($path, $mode, $options, &$opened_path)
9193
*
9294
* @return array
9395
*/
96+
// @codingStandardsIgnoreStart
9497
public function url_stat()
9598
{
99+
// @codingStandardsIgnoreEnd
96100
return $this->stat;
97101
}
98102

@@ -102,8 +106,10 @@ public function url_stat()
102106
* @param int $count
103107
* @return string
104108
*/
109+
// @codingStandardsIgnoreStart
105110
public function stream_read($count)
106111
{
112+
// @codingStandardsIgnoreEnd
107113
$ret = substr($this->data, $this->pos, $count);
108114
$this->pos += strlen($ret);
109115
return $ret;
@@ -114,8 +120,10 @@ public function stream_read($count)
114120
*
115121
* @return int
116122
*/
123+
// @codingStandardsIgnoreStart
117124
public function stream_tell()
118125
{
126+
// @codingStandardsIgnoreEnd
119127
return $this->pos;
120128
}
121129

@@ -124,8 +132,10 @@ public function stream_tell()
124132
*
125133
* @return bool
126134
*/
135+
// @codingStandardsIgnoreStart
127136
public function stream_eof()
128137
{
138+
// @codingStandardsIgnoreEnd
129139
return $this->pos >= strlen($this->data);
130140
}
131141

@@ -134,8 +144,10 @@ public function stream_eof()
134144
*
135145
* @return array
136146
*/
147+
// @codingStandardsIgnoreStart
137148
public function stream_stat()
138149
{
150+
// @codingStandardsIgnoreEnd
139151
return $this->stat;
140152
}
141153

@@ -146,8 +158,10 @@ public function stream_stat()
146158
* @param $whence
147159
* @return bool
148160
*/
161+
// @codingStandardsIgnoreStart
149162
public function stream_seek($offset, $whence)
150163
{
164+
// @codingStandardsIgnoreEnd
151165
switch ($whence) {
152166
case SEEK_SET:
153167
if ($offset < strlen($this->data) && $offset >= 0) {

test/Helper/DeclareVarsTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ public function tearDown()
3131
{
3232
unset($this->view);
3333
}
34-
34+
// @codingStandardsIgnoreStart
3535
protected function _declareVars()
3636
{
37+
// @codingStandardsIgnoreEnd
3738
$this->view->plugin('declareVars')->__invoke(
3839
'varName1',
3940
'varName2',

test/Helper/DoctypeTest.php

+12
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ public function testIsXhtmlReturnsTrueForXhtmlDoctypes()
8181
$this->assertTrue($doctype->isXhtml());
8282
}
8383

84+
// @codingStandardsIgnoreStart
8485
$doctype = $this->helper->__invoke('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://framework.zend.com/foo/DTD/xhtml1-custom.dtd">');
86+
// @codingStandardsIgnoreEnd
8587
$this->assertEquals('CUSTOM_XHTML', $doctype->getDoctype());
8688
$this->assertTrue($doctype->isXhtml());
8789
}
@@ -100,7 +102,9 @@ public function testIsXhtmlReturnsFalseForNonXhtmlDoctypes()
100102
$this->assertFalse($doctype->isXhtml());
101103
}
102104

105+
// @codingStandardsIgnoreStart
103106
$doctype = $this->helper->__invoke('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 10.0 Strict//EN" "http://framework.zend.com/foo/DTD/html10-custom.dtd">');
107+
// @codingStandardsIgnoreEnd
104108
$this->assertEquals('CUSTOM', $doctype->getDoctype());
105109
$this->assertFalse($doctype->isXhtml());
106110
}
@@ -156,8 +160,10 @@ public function testIsRdfa()
156160
$this->assertFalse($this->helper->__invoke($type)->isRdfa());
157161
}
158162

163+
// @codingStandardsIgnoreStart
159164
// custom doctype
160165
$doctype = $this->helper->__invoke('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 10.0 Strict//EN" "http://framework.zend.com/foo/DTD/html10-custom.dtd">');
166+
// @codingStandardsIgnoreEnd
161167
$this->assertFalse($doctype->isRdfa());
162168
}
163169

@@ -170,14 +176,18 @@ public function testCanRegisterCustomHtml5Doctype()
170176

171177
public function testCanRegisterCustomXhtmlDoctype()
172178
{
179+
// @codingStandardsIgnoreStart
173180
$doctype = $this->helper->__invoke('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://framework.zend.com/foo/DTD/xhtml1-custom.dtd">');
181+
// @codingStandardsIgnoreEnd
174182
$this->assertEquals('CUSTOM_XHTML', $doctype->getDoctype());
175183
$this->assertTrue($doctype->isXhtml());
176184
}
177185

178186
public function testCanRegisterCustomHtmlDoctype()
179187
{
188+
// @codingStandardsIgnoreStart
180189
$doctype = $this->helper->__invoke('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 10.0 Strict//EN" "http://framework.zend.com/foo/DTD/html10-custom.dtd">');
190+
// @codingStandardsIgnoreEnd
181191
$this->assertEquals('CUSTOM', $doctype->getDoctype());
182192
$this->assertFalse($doctype->isXhtml());
183193
}
@@ -195,6 +205,8 @@ public function testStringificationReturnsDoctypeString()
195205
{
196206
$doctype = $this->helper->__invoke(Helper\Doctype::XHTML1_STRICT);
197207
$string = $doctype->__toString();
208+
// @codingStandardsIgnoreStart
198209
$this->assertEquals('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">', $string);
210+
// @codingStandardsIgnoreEnd
199211
}
200212
}

test/Helper/FlashMessengerTest.php

+4
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,9 @@ public function testCanDisplayListOfMessagesCustomisedByConfigSeparator()
346346
$helperPluginManager = $services->get('ViewHelperManager');
347347
$helper = $helperPluginManager->get('flashmessenger');
348348

349+
// @codingStandardsIgnoreStart
349350
$displayInfoAssertion = '<div><ul><li class="foo-baz foo-bar">foo</li><li class="foo-baz foo-bar">bar</li></ul></div>';
351+
// @codingStandardsIgnoreEnd
350352
$displayInfo = $helper->render('default', ['foo-baz', 'foo-bar']);
351353
$this->assertEquals($displayInfoAssertion, $displayInfo);
352354
}
@@ -368,7 +370,9 @@ public function testCanDisplayListOfCurrentMessagesCustomisedByConfigSeparator()
368370
$helperPluginManager = $services->get('ViewHelperManager');
369371
$helper = $helperPluginManager->get('flashmessenger');
370372

373+
// @codingStandardsIgnoreStart
371374
$displayInfoAssertion = '<div><ul><li class="foo-baz foo-bar">foo</li><li class="foo-baz foo-bar">bar</li></ul></div>';
375+
// @codingStandardsIgnoreEnd
372376
$displayInfo = $helper->renderCurrent('default', ['foo-baz', 'foo-bar']);
373377
$this->assertEquals($displayInfoAssertion, $displayInfo);
374378
}

test/Helper/GravatarTest.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,11 @@ public function testImgAttribs()
169169
{
170170
$this->assertRegExp(
171171
'/class="gravatar" title="Gravatar"/',
172-
$this->helper->__invoke("[email protected]", [], ['class' => 'gravatar', 'title' => 'Gravatar'])->__toString()
172+
$this->helper->__invoke(
173+
174+
[],
175+
['class' => 'gravatar', 'title' => 'Gravatar']
176+
)->__toString()
173177
);
174178
}
175179

@@ -179,8 +183,10 @@ public function testImgAttribs()
179183
public function testGravatarOptions()
180184
{
181185
$this->assertRegExp(
186+
// @codingStandardsIgnoreStart
182187
'#src="http\&\#x3A\;\&\#x2F\;\&\#x2F\;www.gravatar.com\&\#x2F\;avatar\&\#x2F\;[a-z0-9]{32}&\#x3F;s&\#x3D;125&amp;d&\#x3D;wavatar&amp;r&\#x3D;pg"#',
183188
$this->helper->__invoke("[email protected]", ['rating' => 'pg', 'imgSize' => 125, 'defaultImg' => 'wavatar', 'secure' => false])->__toString()
189+
// @codingStandardsIgnoreEnd
184190
);
185191
}
186192

test/Helper/HeadLinkTest.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,11 @@ public function testSetAlternateWithExtras()
380380

381381
public function testAppendStylesheetWithExtras()
382382
{
383-
$this->helper->appendStylesheet(['href' => '/bar/baz', 'conditionalStylesheet' => false, 'extras' => ['id' => 'my_link_tag']]);
383+
$this->helper->appendStylesheet([
384+
'href' => '/bar/baz',
385+
'conditionalStylesheet' => false,
386+
'extras' => ['id' => 'my_link_tag']
387+
]);
384388
$test = $this->helper->toString();
385389
$this->assertContains('id="my_link_tag"', $test);
386390
}

test/Helper/HeadMetaTest.php

+20-3
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,20 @@ public function testAppendPrependAndSetThrowExceptionsWhenNonMetaValueProvided()
9494
}
9595
}
9696

97+
// @codingStandardsIgnoreStart
9798
protected function _inflectAction($type)
9899
{
100+
// @codingStandardsIgnoreEnd
99101
$type = str_replace('-', ' ', $type);
100102
$type = ucwords($type);
101103
$type = str_replace(' ', '', $type);
102104
return $type;
103105
}
104106

107+
// @codingStandardsIgnoreStart
105108
protected function _testOverloadAppend($type)
106109
{
110+
// @codingStandardsIgnoreEnd
107111
$action = 'append' . $this->_inflectAction($type);
108112
$string = 'foo';
109113
for ($i = 0; $i < 3; ++$i) {
@@ -122,8 +126,10 @@ protected function _testOverloadAppend($type)
122126
}
123127
}
124128

129+
// @codingStandardsIgnoreStart
125130
protected function _testOverloadPrepend($type)
126131
{
132+
// @codingStandardsIgnoreEnd
127133
$action = 'prepend' . $this->_inflectAction($type);
128134
$string = 'foo';
129135
for ($i = 0; $i < 3; ++$i) {
@@ -142,8 +148,10 @@ protected function _testOverloadPrepend($type)
142148
}
143149
}
144150

151+
// @codingStandardsIgnoreStart
145152
protected function _testOverloadSet($type)
146153
{
154+
// @codingStandardsIgnoreEnd
147155
$setAction = 'set' . $this->_inflectAction($type);
148156
$appendAction = 'append' . $this->_inflectAction($type);
149157
$string = 'foo';
@@ -312,7 +320,8 @@ public function testSetNameDoesntClobber()
312320
$view->plugin('headMeta')->setName('keywords', 'bat');
313321

314322
$this->assertEquals(
315-
'<meta http-equiv="pragma" content="bar" />' . PHP_EOL . '<meta http-equiv="Cache-control" content="baz" />' . PHP_EOL . '<meta name="keywords" content="bat" />',
323+
'<meta http-equiv="pragma" content="bar" />' . PHP_EOL . '<meta http-equiv="Cache-control" content="baz" />'
324+
. PHP_EOL . '<meta name="keywords" content="bat" />',
316325
$view->plugin('headMeta')->toString()
317326
);
318327
}
@@ -330,7 +339,9 @@ public function testSetNameDoesntClobberPart2()
330339
$view->plugin('headMeta')->setName('keywords', 'bar');
331340

332341
$this->assertEquals(
333-
'<meta name="description" content="foo" />' . PHP_EOL . '<meta http-equiv="pragma" content="baz" />' . PHP_EOL . '<meta http-equiv="Cache-control" content="baz" />' . PHP_EOL . '<meta name="keywords" content="bar" />',
342+
'<meta name="description" content="foo" />' . PHP_EOL . '<meta http-equiv="pragma" content="baz" />'
343+
. PHP_EOL . '<meta http-equiv="Cache-control" content="baz" />' . PHP_EOL
344+
. '<meta name="keywords" content="bar" />',
334345
$view->plugin('headMeta')->toString()
335346
);
336347
}
@@ -343,7 +354,13 @@ public function testPlacesMetaTagsInProperOrder()
343354
{
344355
$view = new View();
345356
$view->plugin('headMeta')->setName('keywords', 'foo');
346-
$view->plugin('headMeta')->__invoke('some content', 'bar', 'name', [], \Zend\View\Helper\Placeholder\Container\AbstractContainer::PREPEND);
357+
$view->plugin('headMeta')->__invoke(
358+
'some content',
359+
'bar',
360+
'name',
361+
[],
362+
\Zend\View\Helper\Placeholder\Container\AbstractContainer::PREPEND
363+
);
347364

348365
$this->assertEquals(
349366
'<meta name="bar" content="some content" />' . PHP_EOL . '<meta name="keywords" content="foo" />',

0 commit comments

Comments
 (0)