-
Notifications
You must be signed in to change notification settings - Fork 14
Feature: Zend Coding Standard 2 #52
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="Zend Framework coding standard"> | ||
<rule ref="./vendor/zendframework/zend-coding-standard/ruleset.xml"/> | ||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"> | ||
|
||
<arg name="basepath" value="."/> | ||
<arg name="cache" value=".phpcs-cache"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need to be added to gitignore? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure. Either remove it or add it to .gitignore. |
||
<arg name="colors"/> | ||
<arg name="extensions" value="php"/> | ||
<arg name="parallel" value="80"/> | ||
<arg value="p"/> | ||
|
||
<!-- Paths to check --> | ||
<file>src</file> | ||
<file>test</file> | ||
<exclude-pattern>test/TestAsset/test/test.js</exclude-pattern> | ||
|
||
<!-- Include all rules from the Zend Coding Standard --> | ||
<rule ref="ZendCodingStandard"/> | ||
</ruleset> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
use ArrayObject; | ||
use DateTimeZone; | ||
use Psr\Container\ContainerInterface; | ||
use Throwable; | ||
use Twig_Environment as TwigEnvironment; | ||
use Twig_Extension_Core as TwigExtensionCore; | ||
use Twig_Extension_Debug as TwigExtensionDebug; | ||
|
@@ -83,7 +84,7 @@ public function __invoke(ContainerInterface $container) : TwigEnvironment | |
if (! is_array($config) && ! $config instanceof ArrayObject) { | ||
throw new Exception\InvalidConfigException(sprintf( | ||
'"config" service must be an array or ArrayObject for the %s to be able to consume it; received %s', | ||
__CLASS__, | ||
self::class, | ||
(is_object($config) ? get_class($config) : gettype($config)) | ||
)); | ||
} | ||
|
@@ -110,7 +111,7 @@ public function __invoke(ContainerInterface $container) : TwigEnvironment | |
} | ||
try { | ||
$timezone = new DateTimeZone($timezone); | ||
} catch (\Exception $e) { | ||
} catch (Throwable $e) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is not safe as it changes behavior and as such it is not up to a CS tool to decide. Intercepting exceptions is not quite the same as intercepting catchable php errors. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case you actually want to catch everything. But most cases you catch specific component exceptions like For the few exceptions the sniff can be disabled. Disabling sniffs is documented and so are the sniffs. |
||
throw new Exception\InvalidConfigException(sprintf('Unknown or invalid timezone: "%s"', $timezone)); | ||
} | ||
$environment->getExtension(TwigExtensionCore::class)->setTimezone($timezone); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once webimpress/coding-standard#3 has a stable release, these lines can be removed.