'.str_repeat('This is an awesome text with some links, here there are: the awesome', 20).'
This is an awesome text with some links, here there are
diff --git a/.gitattributes b/.gitattributes index db2f81f..8770321 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,6 +3,7 @@ /.gitignore export-ignore /.scrutinizer.yml export-ignore /.travis.yml export-ignore +/.php_cs export-ignore /README.md export-ignore /phpunit.xml.dist export-ignore /tests export-ignore diff --git a/.gitignore b/.gitignore index d191143..53c059c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ vendor/ coverage/ composer.lock +.php_cs.cache diff --git a/.php_cs b/.php_cs new file mode 100644 index 0000000..240846c --- /dev/null +++ b/.php_cs @@ -0,0 +1,20 @@ +setUsingCache(true) + ->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL) + // use default SYMFONY_LEVEL and extra fixers: + ->fixers(array( + 'concat_with_spaces', + 'ordered_use', + 'phpdoc_order', + 'strict', + 'strict_param', + 'long_array_syntax', + )) + ->finder( + Symfony\CS\Finder\DefaultFinder::create() + ->in(__DIR__) + ->exclude(array('vendor')) + ) +; diff --git a/.travis.yml b/.travis.yml index 8cb01d0..32f7f27 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,9 @@ php: - hhvm matrix: + include: + - php: 7.0 + env: CS_FIXER=run fast_finish: true allow_failures: - php: hhvm @@ -23,20 +26,23 @@ cache: - vendor - $HOME/.composer/cache -install: - - composer self-update - -before_script: +before_install: - if [ -n "$GH_TOKEN" ]; then composer config github-oauth.github.com ${GH_TOKEN}; fi; # disable TLS for composer because openssl is disabled for PHP 5.3.3 on travis # see: https://blog.travis-ci.com/upcoming_ubuntu_11_10_migration/ - if [[ $TRAVIS_PHP_VERSION = 5.3.3 ]]; then composer config -g -- disable-tls true; fi; - if [[ $TRAVIS_PHP_VERSION = 5.3.3 ]]; then composer config -g -- secure-http false; fi; + +install: + - composer self-update + +before_script: - composer install --prefer-dist --no-interaction script: - mkdir -p build/logs - phpunit -v --coverage-clover build/logs/clover.xml + - if [ "$CS_FIXER" = "run" ]; then php vendor/bin/php-cs-fixer fix --verbose --dry-run ; fi; after_script: - php vendor/bin/coveralls -v diff --git a/composer.json b/composer.json index 3921e36..62721e0 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,8 @@ "monolog/monolog": "^1.13.1" }, "require-dev": { - "satooshi/php-coveralls": "~0.6" + "satooshi/php-coveralls": "~0.6", + "friendsofphp/php-cs-fixer": "*" }, "autoload": { "psr-4": { "Readability\\": "src/" } diff --git a/src/JSLikeHTMLElement.php b/src/JSLikeHTMLElement.php index 798ac05..2ce4898 100644 --- a/src/JSLikeHTMLElement.php +++ b/src/JSLikeHTMLElement.php @@ -45,14 +45,14 @@ class JSLikeHTMLElement extends \DOMElement */ public function __set($name, $value) { - if ($name == 'innerHTML') { + if ($name === 'innerHTML') { // first, empty the element for ($x = $this->childNodes->length - 1; $x >= 0; --$x) { $this->removeChild($this->childNodes->item($x)); } // $value holds our new inner HTML - if ($value != '') { + if ($value !== '') { $f = $this->ownerDocument->createDocumentFragment(); // appendXML() expects well-formed markup (XHTML) @@ -72,7 +72,7 @@ class JSLikeHTMLElement extends \DOMElement // We use it (and suppress the warning) because an HTML fragment will // be wrapped around
tags which we don't really want to keep. // Note: despite the warning, if loadHTML succeeds it will return true. - $result = @$f->loadHTML('This is the awesome content :)
', 7).'This is the awesome content :)
', 7) . 'This is an awesome text with some links, here there are: the awesome
', 7).'This is an awesome text with some links, here there are: the awesome
', 7) . 'This is an awesome text with some links, here there are: the awesome
', 7).'will NOT be removedThis is an awesome text with some links, here there are: the awesome
', 7) . 'will NOT be removedThis is an awesome text with some links, here there are: the awesome
', 7).'This is an awesome text with some links, here there are
This is an awesome text with some links, here there are: the awesome
', 7) . 'This is an awesome text with some links, here there are
'.str_repeat('This is an awesome text with some links, here there are: the awesome', 20).'
This is an awesome text with some links, here there are
' . str_repeat('This is an awesome text with some links, here there are: the awesome', 20) . '
This is an awesome text with some links, here there are
This is an awesome text with some links, here there are: the awesome
', 7).'This is an awesome text with some links, here there are: the awesome
', 7) . 'This is an awesome text with some links, here there are: the awesome
', 7).'This is an awesome text with some links, here there are: the awesome
', 7) . 'This is an awesome text with some links, here there are: the awesome
', 7).'This is an awesome text with some links, here there are: the awesome
', 7) . 'This is an awesome text with some links, here there are the awesome | ', 7).'
This is an awesome text with some links, here there are the awesome | ', 7) . '
This is an awesome text with some links, here there are the awesome
', 7).'This is an awesome text with some links, here there are the awesome
', 7) . 'This is an awesome text with some links, here there are the awesome
', 7).'This is an awesome text with some links, here there are the awesome
', 7) . 'This is an awesome text with some links, here there are the awesome
', 7).'This is an awesome text with some links, here there are the awesome
', 7) . 'This is an awesome text with some links, here there are the awesome
', 7).'This is an awesome text with some links, here there are the awesome
', 7) . 'This is an awesome text with some links, here there are the awesome
', 7).'This is an awesome text with some links, here there are the awesome
', 7) . 'This is an awesome text with some links, here there are the awesome
', 7).'This is an awesome text with some links, here there are the awesome
', 7) . 'This is the awesome content :)
', 7).'This is the awesome content :)
', 7) . 'This is the awesome and WONDERFUL content :)
', 7).'This is the awesome and WONDERFUL content :)
', 7) . '