Skip to content

Commit

Permalink
Merge e02fda9 into 10c8d70
Browse files Browse the repository at this point in the history
  • Loading branch information
mabar committed Jul 23, 2018
2 parents 10c8d70 + e02fda9 commit 4a589cc
Show file tree
Hide file tree
Showing 23 changed files with 168 additions and 321 deletions.
20 changes: 7 additions & 13 deletions .editorconfig
@@ -1,26 +1,20 @@
# 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
trim_trailing_whitespace = true
indent_style = tab
indent_size = 4
indent_size = tab
tab_width = 4

# NEON
[*.neon]
charset = utf-8
indent_style = tab
[*.md]
indent_style = space
indent_size = 4

# Composer, NPM, Travis, BitbucketPipelines
[{composer.json,package.json,.travis.yml,bitbucket-pipelines.yml}]
[{composer.json,package.json,.travis.yml}]
indent_style = space
indent_size = 2
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -6,6 +6,8 @@
/composer.lock

# Tests
/temp/
/tests/*.log
/tests/tmp
/tests/coverage.html
/coverage.xml
26 changes: 12 additions & 14 deletions .travis.yml
@@ -1,9 +1,8 @@
language: php

php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.1
- 7.2

before_install:
# turn off XDebug
Expand All @@ -19,42 +18,41 @@ script:

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

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

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

- stage: Test Coverage
php: 7.1
php: 7.2
script:
- composer run-script coverage
after_script:
- wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar
- php coveralls.phar --verbose --config tests/.coveralls.yml
- wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.0.0/php-coveralls.phar
- php php-coveralls.phar --verbose --config tests/.coveralls.yml

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

allow_failures:
- stage: Test Coverage
- stage: Phpstan

after_failure:
# Print *.actual content
Expand Down
21 changes: 15 additions & 6 deletions README.md
Expand Up @@ -26,17 +26,19 @@ composer require contributte/utils

| State | Version | Branch | PHP |
|-------------|---------|----------|----------|
| dev | `^0.4` | `master` | `>= 7.1` |
| stable | `^0.3` | `master` | `>= 7.1` |
| stable | `^0.2` | `master` | `>= 5.6` |

## Overview

- [DateTimeFactoryExtension](https://github.com/contributte/utils/blob/master/.docs/README.md#datetime--datetimefactory)
- [DateTimeFactoryExtension](/.docs/README.md#datetime--datetimefactory)
- Collection of useful classes:
- [Fields](https://github.com/contributte/utils/blob/master/.docs/README.md#fields)
- [FileSystem](https://github.com/contributte/utils/blob/master/.docs/README.md#filesystem)
- [Strings](https://github.com/contributte/utils/blob/master/.docs/README.md#strings)
- [Urls](https://github.com/contributte/utils/blob/master/.docs/README.md#urls)
- [Validators](https://github.com/contributte/utils/blob/master/.docs/README.md#validators)
- [Fields](/.docs/README.md#fields)
- [FileSystem](/.docs/README.md#filesystem)
- [Strings](/.docs/README.md#strings)
- [Urls](/.docs/README.md#urls)
- [Validators](/.docs/README.md#validators)

## Maintainers

Expand All @@ -50,6 +52,13 @@ composer require contributte/utils
</br>
<a href="https://github.com/f3l1x">Milan Felix Šulc</a>
</td>
<td align="center">
<a href="https://github.com/mabar">
<img width="150" height="150" src="https://avatars0.githubusercontent.com/u/20974277?s=400&v=4">
</a>
</br>
<a href="https://github.com/mabar">Marek Bartoš</a>
</td>
</tr>
<tbody>
</table>
Expand Down
40 changes: 25 additions & 15 deletions composer.json
@@ -1,9 +1,17 @@
{
"name": "contributte/utils",
"description": "Extra contrib to nette/utils",
"keywords": ["nette", "utils", "strings", "filesystem", "datetime"],
"keywords": [
"nette",
"utils",
"strings",
"filesystem",
"datetime"
],
"type": "library",
"license": "MIT",
"license": [
"MIT"
],
"homepage": "https://github.com/contributte/utils",
"authors": [
{
Expand All @@ -12,26 +20,27 @@
}
],
"require": {
"php": ">= 5.6",
"nette/utils": "~2.5.1"
"php": ">= 7.1",
"nette/utils": "~2.5.2"
},
"require-dev": {
"ninjify/qa": "^0.4.0",
"ninjify/qa": "^0.8.0",
"ninjify/nunjuck": "^0.2.0",
"nette/di": "~2.4.11"
"nette/di": "~2.4.13"
},
"suggest": {
"nette/di": "to use DateTimeExtension[CompilerExtension]"
},
"conflict": {
"nette/di": "<2.4.13"
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"Contributte\\Utils\\": "src"
}
},
"autoload-dev": {
"psr-4": {
}
},
"scripts": {
"qa": [
"linter src tests",
Expand All @@ -45,17 +54,18 @@
],
"phpstan-install": [
"mkdir -p temp/phpstan",
"composer require -d temp/phpstan phpstan/phpstan:0.8.5",
"composer require -d temp/phpstan phpstan/phpstan-nette:0.8.3"
"composer require -d temp/phpstan phpstan/phpstan:0.10.2",
"composer require -d temp/phpstan phpstan/phpstan-nette:0.10.1",
"composer require -d temp/phpstan phpstan/phpstan-strict-rules:0.10.1",
"composer require -d temp/phpstan phpstan/phpstan-deprecation-rules:0.10.2"
],
"phpstan": [
"temp/phpstan/vendor/bin/phpstan analyse -l 1 -c phpstan.neon src"
"temp/phpstan/vendor/bin/phpstan analyse -l max -c phpstan.neon src"
]
},
"prefer-stable": true,
"extra": {
"branch-alias": {
"dev-develop": "0.3.x-dev"
"dev-develop": "0.4.x-dev"
}
}
}
4 changes: 2 additions & 2 deletions phpstan.neon
@@ -1,5 +1,5 @@
includes:
- temp/phpstan/vendor/phpstan/phpstan-strict-rules/rules.neon
- temp/phpstan/vendor/phpstan/phpstan-nette/extension.neon
- temp/phpstan/vendor/phpstan/phpstan-nette/rules.neon

parameters:
- temp/phpstan/vendor/phpstan/phpstan-deprecation-rules/rules.neon
20 changes: 4 additions & 16 deletions ruleset.xml
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Contributte">
<!-- Extending rulesets -->
<rule ref="vendor/ninjify/coding-standard/ruleset.xml"/>
<!-- Contributte Coding Standard -->
<rule ref="./vendor/ninjify/coding-standard/contributte.xml"/>

<!-- My rules -->
<!-- Specific rules -->
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
<properties>
<property name="rootNamespaces" type="array" value="
Expand All @@ -13,18 +13,6 @@
</properties>
</rule>

<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>
<property name="tabIndent" value="true"/>
</properties>
</rule>
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent" />

<rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition">
<exclude name="SlevomatCodingStandard.ControlStructures.AssignmentInCondition.assignmentInCondition"/>
</rule>

<!-- Exclude folders -->
<exclude-pattern>/tests/tmp</exclude-pattern>
</ruleset>
13 changes: 3 additions & 10 deletions src/DI/DateTimeFactoryExtension.php
@@ -1,29 +1,22 @@
<?php
<?php declare(strict_types = 1);

namespace Contributte\Utils\DI;

use Contributte\Utils\DatetimeFactory;
use Contributte\Utils\IDateTimeFactory;
use Nette\DI\CompilerExtension;

/**
* @author Milan Felix Sulc <sulcmil@gmail.com>
*/
class DateTimeFactoryExtension extends CompilerExtension
{

/**
* Register services
*
* @return void
*/
public function loadConfiguration()
public function loadConfiguration(): void
{
$builder = $this->getContainerBuilder();

$builder->addDefinition($this->prefix('factory'))
->setClass(IDateTimeFactory::class)
->setFactory(DatetimeFactory::class);
->setImplement(IDateTimeFactory::class);
}

}

0 comments on commit 4a589cc

Please sign in to comment.