Skip to content

Commit

Permalink
Fix PHPStan warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed May 11, 2020
1 parent 8a44976 commit f0c58fc
Show file tree
Hide file tree
Showing 23 changed files with 119 additions and 101 deletions.
87 changes: 50 additions & 37 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,57 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

on:
- pull_request
- push
- pull_request
- push

name: "Continuous Integration"

jobs:
grumphp:
name: "Grumphp"

runs-on: ubuntu-latest

strategy:
matrix:
php-binary:
- php7.1
- php7.2
- php7.3

steps:
- name: "Checkout"
uses: actions/checkout@master
with:
fetch-depth: 1

- name: "Composer install"
run: ${{ matrix.php-binary }} $(which composer) install --no-interaction --no-progress --no-suggest

- name: "Composer install lowest dependencies"
if: matrix.dependencies == 'lowest'
run: ${{ matrix.php-binary }} $(which composer) update --no-interaction --no-progress --no-suggest --prefer-lowest

- name: "Install Graphviz"
run: sudo apt-get install graphviz

- name: "Run Grumphp"
run: ${{ matrix.php-binary }} vendor/bin/grumphp run
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

- name: "Scrutinizer"
run: wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
run:
name: "Grumphp"
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
php-versions: ['7.1', '7.2', '7.3', '7.4']

steps:
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 1

- name: Install PHP
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring,xdebug
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader

- name: Run Grumphp
run: vendor/bin/grumphp run --no-ansi -n
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

- name: Send PSALM data
run: vendor/bin/psalm --shepherd --stats
continue-on-error: true

