Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: php

php:
- 7.1
- 7.2

cache:
directories:
- $HOME/.composer/cache

install: composer install

script: vendor/bin/phpcs --standard=src/LEVIY/ruleset.xml --basepath=. --report-file=phpcs.log --report-width=120 tests/; diff tests/expected.log phpcs.log
19 changes: 19 additions & 0 deletions tests/Bar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types = 1);

namespace Bar;

use \DateTime;

class Bar
{
const NOW = 'now';

public function getDate() : DateTime
{
$now = strtolower(self::NOW);

return new DateTime($now);
}
}
16 changes: 16 additions & 0 deletions tests/Foo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
declare(strict_types=1);

namespace Bar;

use DateTime;

class Foo
{
private const NOW = 'now';

public function getDate(): DateTime
{
return new DateTime(self::NOW);
}
}
16 changes: 16 additions & 0 deletions tests/expected.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

FILE: tests/Bar.php
----------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 5 LINES
----------------------------------------------------------------------------------------------------------------------
3 | ERROR | [x] Expected 1 newlines between PHP open tag and declare statement, found 2.
3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
7 | ERROR | [x] Use statement cannot start with a backslash.
11 | ERROR | [ ] Constant \Bar\Bar::NOW visibility missing.
13 | ERROR | [x] There must be no whitespace between closing parenthesis and return type colon.
15 | ERROR | [x] Function strtolower() should not be referenced via a fallback global name, but via a use statement.
----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------