Skip to content
Permalink
Browse files

php 7.1, updated builds

  • Loading branch information
mabar authored and f3l1x committed Nov 21, 2018
1 parent d3e0ccb commit 0b8e64f95b25389c47f9e81681b9a16e08e60485
@@ -1,26 +1,16 @@
# EditorConfig is awesome: http://EditorConfig.org

# Top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true

# JS / PHP
[*.{js,php,phpt}]
charset = utf-8
indent_style = tab
indent_size = 4

# NEON
[*.neon]
charset = utf-8
trim_trailing_whitespace = true
indent_style = tab
indent_size = 4
indent_size = tab
tab_width = 4

# Composer, NPM, Travis, BitbucketPipelines
[{composer.json,package.json,.travis.yml,bitbucket-pipelines.yml}]
[{*.json,*.yml,*.md}]
indent_style = space
indent_size = 2
@@ -0,0 +1,10 @@
# Not archived
.docs export-ignore
tests export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
phpstan.neon export-ignore
README.md export-ignore
ruleset.xml export-ignore
@@ -1,8 +1,10 @@
# IDE
/.idea

# Composer
/vendor
/composer.lock

# Tests
/tests/*.log
/tests/tmp
/tests/coverage.html
/temp
/coverage.xml
@@ -1,56 +1,63 @@
language: php

php:
- 5.6
- 7.0
- 7.1
- hhvm

matrix:
fast_finish: true
- 7.2
- 7.3

allow_failures:
- php: hhvm
before_install:
# Turn off XDebug
- phpenv config-rm xdebug.ini || return 0

include:
- php: 5.6
env: COMPOSER_FLAG=--prefer-lowest
- php: 5.6
env: COMPOSER_FLAG=--prefer-stable
- php: 7.0
env: COMPOSER_FLAG=--prefer-lowest
- php: 7.0
env: COMPOSER_FLAG=--prefer-stable
- php: 7.1
env: COMPOSER_FLAG=--prefer-lowest
- php: 7.1
env: COMPOSER_FLAG=--prefer-stable

before_script:
install:
# Composer
- travis_retry composer install --no-interaction
# Coverage
- if [[ "$TRAVIS_PHP_VERSION" == "7.1" && "$COMPOSER_FLAG" == "" ]]; then COVERAGE=1; fi
- travis_retry composer install --no-progress --prefer-dist

script:
# Quality Assurance
- travis_retry composer qa

# Nette\Tester
- composer run-script tester

# Nette\Tester + CodeCoverage
- if [ "$COVERAGE" != "" ]; then composer tester-coverage; fi

after_script:
# Coverage (Coveralls)
- if [ "$COVERAGE" != "" ]; then wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar; fi
- if [ "$COVERAGE" != "" ]; then php coveralls.phar --verbose --config tests/.coveralls.yml; fi
# Tests
- composer run-script tests

after_failure:
# Print *.actual content
- for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done

jobs:
include:
- env: title="Lowest Dependencies 7.1"
php: 7.1
install:
- travis_retry composer update --no-progress --prefer-dist --prefer-lowest
script:
- composer run-script tests

- stage: Quality Assurance
php: 7.1
script:
- composer run-script qa

- stage: Phpstan
php: 7.1
script:
- composer run-script phpstan-install
- composer run-script phpstan

- stage: Test Coverage
if: branch = master AND type = push
php: 7.1
script:
- composer run-script coverage
after_script:
- wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar
- php php-coveralls.phar --verbose --config tests/.coveralls.yml

- stage: Outdated Dependencies
if: branch = master AND type = cron
php: 7.1
script:
- composer outdated --direct --strict

allow_failures:
- stage: Test Coverage

sudo: false

cache:
@@ -7,10 +7,10 @@
[![Build Status](https://img.shields.io/travis/contributte/wordcha.svg?style=flat-square)](https://travis-ci.org/contributte/wordcha)
[![Code coverage](https://img.shields.io/coveralls/contributte/wordcha.svg?style=flat-square)](https://coveralls.io/r/contributte/wordcha)
[![Licence](https://img.shields.io/packagist/l/contributte/wordcha.svg?style=flat-square)](https://packagist.org/packages/contributte/wordcha)

[![Downloads this Month](https://img.shields.io/packagist/dm/contributte/wordcha.svg?style=flat-square)](https://packagist.org/packages/contributte/wordcha)
[![Downloads total](https://img.shields.io/packagist/dt/contributte/wordcha.svg?style=flat-square)](https://packagist.org/packages/contributte/wordcha)
[![Latest stable](https://img.shields.io/packagist/v/contributte/wordcha.svg?style=flat-square)](https://packagist.org/packages/contributte/wordcha)
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan)

## Discussion / Help

@@ -26,6 +26,7 @@ composer require contributte/wordcha

| State | Version | Branch | PHP |
|-------------|---------|----------|----------|
| stable | `^0.2` | `master` | `>= 7.1` |
| stable | `^0.1` | `master` | `>= 5.6` |

## Overview
@@ -54,8 +55,15 @@ composer require contributte/wordcha
</br>
<a href="https://github.com/benijo">Josef Benjač</a>
</td>
<td align="center">
<a href="https://github.com/mabar">
<img width="150" height="150" src="https://avatars0.githubusercontent.com/u/20974277?s=150&v=4">
</a>
</br>
<a href="https://github.com/mabar">Marek Bartoš</a>
</td>
</tr>
<tbody>
</tbody>
</table>

-----
@@ -1,42 +1,60 @@
{
"name": "contributte/wordcha",
"description": "Question-based captcha for Nette Forms",
"keywords": ["nette", "forms", "security", "captcha"],
"keywords": [
"nette",
"forms",
"security",
"captcha"
],
"type": "library",
"license": ["MIT"],
"license": "MIT",
"homepage": "https://github.com/contributte/wordcha",
"authors": [
{
"name": "Milan Felix Sulc",
"name": "Milan Felix Šulc",
"homepage": "https://f3l1x.io"
}
],
"require": {
"php": ">= 5.6",
"nette/di": "~2.4.8",
"nette/forms": "~2.4.4",
"nette/utils": "~2.4.6"
"php": ">= 7.1",
"nette/di": "~2.4.14",
"nette/forms": "~2.4.9",
"nette/http": "~2.4.10",
"nette/utils": "~2.5.3"
},
"require-dev": {
"ninjify/qa": "~0.4.0",
"ninjify/nunjuck": "~0.1.4",
"mockery/mockery": "^0.9.9"
"ninjify/qa": "^0.8.0",
"ninjify/nunjuck": "^0.2.1",
"mockery/mockery": "^1.2.0"
},
"autoload": {
"psr-4": {
"Contributte\\Wordcha\\": "src/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"qa": [
"linter src tests",
"codesniffer src tests"
],
"tester": [
"tester -s -p php --colors 1 -c tests/php-unix.ini tests/cases"
"tests": [
"tester -s -p php --colors 1 -C tests/cases"
],
"coverage": [
"tester -s -p phpdbg --colors 1 -C --coverage ./coverage.xml --coverage-src ./src tests/cases"
],
"phpstan-install": [
"mkdir -p temp/phpstan",
"composer require -d temp/phpstan phpstan/phpstan:^0.10",
"composer require -d temp/phpstan phpstan/phpstan-deprecation-rules:^0.10",
"composer require -d temp/phpstan phpstan/phpstan-nette:^0.10",
"composer require -d temp/phpstan phpstan/phpstan-strict-rules:^0.10"
],
"tester-coverage": [
"tester -s -p php --colors 1 -c tests/php-unix.ini -d extension=xdebug.so --coverage ./coverage.xml --coverage-src ./src tests/cases"
"phpstan": [
"temp/phpstan/vendor/bin/phpstan analyse -l max -c phpstan.neon src"
]
}
}
@@ -0,0 +1,14 @@
includes:
- temp/phpstan/vendor/phpstan/phpstan-deprecation-rules/rules.neon
- temp/phpstan/vendor/phpstan/phpstan-nette/extension.neon
- temp/phpstan/vendor/phpstan/phpstan-nette/rules.neon
- temp/phpstan/vendor/phpstan/phpstan-strict-rules/rules.neon

parameters:
ignoreErrors:
# false positives
- '#^Parameter \#1 \$question of class Contributte\\Wordcha\\DataSource\\Pair constructor expects string, int\|string given\.$#'
- '#^Method Contributte\\Wordcha\\Form\\WordchaContainer\:\:getQuestion\(\) should return Nette\\Forms\\Controls\\TextInput but returns Nette\\ComponentModel\\IComponent\.$#'
- '#^Method Contributte\\Wordcha\\Form\\WordchaContainer\:\:getHash\(\) should return Nette\\Forms\\Controls\\HiddenField but returns Nette\\ComponentModel\\IComponent\.$#'
- '#^Cannot access constant DATA_LINE on Nette\\Forms\\Form\|null\.$#'
- '#^Cannot call method getHttpData\(\) on Nette\\Forms\\Form\|null\.$#'
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<ruleset name="Contributte">
<!-- Contributte Coding Standard -->
<rule ref="./vendor/ninjify/coding-standard/contributte.xml"/>

<!-- Specific rules -->
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
<properties>
<property name="rootNamespaces" type="array" value="
src=>Contributte\Wordcha
"/>
</properties>
</rule>

<!-- Exclude folders -->
<exclude-pattern>/tests/tmp</exclude-pattern>
</ruleset>
@@ -1,29 +1,19 @@
<?php
<?php declare(strict_types = 1);

namespace Contributte\Wordcha\DI;

use Contributte\Wordcha\Factory;
use Contributte\Wordcha\Form\WordchaContainer;
use Nette\Forms\Container;

/**
* Class FormBinder
*
* @package Contributte\Wordcha\DI
*/
final class FormBinder
{

/**
* @param Factory $factory
*
* @return void
*/
public static function bind(Factory $factory)
public static function bind(Factory $factory): void
{
Container::extensionMethod(
'addWordcha',
function ($container, $name = 'captcha', $label = 'Captcha') use ($factory) {
function (Container $container, string $name = 'captcha', string $label = 'Captcha') use ($factory): WordchaContainer {
return $container[$name] = new WordchaContainer($factory);
}
);

0 comments on commit 0b8e64f

Please sign in to comment.
You can’t perform that action at this time.