- name: Scrutinizer
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
continue-on-error: true
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"product"
],
"homepage": "https://github.com/drupol/phpermutations",
"license": "GPL-3.0-only",
"license": "MIT",
"authors": [
{
"name": "Pol Dellaiera",
Expand All @@ -24,10 +24,9 @@
"php": ">= 7.1.3"
},
"require-dev": {
"drupol/php-conventions": "^1.6.8",
"drupol/php-conventions": "^1.7.1",
"phpunit/php-code-coverage": "^4 || ^5",
"phpunit/phpunit": "^6 || ^7",
"symfony/process": "^4.4.1"
"phpunit/phpunit": "^6 || ^7"
},
"config": {
"sort-packages": true
Expand Down
3 changes: 0 additions & 3 deletions src/Combinatorics.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

use function count;

/**
* Class Combinatorics.
*/
abstract class Combinatorics
{
/**
Expand Down
3 changes: 0 additions & 3 deletions src/Generators/Fibonacci.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
use drupol\phpermutations\Iterators\Fibonacci as FibonacciIterator;
use Generator;

/**
* Class Fibonacci.
*/
class Fibonacci extends FibonacciIterator implements GeneratorInterface
{
/**
Expand Down
3 changes: 0 additions & 3 deletions src/Generators/NGrams.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
use drupol\phpermutations\Iterators\NGrams as NGramsIterator;
use Generator;

/**
* Class NGrams.
*/
class NGrams extends NGramsIterator implements GeneratorInterface
{
/**
Expand Down
3 changes: 0 additions & 3 deletions src/Generators/Perfect.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
use drupol\phpermutations\GeneratorInterface;
use drupol\phpermutations\Iterators\Perfect as PerfectIterator;

/**
* Class Perfect.
*/
class Perfect extends PerfectIterator implements GeneratorInterface
{
/**
Expand Down
3 changes: 0 additions & 3 deletions src/Generators/Permutations.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@

use function count;

/**
* Class Permutations.
*/
class Permutations extends Combinatorics implements GeneratorInterface
{
/**
Expand Down
3 changes: 0 additions & 3 deletions src/Generators/Prime.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
use drupol\phpermutations\GeneratorInterface;
use drupol\phpermutations\Iterators\Prime as PrimeIterator;

/**
* Class Prime.
*/
class Prime extends PrimeIterator implements GeneratorInterface
{
/**
Expand Down
3 changes: 0 additions & 3 deletions src/Generators/PrimeFactors.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
use drupol\phpermutations\GeneratorInterface;
use drupol\phpermutations\Iterators\PrimeFactors as PrimeFactorsIterator;

/**
* Class PrimeFactors.
*/
class PrimeFactors extends PrimeFactorsIterator implements GeneratorInterface
{
/**
Expand Down
3 changes: 0 additions & 3 deletions src/Generators/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@

use function count;

/**
* Class Product.
*/
class Product extends ProductIterator implements GeneratorInterface
{
/**
Expand Down
3 changes: 0 additions & 3 deletions src/Generators/Shift.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
use drupol\phpermutations\GeneratorInterface;
use drupol\phpermutations\Iterators\Shift as ShiftIterator;

/**
* Class Shift.
*/
class Shift extends ShiftIterator implements GeneratorInterface
{
/**
Expand Down
5 changes: 2 additions & 3 deletions src/Iterators.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

use Countable;

/**
* Class Iterators.
*/
abstract class Iterators extends Combinatorics implements Countable, IteratorInterface
{
/**
Expand Down Expand Up @@ -41,6 +38,8 @@ public function key()

/**
* {@inheritdoc}
*
* @return void
*/
public function rewind()
{
Expand Down
7 changes: 4 additions & 3 deletions src/Iterators/Combinations.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

use drupol\phpermutations\Iterators;

/**
* Class Combinations.
*/
class Combinations extends Iterators
{
/**
Expand Down Expand Up @@ -62,6 +59,8 @@ public function current()

/**
* {@inheritdoc}
*
* @return void
*/
public function next()
{
Expand All @@ -83,6 +82,8 @@ public function rewind()

/**
* {@inheritdoc}
*
* @return bool
*/
public function valid()
{
Expand Down
7 changes: 4 additions & 3 deletions src/Iterators/Cycle.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

use function count;

/**
* Class Cycle.
*/
class Cycle extends Iterators
{
/**
Expand All @@ -31,6 +28,8 @@ public function current()

/**
* {@inheritdoc}
*
* @return void
*/
public function next()
{
Expand All @@ -47,6 +46,8 @@ public function rewind()

/**
* {@inheritdoc}
*
* @return bool
*/
public function valid()
{
Expand Down
9 changes: 6 additions & 3 deletions src/Iterators/Fibonacci.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

use const PHP_INT_MAX;

/**
* Class Fibonacci.
*/
class Fibonacci extends Iterators
{
/**
Expand Down Expand Up @@ -54,6 +51,8 @@ public function getMaxLimit()

/**
* {@inheritdoc}
*
* @return void
*/
public function next()
{
Expand All @@ -76,6 +75,8 @@ public function rewind()
*
* @param int $max
* The limit
*
* @return void
*/
public function setMaxLimit($max)
{
Expand All @@ -84,6 +85,8 @@ public function setMaxLimit($max)

/**
* {@inheritdoc}
*
* @return bool
*/
public function valid()
{
Expand Down
8 changes: 8 additions & 0 deletions src/Iterators/FiniteGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public function getSize()

/**
* {@inheritdoc}
*
* @return void
*/
public function next()
{
Expand Down Expand Up @@ -94,6 +96,8 @@ public function order($generator)
*
* @param int $size
* The size
*
* @return void
*/
public function setSize($size)
{
Expand All @@ -103,6 +107,8 @@ public function setSize($size)

/**
* {@inheritdoc}
*
* @return bool
*/
public function valid()
{
Expand All @@ -111,6 +117,8 @@ public function valid()

/**
* Clean out the group from unwanted values.
*
* @return void
*/
private function computeGroup()
{
Expand Down
7 changes: 4 additions & 3 deletions src/Iterators/NGrams.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

use function array_slice;

/**
* Class NGrams.
*/
class NGrams extends Shift
{
/**
Expand Down Expand Up @@ -45,6 +42,8 @@ public function current()

/**
* {@inheritdoc}
*
* @return void
*/
public function next()
{
Expand All @@ -54,6 +53,8 @@ public function next()

/**
* {@inheritdoc}
*
* @return void
*/
public function rewind()
{
Expand Down
Loading

0 comments on commit f0c58fc

Please sign in to comment.