File tree Expand file tree Collapse file tree 11 files changed +33
-32
lines changed
Expand file tree Collapse file tree 11 files changed +33
-32
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ protected function manageRequest(
8080 protected function manageAppSecRequest (
8181 string $ method ,
8282 array $ headers = [],
83- string $ rawBody = '' ,
83+ string $ rawBody = ''
8484 ): array {
8585 try {
8686 $ this ->logger ->debug ('Now processing a bouncer AppSec request ' , [
Original file line number Diff line number Diff line change @@ -205,8 +205,8 @@ private function validate($rootNode): void
205205 private function watcher (ArrayNodeDefinition $ rootNode ): void
206206 {
207207 $ rootNode ->children ()
208- ->stringNode ('machine_id ' )->end ()
209- ->stringNode ('password ' )->end ()
208+ ->scalarNode ('machine_id ' )->end ()
209+ ->scalarNode ('password ' )->end ()
210210 ->end ();
211211 }
212212}
Original file line number Diff line number Diff line change @@ -30,14 +30,13 @@ public function getConfigTreeBuilder(): TreeBuilder
3030 $ treeBuilder = new TreeBuilder ('alert ' );
3131 /** @var ArrayNodeDefinition $rootNode */
3232 $ rootNode = $ treeBuilder ->getRootNode ();
33-
3433 // @formatter:off
3534 $ rootNode
3635 ->children ()
37- ->stringNode ('scenario ' )->isRequired ()->cannotBeEmpty ()->end ()
38- ->stringNode ('scenario_hash ' )->isRequired ()->cannotBeEmpty ()->end ()
39- ->stringNode ('scenario_version ' )->isRequired ()->cannotBeEmpty ()->end ()
40- ->stringNode ('message ' )->isRequired ()->cannotBeEmpty ()->end ()
36+ ->scalarNode ('scenario ' )->isRequired ()->cannotBeEmpty ()->end ()
37+ ->scalarNode ('scenario_hash ' )->isRequired ()->cannotBeEmpty ()->end ()
38+ ->scalarNode ('scenario_version ' )->isRequired ()->cannotBeEmpty ()->end ()
39+ ->scalarNode ('message ' )->isRequired ()->cannotBeEmpty ()->end ()
4140 ->integerNode ('events_count ' )->isRequired ()->min (0 )->end ()
4241 ->scalarNode ('start_at ' )->isRequired ()->cannotBeEmpty ()->end ()
4342 ->scalarNode ('stop_at ' )->isRequired ()->cannotBeEmpty ()->end ()
@@ -48,7 +47,7 @@ public function getConfigTreeBuilder(): TreeBuilder
4847 ->end ()
4948 ;
5049 // @formatter:on
51-
50+
5251 return $ treeBuilder ;
5352 }
5453}
Original file line number Diff line number Diff line change @@ -26,13 +26,13 @@ public function getConfigTreeBuilder(): TreeBuilder
2626 // @formatter:off
2727 $ rootNode
2828 ->children ()
29- ->stringNode ('origin ' )->isRequired ()->cannotBeEmpty ()->end ()
30- ->stringNode ('type ' )->isRequired ()->cannotBeEmpty ()->end ()
31- ->stringNode ('scope ' )->isRequired ()->cannotBeEmpty ()->end ()
32- ->stringNode ('value ' )->isRequired ()->cannotBeEmpty ()->end ()
33- ->stringNode ('duration ' )->isRequired ()->cannotBeEmpty ()->end ()
34- ->stringNode ('until ' )->cannotBeEmpty ()->end ()
35- ->stringNode ('scenario ' )->isRequired ()->cannotBeEmpty ()->end ()
29+ ->scalarNode ('origin ' )->isRequired ()->cannotBeEmpty ()->end ()
30+ ->scalarNode ('type ' )->isRequired ()->cannotBeEmpty ()->end ()
31+ ->scalarNode ('scope ' )->isRequired ()->cannotBeEmpty ()->end ()
32+ ->scalarNode ('value ' )->isRequired ()->cannotBeEmpty ()->end ()
33+ ->scalarNode ('duration ' )->isRequired ()->cannotBeEmpty ()->end ()
34+ ->scalarNode ('until ' )->cannotBeEmpty ()->end ()
35+ ->scalarNode ('scenario ' )->isRequired ()->cannotBeEmpty ()->end ()
3636 ->end ()
3737 ;
3838 // @formatter:on
Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ public function getConfigTreeBuilder(): TreeBuilder
2424 ->arrayNode ('meta ' )->isRequired ()
2525 ->arrayPrototype ()
2626 ->children ()
27- ->stringNode ('key ' )->isRequired ()->cannotBeEmpty ()->end ()
28- ->stringNode ('value ' )->isRequired ()->cannotBeEmpty ()->end ()
27+ ->scalarNode ('key ' )->isRequired ()->cannotBeEmpty ()->end ()
28+ ->scalarNode ('value ' )->isRequired ()->cannotBeEmpty ()->end ()
2929 ->end ()
3030 ->end ()
3131 ->end ()
Original file line number Diff line number Diff line change @@ -28,13 +28,13 @@ public function getConfigTreeBuilder(): TreeBuilder
2828 // @formatter:off
2929 $ rootNode
3030 ->children ()
31- ->stringNode ('scope ' )->isRequired ()->cannotBeEmpty ()->end ()
32- ->stringNode ('value ' )->isRequired ()->cannotBeEmpty ()->end ()
33- ->stringNode ('ip ' )->cannotBeEmpty ()->end ()
34- ->stringNode ('range ' )->cannotBeEmpty ()->end ()
31+ ->scalarNode ('scope ' )->isRequired ()->cannotBeEmpty ()->end ()
32+ ->scalarNode ('value ' )->isRequired ()->cannotBeEmpty ()->end ()
33+ ->scalarNode ('ip ' )->cannotBeEmpty ()->end ()
34+ ->scalarNode ('range ' )->cannotBeEmpty ()->end ()
3535 ->scalarNode ('as_number ' )->cannotBeEmpty ()->end ()
36- ->stringNode ('as_name ' )->cannotBeEmpty ()->end ()
37- ->stringNode ('cn ' )->cannotBeEmpty ()->end ()
36+ ->scalarNode ('as_name ' )->cannotBeEmpty ()->end ()
37+ ->scalarNode ('cn ' )->cannotBeEmpty ()->end ()
3838 ->floatNode ('latitude ' )->min (-90 )->max (90 )->end ()
3939 ->floatNode ('longitude ' )->min (-180 )->max (180 )->end ()
4040 ->end ()
Original file line number Diff line number Diff line change @@ -63,13 +63,13 @@ public function getConfigTreeBuilder(): TreeBuilder
6363 ->variableNode ('labels ' )
6464 // Remove empty labels totally
6565 ->beforeNormalization ()
66- ->ifTrue (function (mixed $ value ) {
66+ ->ifTrue (function ($ value ) {
6767 return empty ($ value );
6868 })
6969 ->thenUnset ()
7070 ->end ()
7171 ->validate ()
72- ->ifTrue (function (mixed $ value ) {
72+ ->ifTrue (function ($ value ) {
7373 // Ensure all values in the array are strings
7474 if (!is_array ($ value )) {
7575 return true ;
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ class Metrics
9292 public function __construct (
9393 array $ properties ,
9494 array $ meta ,
95- array $ items = [],
95+ array $ items = []
9696 ) {
9797 $ this ->configureProperties ($ properties );
9898 $ this ->configureMeta ($ meta );
Original file line number Diff line number Diff line change @@ -112,15 +112,15 @@ class Alert implements \JsonSerializable
112112
113113 /**
114114 * @param TProps $properties
115- * @param TSource $source
115+ * @param ? TSource $source
116116 * @param list<TEvent> $events
117117 * @param list<TDecision> $decisions
118118 * @param list<TMeta> $meta
119119 * @param list<string> $labels
120120 */
121121 public function __construct (
122122 array $ properties ,
123- array $ source ,
123+ ? array $ source ,
124124 array $ events = [],
125125 array $ decisions = [],
126126 array $ meta = [],
@@ -156,7 +156,9 @@ public static function fromArray(array $data): self
156156 public function toArray (): array
157157 {
158158 $ result = $ this ->properties ;
159- $ result ['source ' ] = $ this ->source ;
159+ if (null !== $ this ->source ) {
160+ $ result ['source ' ] = $ this ->source ;
161+ }
160162 $ result ['events ' ] = $ this ->events ;
161163 if ([] !== $ this ->decisions ) {
162164 $ result ['decisions ' ] = $ this ->decisions ;
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ public function retrieveToken(): ?string
4242 \assert (isset ($ tokenInfo ['token ' ]));
4343 $ ci
4444 ->set ($ tokenInfo ['token ' ])
45- ->expiresAt (new DateTime ($ tokenInfo ['expire ' ]));
45+ ->expiresAt (new DateTime (' @ ' . $ tokenInfo ['expire ' ]));
4646 $ this ->cache ->save ($ ci );
4747 }
4848 return $ ci ->get ();
You can’t perform that action at this time.
0 commit comments