Merge pull request #54 from j0k3r/fix/phpstan

Fix PHPStan (again)
pull/55/head
Jérémy Benoist 6 years ago committed by GitHub
commit 4d1c3b1777
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      .travis.yml
  2. 2
      phpstan.neon
  3. 18
      src/Readability.php

@ -4,14 +4,17 @@ php:
- 5.6 - 5.6
- 7.0 - 7.0
- 7.1 - 7.1
- 7.2
- 7.3
- nightly
matrix: matrix:
include: include:
- php: 7.2 - php: 7.2
env: CS_FIXER=run env: SYMFONY_PHPUNIT_VERSION=7.5
- php: 7.3
env: SYMFONY_PHPUNIT_VERSION=7.5 CS_FIXER=run
- php: 7.4
env: SYMFONY_PHPUNIT_VERSION=7.5
- php: nightly
env: SYMFONY_PHPUNIT_VERSION=7.5
fast_finish: true fast_finish: true
allow_failures: allow_failures:
- php: nightly - php: nightly
@ -36,6 +39,9 @@ script:
- mkdir -p build/logs - mkdir -p build/logs
- php vendor/bin/simple-phpunit -v --coverage-clover build/logs/clover.xml - php vendor/bin/simple-phpunit -v --coverage-clover build/logs/clover.xml
- if [ "$CS_FIXER" = "run" ]; then php vendor/bin/php-cs-fixer fix --verbose --dry-run ; fi; - if [ "$CS_FIXER" = "run" ]; then php vendor/bin/php-cs-fixer fix --verbose --dry-run ; fi;
# only install phpstan when we need it
- if [ "$CS_FIXER" = "run" ]; then composer require phpstan/phpstan --no-progress --no-suggest ; fi;
- if [ "$CS_FIXER" = "run" ]; then composer require phpstan/phpstan-phpunit --no-progress --no-suggest ; fi;
- if [ "$CS_FIXER" = "run" ]; then php vendor/bin/phpstan analyse src tests --no-progress --level 1 ; fi; - if [ "$CS_FIXER" = "run" ]; then php vendor/bin/phpstan analyse src tests --no-progress --level 1 ; fi;
after_script: after_script:

@ -5,4 +5,4 @@ includes:
parameters: parameters:
# https://github.com/phpstan/phpstan/issues/694#issuecomment-350724288 # https://github.com/phpstan/phpstan/issues/694#issuecomment-350724288
autoload_files: autoload_files:
- vendor/bin/.phpunit/phpunit-7.4/vendor/autoload.php - vendor/bin/.phpunit/phpunit-7.5-0/vendor/autoload.php

@ -307,8 +307,6 @@ class Readability implements LoggerAwareInterface
/** /**
* Run any post-process modifications to article content as necessary. * Run any post-process modifications to article content as necessary.
*
* @param \DOMElement $articleContent
*/ */
public function postProcessContent(\DOMElement $articleContent) public function postProcessContent(\DOMElement $articleContent)
{ {
@ -321,8 +319,6 @@ class Readability implements LoggerAwareInterface
* For easier reading, convert this document to have footnotes at the bottom rather than inline links. * For easier reading, convert this document to have footnotes at the bottom rather than inline links.
* *
* @see http://www.roughtype.com/archives/2010/05/experiments_in.php * @see http://www.roughtype.com/archives/2010/05/experiments_in.php
*
* @param \DOMElement $articleContent
*/ */
public function addFootnotes(\DOMElement $articleContent) public function addFootnotes(\DOMElement $articleContent)
{ {
@ -385,8 +381,6 @@ class Readability implements LoggerAwareInterface
/** /**
* Prepare the article node for display. Clean out any inline styles, * Prepare the article node for display. Clean out any inline styles,
* iframes, forms, strip extraneous <p> tags, etc. * iframes, forms, strip extraneous <p> tags, etc.
*
* @param \DOMNode $articleContent
*/ */
public function prepArticle(\DOMNode $articleContent) public function prepArticle(\DOMNode $articleContent)
{ {
@ -558,7 +552,6 @@ class Readability implements LoggerAwareInterface
* This is the amount of text that is inside a link divided by the total text in the node. * This is the amount of text that is inside a link divided by the total text in the node.
* Can exclude external references to differentiate between simple text and menus/infoblocks. * Can exclude external references to differentiate between simple text and menus/infoblocks.
* *
* @param \DOMElement $e
* @param bool $excludeExternal * @param bool $excludeExternal
* *
* @return int * @return int
@ -586,8 +579,6 @@ class Readability implements LoggerAwareInterface
/** /**
* Get an element relative weight. * Get an element relative weight.
* *
* @param \DOMElement $e
*
* @return int * @return int
*/ */
public function getWeight(\DOMElement $e) public function getWeight(\DOMElement $e)
@ -607,8 +598,6 @@ class Readability implements LoggerAwareInterface
/** /**
* Remove extraneous break tags from a node. * Remove extraneous break tags from a node.
*
* @param \DOMElement $node
*/ */
public function killBreaks(\DOMElement $node) public function killBreaks(\DOMElement $node)
{ {
@ -623,7 +612,6 @@ class Readability implements LoggerAwareInterface
* *
* Updated 2012-09-18 to preserve youtube/vimeo iframes * Updated 2012-09-18 to preserve youtube/vimeo iframes
* *
* @param \DOMElement $e
* @param string $tag * @param string $tag
*/ */
public function clean(\DOMElement $e, $tag) public function clean(\DOMElement $e, $tag)
@ -659,7 +647,6 @@ class Readability implements LoggerAwareInterface
* "Fishy" is an algorithm based on content length, classnames, * "Fishy" is an algorithm based on content length, classnames,
* link density, number of images & embeds, etc. * link density, number of images & embeds, etc.
* *
* @param \DOMElement $e
* @param string $tag * @param string $tag
*/ */
public function cleanConditionally(\DOMElement $e, $tag) public function cleanConditionally(\DOMElement $e, $tag)
@ -772,8 +759,6 @@ class Readability implements LoggerAwareInterface
/** /**
* Clean out spurious headers from an Element. Checks things like classnames and link density. * Clean out spurious headers from an Element. Checks things like classnames and link density.
*
* @param \DOMElement $e
*/ */
public function cleanHeaders(\DOMElement $e) public function cleanHeaders(\DOMElement $e)
{ {
@ -915,8 +900,6 @@ class Readability implements LoggerAwareInterface
/** /**
* Initialize a node with the readability object. Also checks the * Initialize a node with the readability object. Also checks the
* className/id for special names to add to its score. * className/id for special names to add to its score.
*
* @param \DOMElement $node
*/ */
protected function initializeNode(\DOMElement $node) protected function initializeNode(\DOMElement $node)
{ {
@ -1346,7 +1329,6 @@ class Readability implements LoggerAwareInterface
* Get an element weight by attribute. * Get an element weight by attribute.
* Uses regular expressions to tell if this element looks good or bad. * Uses regular expressions to tell if this element looks good or bad.
* *
* @param \DOMElement $element
* @param string $attribute * @param string $attribute
* *
* @return int * @return int

Loading…
Cancel
Save