Sheath rule
native-model-property
#Why
NativePHP synchronizes model values by assigning the property on the component
that owns the view. A missing, non-public, locked, or PHP readonly property
cannot receive the update.
#Examples
#Bad
{{-- serchQuery does not exist on the owning component. --}}
<native:text-input native:model="serchQuery" />
#Good
{{-- searchQuery is a public writable owner property. --}}
<native:text-input native:model="searchQuery" />
The diagnostic identifies the owning component file and suggests a close public property when one is available.
#Component Resolution
A view has an owning component when exactly one configured component returns it
from render(). Component-specific properties are checked only when that owner
can be determined.
Views with absent, ambiguous, or unavailable ownership do not receive a property finding.
#Options
componentPaths sets the directories scanned for owning component classes. Its
default is ['app/NativeComponents']:
<?php
return [
'rules' => [
'native-model-property' => ['error', [
'componentPaths' => ['app/NativeComponents', 'modules/Native'],
]],
],
];
The rule also accepts nativeViewPaths, which defaults to
['views/native/']. See Native View Detection
for path configuration.
#See Also
Related rules validate the directive and target element:
- native-model-modifier: Require a literal property name and valid modifiers
- native-model-on-non-input: Require a change-capable element
- native-callback-exists: Validate owner methods