Commit Graph

138 Commits

Author SHA1 Message Date
Bastien Wermeille 7771e2bf2c Fix types issues 2022-12-18 22:43:52 +01:00
Bastien Wermeille f9e4bc5835 Use php nullsafe operator to fix type issues 2022-12-18 22:04:37 +01:00
Bastien Wermeille 0841364b8d Upgrade to doctrine/lexer 3.x 2022-12-18 21:51:37 +01:00
Bastien Wermeille 3d25492123 Fix Tests + Psalm issues 2022-12-15 00:04:10 +01:00
Bastien Wermeille d80748070a Apply feedbacks 2022-12-14 20:29:41 +01:00
Bastien Wermeille 86933da4bb Migrate to doctrine/lexer v2.0 2022-12-14 14:12:31 +01:00
Mathias Reker ⚡️ 413b263617 Nullable type declaration for default null value (#328)
Adds ? before type declarations for parameters with a default null value
2022-07-13 16:53:11 +02:00
Mathias Reker ⚡️ 18b9e5b572 Visibility required (#329)
Visibility MUST be declared on all properties and methods; abstract and final MUST be declared before the visibility; static MUST be declared after the visibility.
2022-07-13 16:52:42 +02:00
Mathias Reker ⚡️ 1ca313dfcd Single blank line at eof (#330)
A PHP file without end tag must always end with a single empty line feed.
2022-07-13 16:51:51 +02:00
Mathias Reker ⚡️ cf5908bb1a No superfluous elseif (#331)
Replaces superfluous elseif with if.
2022-07-13 16:51:22 +02:00
Mathias Reker ⚡️ b241b54919 No unused imports (#332)
Unused use statements must be removed.
2022-07-13 16:50:27 +02:00
Nicolas Grekas f88dcf4b14 Don't use utf8_en/decode() functions, they're deprecated on PHP 8.2 (#325) 2022-06-18 22:57:19 +02:00
Eduardo Gulias Davis a5ed8d58ed Bug #321 (#323)
* Update dependencies

* dns_get_record wrapper for testing of the function's behaviour

* remove unused classes

* Fix Psalm errors

* Increase PHP Version
2022-05-29 00:19:18 +02:00
Robert Fridzema 9aab2ceed6 Typos (#311) 2022-02-04 21:30:40 +01:00
Julien Gidel 007bfd424e Small contribution - code readability improvements (#306)
* Some code improvements - tests same as beginning

* isUTF8Invalid returns a boolean

* Changes for tests passed

* Revert change + scrutinizer to flaky

* Null coalescing on token to return a null token

* Psalm pass and PHPunit too (php 7.4)

* Minor change to set lookahead to nullToken
2021-11-20 22:34:12 +01:00
Samuel Vicent ee0db30118 MultipleErrors->reason always returns [0] and should return first item from associative array (#305)
* Patch MultipleErrors->reason method by getting always the first item - Added Tests and a custom Exception

* Return EmptyReason instead of throwing exception when MultipleErrors has no reasons (validations accomplished)

Co-authored-by: Samuel Vicent <samuel.vicent@takeachef.com>
2021-10-11 11:18:27 +02:00
John Congdon c81f18a3ef Reset the label when a S_DOT is encountered. (#297)
This will allow multi label domain's to still validate correctly.

Reset the label when a S_DOT is encountered.
2021-04-01 20:37:14 +02:00
Dries Vints 95979e2ad6 Add null return type to getError DocBlock (#293) 2021-03-11 14:36:15 +01:00
Eduardo Gulias Davis 8e526a57c1 Message-id validator (#290)
* scafolding for MessageID validation

* Improve domain valid tokens

* Improved EmailParser to remove leaked logic. User of lexer recorder within parsers.

* MessageIDParser passing tests.

* change left for right, which is the right one

* psaml errors

* Better naming

* comments are not allowed in IDLeft for message-id

* Suppress psalm inheritance over tokens and dependencies

* Update src/Parser.php

Co-authored-by: Alexander M. Turek <me@derrabus.de>

* Update src/Parser.php

Co-authored-by: Alexander M. Turek <me@derrabus.de>

* improve parser from comments

Co-authored-by: Alexander M. Turek <me@derrabus.de>
2021-03-06 18:29:10 +01:00
Alies Lapatsin 451b438902 Use a safe way to execute dns_get_record (v3) (#286)
* #256 Bypass a PHP warning generated by @dns_get_record

The idea is to create a custom error handler for dns_get_record(), call dns_get_record and then restore the original error handler.
This way we can catch PHP warnings (e.g. "Warning: dns_get_record(): DNS Query failed" or "dns_get_record(): A temporary server error occurred." [ErrorException])

* #256 Make `UnableToGetDNSRecord` reason more testable

* #256 Suppress psalm’s false-positive error

see https://github.com/vimeo/psalm/issues/5134#issuecomment-782937791

* #256 Speed up tests: start from previously failed

* #256 Suppress psalm’s false-positive error

We don’t have a control over AbstractLexer and can’t specify array shape in this parent class
2021-02-28 15:27:57 +01:00
Eduardo Gulias Davis a7b66b5d5a Improve test coverage. Exclude Reasons from coverage, they are simple implementations of interface with only informative data 2021-01-17 15:57:03 +01:00
Eduardo Gulias Davis 47129ff2a4 Polish 2020-12-28 10:56:22 +01:00
Eduardo Gulias Davis f72a7a1854 Port @vajexal #278 2020-12-28 10:40:47 +01:00
Eduardo Gulias Davis cc695081fd new home for extra validations 2020-12-05 23:34:35 +01:00
Eduardo Gulias Davis a9d9083a9c new home for comment strategies 2020-12-05 23:33:00 +01:00
Eduardo Gulias Davis 790881fe75 improving types 2020-12-05 23:16:56 +01:00
Eduardo Gulias Davis 3dc66acf64 domain improvements over UTF16 and invalid ascii chars 2020-12-05 22:58:13 +01:00
Eduardo Gulias Davis c41a7b491e Improve domain validation 2020-11-14 23:29:20 +01:00
Eduardo Gulias Davis a7a69112df complaying to RFC1035 about domain names 2020-11-10 11:22:03 +01:00
Eduardo Gulias Davis e00a58a84e Label and domain name validation 2020-11-10 11:08:53 +01:00
Eduardo Gulias Davis c0e4efaeb0 Separation of tests to prepare for strictier domain validation 2020-11-10 10:36:53 +01:00
Eduardo Gulias Davis 729ecb2a35 Psalm fixes 2020-11-08 16:19:44 +01:00
Eduardo Gulias Davis 35c9db913f Port of comma in domain and README improvement. 2020-11-08 15:57:58 +01:00
Eduardo Gulias Davis cbe0d20542 fix #188, adding TLD warnings 2020-10-10 18:47:15 +02:00
Eduardo Gulias Davis e5bdc237eb Fixing Psalm erros 2020-10-03 17:43:06 +02:00
Eduardo Gulias Davis 5455d688c1 Part extraction improvement with lexer recording. Reported in #181 2020-10-03 17:37:57 +02:00
Eduardo Gulias Davis ce879d7d10 Fix Space after end of domain. #217 2020-09-26 16:30:00 +02:00
Eduardo Gulias Davis 49b18fbcfc Remove deprecation, comes from #257 2020-09-19 16:37:33 +02:00
Eduardo Gulias Davis e72f606ae3 Typo 2020-09-19 16:35:09 +02:00
Eduardo Gulias Davis 98ebd59e53 Psalm erros fixed 2020-09-19 16:33:03 +02:00
Eduardo Gulias Davis 9512ac0b19 Psalm errors plus test for MultipleErrors reason and improved multi validation tests 2020-09-19 16:17:03 +02:00
Eduardo Gulias Davis 8405dcde01 Added invalidtaion for backslash in domain literal and test data 2020-09-19 15:50:04 +02:00
Eduardo Gulias Davis b76c116718 Psaml run 1 2020-09-12 16:55:59 +02:00
Eduardo Gulias Davis afd6bcba6a polish 2020-09-12 16:42:19 +02:00
Eduardo Gulias Davis 044b1d55d9 Return type in signature 2020-09-12 16:41:06 +02:00
Eduardo Gulias Davis a7ebdba30a Redefine parser signature 2020-09-12 16:35:38 +02:00
Eduardo Gulias Davis 0ba6f87f8e Adjusting duplicated methods 2020-09-12 16:25:24 +02:00
Eduardo Gulias Davis bad6b501d5 Removing obsolete exceptions 2020-09-12 16:10:20 +02:00
Eduardo Gulias Davis 5faf182cca Minor polish 2020-09-12 16:02:00 +02:00
Eduardo Gulias Davis b3a339b998 Evaluate comma ',' in domain part 2020-09-12 15:53:55 +02:00