@@ -818,10 +818,6 @@ protected static function triggerIssueForImpossible(
818
818
$ not = !$ not ;
819
819
}
820
820
821
- if ($ not ) {
822
- $ assertion = '! ' . $ assertion ;
823
- }
824
-
825
821
$ existing_var_atomic_types = $ existing_var_type ->getAtomicTypes ();
826
822
827
823
$ from_docblock = $ existing_var_type ->from_docblock
@@ -834,7 +830,7 @@ protected static function triggerIssueForImpossible(
834
830
new RedundantConditionGivenDocblockType (
835
831
'Docblock-defined type ' . $ old_var_type_string
836
832
. ' for ' . $ key
837
- . ' is always ' . $ assertion ,
833
+ . ' is ' . ( $ not ? ' never ' : ' always ') . $ assertion ,
838
834
$ code_location ,
839
835
$ old_var_type_string . ' ' . $ safe_assertion
840
836
),
@@ -847,7 +843,7 @@ protected static function triggerIssueForImpossible(
847
843
new RedundantCondition (
848
844
'Type ' . $ old_var_type_string
849
845
. ' for ' . $ key
850
- . ' is always ' . $ assertion ,
846
+ . ' is ' . ( $ not ? ' never ' : ' always ') . $ assertion ,
851
847
$ code_location ,
852
848
$ old_var_type_string . ' ' . $ safe_assertion
853
849
),
@@ -862,7 +858,7 @@ protected static function triggerIssueForImpossible(
862
858
new DocblockTypeContradiction (
863
859
'Docblock-defined type ' . $ old_var_type_string
864
860
. ' for ' . $ key
865
- . ' is never ' . $ assertion ,
861
+ . ' is ' . ( $ not ? ' always ' : ' never ') . $ assertion ,
866
862
$ code_location ,
867
863
$ old_var_type_string . ' ' . $ safe_assertion
868
864
),
@@ -871,7 +867,7 @@ protected static function triggerIssueForImpossible(
871
867
// fall through
872
868
}
873
869
} else {
874
- if ($ assertion === 'null ' ) {
870
+ if ($ assertion === 'null ' && ! $ not ) {
875
871
$ issue = new TypeDoesNotContainNull (
876
872
'Type ' . $ old_var_type_string
877
873
. ' for ' . $ key
@@ -883,7 +879,7 @@ protected static function triggerIssueForImpossible(
883
879
$ issue = new TypeDoesNotContainType (
884
880
'Type ' . $ old_var_type_string
885
881
. ' for ' . $ key
886
- . ' is never ' . $ assertion ,
882
+ . ' is ' . ( $ not ? ' always ' : ' never ') . $ assertion ,
887
883
$ code_location ,
888
884
$ old_var_type_string . ' ' . $ safe_assertion
889
885
);
0 commit comments