• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nepada / form-renderer / 8912058197

01 May 2024 04:32PM UTC coverage: 97.561%. Remained the same
8912058197

Pull #154

github

web-flow
Bump the phpstan group with 5 updates

Updates the requirements on [phpstan/phpstan](https://github.com/phpstan/phpstan), [phpstan/phpstan-strict-rules](https://github.com/phpstan/phpstan-strict-rules), [nepada/phpstan-nette-tester](https://github.com/nepada/phpstan-nette-tester), [spaze/phpstan-disallowed-calls](https://github.com/spaze/phpstan-disallowed-calls) and [shipmonk/phpstan-rules](https://github.com/shipmonk-rnd/phpstan-rules) to permit the latest version.

Updates `phpstan/phpstan` to 1.10.67
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.10.66...1.10.67)

Updates `phpstan/phpstan-strict-rules` to 1.5.5
- [Release notes](https://github.com/phpstan/phpstan-strict-rules/releases)
- [Commits](https://github.com/phpstan/phpstan-strict-rules/compare/1.5.2...1.5.5)

Updates `nepada/phpstan-nette-tester` to 1.2.0
- [Release notes](https://github.com/nepada/phpstan-nette-tester/releases)
- [Commits](https://github.com/nepada/phpstan-nette-tester/compare/v1.1.0...v1.2.0)

Updates `spaze/phpstan-disallowed-calls` to 3.2.0
- [Release notes](https://github.com/spaze/phpstan-disallowed-calls/releases)
- [Commits](https://github.com/spaze/phpstan-disallowed-calls/compare/v3.1.2...v3.2.0)

Updates `shipmonk/phpstan-rules` to 2.12.0
- [Release notes](https://github.com/shipmonk-rnd/phpstan-rules/releases)
- [Commits](https://github.com/shipmonk-rnd/phpstan-rules/compare/2.11.3...2.12.0)

---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-type: direct:development
  dependency-group: phpstan
- dependency-name: phpstan/phpstan-strict-rules
  dependency-type: direct:development
  dependency-group: phpstan
- dependency-name: nepada/phpstan-nette-tester
  dependency-type: direct:development
  dependency-group: phpstan
- dependency-name: spaze/phpstan-disallowed-calls
  dependency-type: direct:... (continued)
Pull Request #154: Bump the phpstan group with 5 updates

360 of 369 relevant lines covered (97.56%)

0.98 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/FormRenderer/Filters/ValidationClassFilter.php
1
<?php
2
declare(strict_types = 1);
3

4
namespace Nepada\FormRenderer\Filters;
5

6
use Nette;
7

8
final class ValidationClassFilter
1✔
9
{
10

11
    use Nette\SmartObject;
12

13
    private ?string $invalidClass;
14

15
    private ?string $validClass;
16

17
    public function __construct(?string $invalidClass, ?string $validClass)
18
    {
19
        $this->invalidClass = $invalidClass;
1✔
20
        $this->validClass = $validClass;
1✔
21
    }
1✔
22

23
    public function __invoke(Nette\Forms\Control $control): ?string
24
    {
25
        if (count($control->getErrors()) > 0) {
1✔
26
            return $this->invalidClass;
1✔
27
        }
28

29
        if ($this->isFilled($control)) {
1✔
30
            return $this->validClass;
1✔
31
        }
32

33
        return null;
1✔
34
    }
35

36
    private function isFilled(Nette\Forms\Control $control): bool
37
    {
38
        if ($control instanceof Nette\Forms\Controls\TextInput && $control->getControlPrototype()->type === 'password') {
1✔
39
            return false;
1✔
40
        }
41

42
        if ($control instanceof Nette\Forms\Controls\BaseControl || method_exists($control, 'isFilled')) {
1✔
43
            return $control->isFilled();
1✔
44
        }
45

46
        $value = $control->getValue();
1✔
47
        return $value !== null && $value !== [] && $value !== '';
1✔
48
    }
49

50
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc